@0xsequence/metadata 0.42.10 → 0.43.1

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,58 @@
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 29ad5fdbf3aa39c52fb5571db3fda19c79544914
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 = "29ad5fdbf3aa39c52fb5571db3fda19c79544914";
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
-
52
46
  exports.SwapType = void 0;
53
-
54
47
  (function (SwapType) {
55
48
  SwapType["UNKNOWN"] = "UNKNOWN";
56
49
  SwapType["BUY"] = "BUY";
57
50
  SwapType["SELL"] = "SELL";
58
51
  })(exports.SwapType || (exports.SwapType = {}));
59
-
60
52
  exports.SortOrder = void 0;
61
-
62
53
  (function (SortOrder) {
63
54
  SortOrder["DESC"] = "DESC";
64
55
  SortOrder["ASC"] = "ASC";
65
56
  })(exports.SortOrder || (exports.SortOrder = {}));
66
-
67
57
  //
68
58
  // Client
69
59
  //
@@ -72,7 +62,6 @@ class Metadata {
72
62
  this.hostname = void 0;
73
63
  this.fetch = void 0;
74
64
  this.path = '/rpc/Metadata/';
75
-
76
65
  this.ping = headers => {
77
66
  return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
78
67
  return buildResponse(res).then(_data => {
@@ -82,7 +71,6 @@ class Metadata {
82
71
  });
83
72
  });
84
73
  };
85
-
86
74
  this.version = headers => {
87
75
  return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
88
76
  return buildResponse(res).then(_data => {
@@ -92,7 +80,6 @@ class Metadata {
92
80
  });
93
81
  });
94
82
  };
95
-
96
83
  this.runtimeStatus = headers => {
97
84
  return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
98
85
  return buildResponse(res).then(_data => {
@@ -102,7 +89,6 @@ class Metadata {
102
89
  });
103
90
  });
104
91
  };
105
-
106
92
  this.getTokenMetadata = (args, headers) => {
107
93
  return this.fetch(this.url('GetTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
108
94
  return buildResponse(res).then(_data => {
@@ -112,7 +98,15 @@ class Metadata {
112
98
  });
113
99
  });
114
100
  };
115
-
101
+ this.refreshTokenMetadata = (args, headers) => {
102
+ return this.fetch(this.url('RefreshTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
103
+ return buildResponse(res).then(_data => {
104
+ return {
105
+ status: _data.status
106
+ };
107
+ });
108
+ });
109
+ };
116
110
  this.getTokenMetadataBatch = (args, headers) => {
117
111
  return this.fetch(this.url('GetTokenMetadataBatch'), createHTTPRequest(args, headers)).then(res => {
118
112
  return buildResponse(res).then(_data => {
@@ -122,7 +116,6 @@ class Metadata {
122
116
  });
123
117
  });
124
118
  };
125
-
126
119
  this.searchTokenMetadata = (args, headers) => {
127
120
  return this.fetch(this.url('SearchTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
128
121
  return buildResponse(res).then(_data => {
@@ -133,7 +126,6 @@ class Metadata {
133
126
  });
134
127
  });
135
128
  };
136
-
137
129
  this.searchTokenIDs = (args, headers) => {
138
130
  return this.fetch(this.url('SearchTokenIDs'), createHTTPRequest(args, headers)).then(res => {
139
131
  return buildResponse(res).then(_data => {
@@ -144,7 +136,6 @@ class Metadata {
144
136
  });
145
137
  });
146
138
  };
147
-
148
139
  this.getContractInfo = (args, headers) => {
149
140
  return this.fetch(this.url('GetContractInfo'), createHTTPRequest(args, headers)).then(res => {
150
141
  return buildResponse(res).then(_data => {
@@ -154,7 +145,6 @@ class Metadata {
154
145
  });
155
146
  });
156
147
  };
157
-
158
148
  this.getContractInfoBatch = (args, headers) => {
159
149
  return this.fetch(this.url('GetContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
160
150
  return buildResponse(res).then(_data => {
@@ -164,7 +154,6 @@ class Metadata {
164
154
  });
165
155
  });
166
156
  };
167
-
168
157
  this.searchContractInfo = (args, headers) => {
169
158
  return this.fetch(this.url('SearchContractInfo'), createHTTPRequest(args, headers)).then(res => {
170
159
  return buildResponse(res).then(_data => {
@@ -174,7 +163,6 @@ class Metadata {
174
163
  });
175
164
  });
176
165
  };
177
-
178
166
  this.searchContractInfoBatch = (args, headers) => {
179
167
  return this.fetch(this.url('SearchContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
180
168
  return buildResponse(res).then(_data => {
@@ -184,7 +172,6 @@ class Metadata {
184
172
  });
185
173
  });
186
174
  };
187
-
188
175
  this.getNiftyswapTokenQuantity = (args, headers) => {
189
176
  return this.fetch(this.url('GetNiftyswapTokenQuantity'), createHTTPRequest(args, headers)).then(res => {
190
177
  return buildResponse(res).then(_data => {
@@ -194,7 +181,6 @@ class Metadata {
194
181
  });
195
182
  });
196
183
  };
197
-
198
184
  this.getNiftyswapUnitPrices = (args, headers) => {
199
185
  return this.fetch(this.url('GetNiftyswapUnitPrices'), createHTTPRequest(args, headers)).then(res => {
200
186
  return buildResponse(res).then(_data => {
@@ -204,17 +190,13 @@ class Metadata {
204
190
  });
205
191
  });
206
192
  };
207
-
208
193
  this.hostname = hostname;
209
- this.fetch = fetch;
194
+ this.fetch = (input, init) => fetch(input, init);
210
195
  }
211
-
212
196
  url(name) {
213
197
  return this.hostname + this.path + name;
214
198
  }
215
-
216
199
  }
217
-
218
200
  const createHTTPRequest = (body = {}, headers = {}) => {
219
201
  return {
220
202
  method: 'POST',
@@ -224,11 +206,9 @@ const createHTTPRequest = (body = {}, headers = {}) => {
224
206
  body: JSON.stringify(body || {})
225
207
  };
226
208
  };
227
-
228
209
  const buildResponse = res => {
229
210
  return res.text().then(text => {
230
211
  let data;
231
-
232
212
  try {
233
213
  data = JSON.parse(text);
234
214
  } catch (err) {
@@ -238,7 +218,6 @@ const buildResponse = res => {
238
218
  status: res.status
239
219
  };
240
220
  }
241
-
242
221
  if (!res.ok) {
243
222
  throw data; // webrpc error response
244
223
  }
@@ -249,9 +228,8 @@ const buildResponse = res => {
249
228
 
250
229
  class SequenceMetadataClient extends Metadata {
251
230
  constructor(hostname = 'https://metadata.sequence.app') {
252
- super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch__default["default"]);
231
+ super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, global.fetch);
253
232
  }
254
-
255
233
  }
256
234
 
257
235
  exports.Metadata = Metadata;
@@ -2,68 +2,58 @@
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 29ad5fdbf3aa39c52fb5571db3fda19c79544914
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 = "29ad5fdbf3aa39c52fb5571db3fda19c79544914";
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
-
52
46
  exports.SwapType = void 0;
53
-
54
47
  (function (SwapType) {
55
48
  SwapType["UNKNOWN"] = "UNKNOWN";
56
49
  SwapType["BUY"] = "BUY";
57
50
  SwapType["SELL"] = "SELL";
58
51
  })(exports.SwapType || (exports.SwapType = {}));
59
-
60
52
  exports.SortOrder = void 0;
61
-
62
53
  (function (SortOrder) {
63
54
  SortOrder["DESC"] = "DESC";
64
55
  SortOrder["ASC"] = "ASC";
65
56
  })(exports.SortOrder || (exports.SortOrder = {}));
66
-
67
57
  //
68
58
  // Client
69
59
  //
@@ -72,7 +62,6 @@ class Metadata {
72
62
  this.hostname = void 0;
73
63
  this.fetch = void 0;
74
64
  this.path = '/rpc/Metadata/';
75
-
76
65
  this.ping = headers => {
77
66
  return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
78
67
  return buildResponse(res).then(_data => {
@@ -82,7 +71,6 @@ class Metadata {
82
71
  });
83
72
  });
84
73
  };
85
-
86
74
  this.version = headers => {
87
75
  return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
88
76
  return buildResponse(res).then(_data => {
@@ -92,7 +80,6 @@ class Metadata {
92
80
  });
93
81
  });
94
82
  };
95
-
96
83
  this.runtimeStatus = headers => {
97
84
  return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
98
85
  return buildResponse(res).then(_data => {
@@ -102,7 +89,6 @@ class Metadata {
102
89
  });
103
90
  });
104
91
  };
105
-
106
92
  this.getTokenMetadata = (args, headers) => {
107
93
  return this.fetch(this.url('GetTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
108
94
  return buildResponse(res).then(_data => {
@@ -112,7 +98,15 @@ class Metadata {
112
98
  });
113
99
  });
114
100
  };
115
-
101
+ this.refreshTokenMetadata = (args, headers) => {
102
+ return this.fetch(this.url('RefreshTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
103
+ return buildResponse(res).then(_data => {
104
+ return {
105
+ status: _data.status
106
+ };
107
+ });
108
+ });
109
+ };
116
110
  this.getTokenMetadataBatch = (args, headers) => {
117
111
  return this.fetch(this.url('GetTokenMetadataBatch'), createHTTPRequest(args, headers)).then(res => {
118
112
  return buildResponse(res).then(_data => {
@@ -122,7 +116,6 @@ class Metadata {
122
116
  });
123
117
  });
124
118
  };
125
-
126
119
  this.searchTokenMetadata = (args, headers) => {
127
120
  return this.fetch(this.url('SearchTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
128
121
  return buildResponse(res).then(_data => {
@@ -133,7 +126,6 @@ class Metadata {
133
126
  });
134
127
  });
135
128
  };
136
-
137
129
  this.searchTokenIDs = (args, headers) => {
138
130
  return this.fetch(this.url('SearchTokenIDs'), createHTTPRequest(args, headers)).then(res => {
139
131
  return buildResponse(res).then(_data => {
@@ -144,7 +136,6 @@ class Metadata {
144
136
  });
145
137
  });
146
138
  };
147
-
148
139
  this.getContractInfo = (args, headers) => {
149
140
  return this.fetch(this.url('GetContractInfo'), createHTTPRequest(args, headers)).then(res => {
150
141
  return buildResponse(res).then(_data => {
@@ -154,7 +145,6 @@ class Metadata {
154
145
  });
155
146
  });
156
147
  };
157
-
158
148
  this.getContractInfoBatch = (args, headers) => {
159
149
  return this.fetch(this.url('GetContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
160
150
  return buildResponse(res).then(_data => {
@@ -164,7 +154,6 @@ class Metadata {
164
154
  });
165
155
  });
166
156
  };
167
-
168
157
  this.searchContractInfo = (args, headers) => {
169
158
  return this.fetch(this.url('SearchContractInfo'), createHTTPRequest(args, headers)).then(res => {
170
159
  return buildResponse(res).then(_data => {
@@ -174,7 +163,6 @@ class Metadata {
174
163
  });
175
164
  });
176
165
  };
177
-
178
166
  this.searchContractInfoBatch = (args, headers) => {
179
167
  return this.fetch(this.url('SearchContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
180
168
  return buildResponse(res).then(_data => {
@@ -184,7 +172,6 @@ class Metadata {
184
172
  });
185
173
  });
186
174
  };
187
-
188
175
  this.getNiftyswapTokenQuantity = (args, headers) => {
189
176
  return this.fetch(this.url('GetNiftyswapTokenQuantity'), createHTTPRequest(args, headers)).then(res => {
190
177
  return buildResponse(res).then(_data => {
@@ -194,7 +181,6 @@ class Metadata {
194
181
  });
195
182
  });
196
183
  };
197
-
198
184
  this.getNiftyswapUnitPrices = (args, headers) => {
199
185
  return this.fetch(this.url('GetNiftyswapUnitPrices'), createHTTPRequest(args, headers)).then(res => {
200
186
  return buildResponse(res).then(_data => {
@@ -204,17 +190,13 @@ class Metadata {
204
190
  });
205
191
  });
206
192
  };
207
-
208
193
  this.hostname = hostname;
209
- this.fetch = fetch;
194
+ this.fetch = (input, init) => fetch(input, init);
210
195
  }
211
-
212
196
  url(name) {
213
197
  return this.hostname + this.path + name;
214
198
  }
215
-
216
199
  }
217
-
218
200
  const createHTTPRequest = (body = {}, headers = {}) => {
219
201
  return {
220
202
  method: 'POST',
@@ -224,11 +206,9 @@ const createHTTPRequest = (body = {}, headers = {}) => {
224
206
  body: JSON.stringify(body || {})
225
207
  };
226
208
  };
227
-
228
209
  const buildResponse = res => {
229
210
  return res.text().then(text => {
230
211
  let data;
231
-
232
212
  try {
233
213
  data = JSON.parse(text);
234
214
  } catch (err) {
@@ -238,7 +218,6 @@ const buildResponse = res => {
238
218
  status: res.status
239
219
  };
240
220
  }
241
-
242
221
  if (!res.ok) {
243
222
  throw data; // webrpc error response
244
223
  }
@@ -249,9 +228,8 @@ const buildResponse = res => {
249
228
 
250
229
  class SequenceMetadataClient extends Metadata {
251
230
  constructor(hostname = 'https://metadata.sequence.app') {
252
- super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch__default["default"]);
231
+ super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, global.fetch);
253
232
  }
254
-
255
233
  }
256
234
 
257
235
  exports.Metadata = Metadata;
@@ -1,61 +1,55 @@
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 29ad5fdbf3aa39c52fb5571db3fda19c79544914
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";
28
25
 
29
- const WebRPCSchemaVersion = "v0.4.0"; // Schema hash generated from your RIDL schema
26
+ // Schema version of your RIDL schema
27
+ const WebRPCSchemaVersion = "v0.4.0";
30
28
 
31
- const WebRPCSchemaHash = "3f6b0f4aa1a7b58488e9399c277fc17995d74f5a"; //
29
+ // Schema hash generated from your RIDL schema
30
+ const WebRPCSchemaHash = "29ad5fdbf3aa39c52fb5571db3fda19c79544914";
31
+
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
-
44
42
  let SwapType;
45
-
46
43
  (function (SwapType) {
47
44
  SwapType["UNKNOWN"] = "UNKNOWN";
48
45
  SwapType["BUY"] = "BUY";
49
46
  SwapType["SELL"] = "SELL";
50
47
  })(SwapType || (SwapType = {}));
51
-
52
48
  let SortOrder;
53
-
54
49
  (function (SortOrder) {
55
50
  SortOrder["DESC"] = "DESC";
56
51
  SortOrder["ASC"] = "ASC";
57
52
  })(SortOrder || (SortOrder = {}));
58
-
59
53
  //
60
54
  // Client
61
55
  //
@@ -64,7 +58,6 @@ class Metadata {
64
58
  this.hostname = void 0;
65
59
  this.fetch = void 0;
66
60
  this.path = '/rpc/Metadata/';
67
-
68
61
  this.ping = headers => {
69
62
  return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
70
63
  return buildResponse(res).then(_data => {
@@ -74,7 +67,6 @@ class Metadata {
74
67
  });
75
68
  });
76
69
  };
77
-
78
70
  this.version = headers => {
79
71
  return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
80
72
  return buildResponse(res).then(_data => {
@@ -84,7 +76,6 @@ class Metadata {
84
76
  });
85
77
  });
86
78
  };
87
-
88
79
  this.runtimeStatus = headers => {
89
80
  return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
90
81
  return buildResponse(res).then(_data => {
@@ -94,7 +85,6 @@ class Metadata {
94
85
  });
95
86
  });
96
87
  };
97
-
98
88
  this.getTokenMetadata = (args, headers) => {
99
89
  return this.fetch(this.url('GetTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
100
90
  return buildResponse(res).then(_data => {
@@ -104,7 +94,15 @@ class Metadata {
104
94
  });
105
95
  });
106
96
  };
107
-
97
+ this.refreshTokenMetadata = (args, headers) => {
98
+ return this.fetch(this.url('RefreshTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
99
+ return buildResponse(res).then(_data => {
100
+ return {
101
+ status: _data.status
102
+ };
103
+ });
104
+ });
105
+ };
108
106
  this.getTokenMetadataBatch = (args, headers) => {
109
107
  return this.fetch(this.url('GetTokenMetadataBatch'), createHTTPRequest(args, headers)).then(res => {
110
108
  return buildResponse(res).then(_data => {
@@ -114,7 +112,6 @@ class Metadata {
114
112
  });
115
113
  });
116
114
  };
117
-
118
115
  this.searchTokenMetadata = (args, headers) => {
119
116
  return this.fetch(this.url('SearchTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
120
117
  return buildResponse(res).then(_data => {
@@ -125,7 +122,6 @@ class Metadata {
125
122
  });
126
123
  });
127
124
  };
128
-
129
125
  this.searchTokenIDs = (args, headers) => {
130
126
  return this.fetch(this.url('SearchTokenIDs'), createHTTPRequest(args, headers)).then(res => {
131
127
  return buildResponse(res).then(_data => {
@@ -136,7 +132,6 @@ class Metadata {
136
132
  });
137
133
  });
138
134
  };
139
-
140
135
  this.getContractInfo = (args, headers) => {
141
136
  return this.fetch(this.url('GetContractInfo'), createHTTPRequest(args, headers)).then(res => {
142
137
  return buildResponse(res).then(_data => {
@@ -146,7 +141,6 @@ class Metadata {
146
141
  });
147
142
  });
148
143
  };
149
-
150
144
  this.getContractInfoBatch = (args, headers) => {
151
145
  return this.fetch(this.url('GetContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
152
146
  return buildResponse(res).then(_data => {
@@ -156,7 +150,6 @@ class Metadata {
156
150
  });
157
151
  });
158
152
  };
159
-
160
153
  this.searchContractInfo = (args, headers) => {
161
154
  return this.fetch(this.url('SearchContractInfo'), createHTTPRequest(args, headers)).then(res => {
162
155
  return buildResponse(res).then(_data => {
@@ -166,7 +159,6 @@ class Metadata {
166
159
  });
167
160
  });
168
161
  };
169
-
170
162
  this.searchContractInfoBatch = (args, headers) => {
171
163
  return this.fetch(this.url('SearchContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
172
164
  return buildResponse(res).then(_data => {
@@ -176,7 +168,6 @@ class Metadata {
176
168
  });
177
169
  });
178
170
  };
179
-
180
171
  this.getNiftyswapTokenQuantity = (args, headers) => {
181
172
  return this.fetch(this.url('GetNiftyswapTokenQuantity'), createHTTPRequest(args, headers)).then(res => {
182
173
  return buildResponse(res).then(_data => {
@@ -186,7 +177,6 @@ class Metadata {
186
177
  });
187
178
  });
188
179
  };
189
-
190
180
  this.getNiftyswapUnitPrices = (args, headers) => {
191
181
  return this.fetch(this.url('GetNiftyswapUnitPrices'), createHTTPRequest(args, headers)).then(res => {
192
182
  return buildResponse(res).then(_data => {
@@ -196,17 +186,13 @@ class Metadata {
196
186
  });
197
187
  });
198
188
  };
199
-
200
189
  this.hostname = hostname;
201
- this.fetch = fetch;
190
+ this.fetch = (input, init) => fetch(input, init);
202
191
  }
203
-
204
192
  url(name) {
205
193
  return this.hostname + this.path + name;
206
194
  }
207
-
208
195
  }
209
-
210
196
  const createHTTPRequest = (body = {}, headers = {}) => {
211
197
  return {
212
198
  method: 'POST',
@@ -216,11 +202,9 @@ const createHTTPRequest = (body = {}, headers = {}) => {
216
202
  body: JSON.stringify(body || {})
217
203
  };
218
204
  };
219
-
220
205
  const buildResponse = res => {
221
206
  return res.text().then(text => {
222
207
  let data;
223
-
224
208
  try {
225
209
  data = JSON.parse(text);
226
210
  } catch (err) {
@@ -230,7 +214,6 @@ const buildResponse = res => {
230
214
  status: res.status
231
215
  };
232
216
  }
233
-
234
217
  if (!res.ok) {
235
218
  throw data; // webrpc error response
236
219
  }
@@ -241,9 +224,8 @@ const buildResponse = res => {
241
224
 
242
225
  class SequenceMetadataClient extends Metadata {
243
226
  constructor(hostname = 'https://metadata.sequence.app') {
244
- super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
227
+ super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, global.fetch);
245
228
  }
246
-
247
229
  }
248
230
 
249
231
  export { ContractType, Metadata, 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,6 +1,6 @@
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 = "29ad5fdbf3aa39c52fb5571db3fda19c79544914";
4
4
  export declare enum ContractType {
5
5
  UNKNOWN = "UNKNOWN",
6
6
  ERC20 = "ERC20",
@@ -40,14 +40,18 @@ export interface ContractIndex {
40
40
  metadata: {
41
41
  [key: string]: any;
42
42
  };
43
+ contentHash: number;
44
+ notFound: boolean;
43
45
  }
44
46
  export interface TokenIndex {
47
+ key: string;
45
48
  chainId: number;
46
49
  contractAddress: string;
47
50
  tokenId: string;
48
51
  metadata: {
49
52
  [key: string]: any;
50
53
  };
54
+ notFound: boolean;
51
55
  }
52
56
  export interface ContractInfo {
53
57
  chainId: number;
@@ -105,6 +109,7 @@ export interface Metadata {
105
109
  version(headers?: object): Promise<VersionReturn>;
106
110
  runtimeStatus(headers?: object): Promise<RuntimeStatusReturn>;
107
111
  getTokenMetadata(args: GetTokenMetadataArgs, headers?: object): Promise<GetTokenMetadataReturn>;
112
+ refreshTokenMetadata(args: RefreshTokenMetadataArgs, headers?: object): Promise<RefreshTokenMetadataReturn>;
108
113
  getTokenMetadataBatch(args: GetTokenMetadataBatchArgs, headers?: object): Promise<GetTokenMetadataBatchReturn>;
109
114
  searchTokenMetadata(args: SearchTokenMetadataArgs, headers?: object): Promise<SearchTokenMetadataReturn>;
110
115
  searchTokenIDs(args: SearchTokenIDsArgs, headers?: object): Promise<SearchTokenIDsReturn>;
@@ -138,6 +143,17 @@ export interface GetTokenMetadataArgs {
138
143
  export interface GetTokenMetadataReturn {
139
144
  tokenMetadata: Array<TokenMetadata>;
140
145
  }
146
+ export interface RefreshTokenMetadataArgs {
147
+ chainID: string;
148
+ contractAddress: string;
149
+ tokenIDs?: Array<string>;
150
+ refreshAll?: boolean;
151
+ }
152
+ export interface RefreshTokenMetadataReturn {
153
+ status: {
154
+ [key: string]: boolean;
155
+ };
156
+ }
141
157
  export interface GetTokenMetadataBatchArgs {
142
158
  chainID: string;
143
159
  contractTokenMap: {
@@ -229,6 +245,7 @@ export declare class Metadata implements Metadata {
229
245
  version: (headers?: object | undefined) => Promise<VersionReturn>;
230
246
  runtimeStatus: (headers?: object | undefined) => Promise<RuntimeStatusReturn>;
231
247
  getTokenMetadata: (args: GetTokenMetadataArgs, headers?: object | undefined) => Promise<GetTokenMetadataReturn>;
248
+ refreshTokenMetadata: (args: RefreshTokenMetadataArgs, headers?: object | undefined) => Promise<RefreshTokenMetadataReturn>;
232
249
  getTokenMetadataBatch: (args: GetTokenMetadataBatchArgs, headers?: object | undefined) => Promise<GetTokenMetadataBatchReturn>;
233
250
  searchTokenMetadata: (args: SearchTokenMetadataArgs, headers?: object | undefined) => Promise<SearchTokenMetadataReturn>;
234
251
  searchTokenIDs: (args: SearchTokenIDsArgs, headers?: object | undefined) => Promise<SearchTokenIDsReturn>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/metadata",
3
- "version": "0.42.10",
3
+ "version": "0.43.1",
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 29ad5fdbf3aa39c52fb5571db3fda19c79544914
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 = "29ad5fdbf3aa39c52fb5571db3fda19c79544914"
16
16
 
17
17
  //
18
18
  // Types
@@ -60,14 +60,18 @@ export interface ContractIndex {
60
60
  address: string
61
61
  type: ContractType
62
62
  metadata: {[key: string]: any}
63
+ contentHash: number
64
+ notFound: boolean
63
65
  }
64
66
 
65
67
  export interface TokenIndex {
68
+ key: string
66
69
  chainId: number
67
70
  contractAddress: string
68
71
  tokenId: string
69
72
  metadata: {[key: string]: any}
70
73
 
74
+ notFound: boolean
71
75
  }
72
76
 
73
77
  export interface ContractInfo {
@@ -128,6 +132,7 @@ export interface Metadata {
128
132
  version(headers?: object): Promise<VersionReturn>
129
133
  runtimeStatus(headers?: object): Promise<RuntimeStatusReturn>
130
134
  getTokenMetadata(args: GetTokenMetadataArgs, headers?: object): Promise<GetTokenMetadataReturn>
135
+ refreshTokenMetadata(args: RefreshTokenMetadataArgs, headers?: object): Promise<RefreshTokenMetadataReturn>
131
136
  getTokenMetadataBatch(args: GetTokenMetadataBatchArgs, headers?: object): Promise<GetTokenMetadataBatchReturn>
132
137
  searchTokenMetadata(args: SearchTokenMetadataArgs, headers?: object): Promise<SearchTokenMetadataReturn>
133
138
  searchTokenIDs(args: SearchTokenIDsArgs, headers?: object): Promise<SearchTokenIDsReturn>
@@ -166,6 +171,16 @@ export interface GetTokenMetadataArgs {
166
171
  export interface GetTokenMetadataReturn {
167
172
  tokenMetadata: Array<TokenMetadata>
168
173
  }
174
+ export interface RefreshTokenMetadataArgs {
175
+ chainID: string
176
+ contractAddress: string
177
+ tokenIDs?: Array<string>
178
+ refreshAll?: boolean
179
+ }
180
+
181
+ export interface RefreshTokenMetadataReturn {
182
+ status: {[key: string]: boolean}
183
+ }
169
184
  export interface GetTokenMetadataBatchArgs {
170
185
  chainID: string
171
186
  contractTokenMap: {[key: string]: Array<string>}
@@ -257,7 +272,7 @@ export class Metadata implements Metadata {
257
272
 
258
273
  constructor(hostname: string, fetch: Fetch) {
259
274
  this.hostname = hostname
260
- this.fetch = fetch
275
+ this.fetch = (input: RequestInfo, init?: RequestInit) => fetch(input, init)
261
276
  }
262
277
 
263
278
  private url(name: string): string {
@@ -315,6 +330,18 @@ export class Metadata implements Metadata {
315
330
  })
316
331
  }
317
332
 
333
+ refreshTokenMetadata = (args: RefreshTokenMetadataArgs, headers?: object): Promise<RefreshTokenMetadataReturn> => {
334
+ return this.fetch(
335
+ this.url('RefreshTokenMetadata'),
336
+ createHTTPRequest(args, headers)).then((res) => {
337
+ return buildResponse(res).then(_data => {
338
+ return {
339
+ status: <{[key: string]: boolean}>(_data.status)
340
+ }
341
+ })
342
+ })
343
+ }
344
+
318
345
  getTokenMetadataBatch = (args: GetTokenMetadataBatchArgs, headers?: object): Promise<GetTokenMetadataBatchReturn> => {
319
346
  return this.fetch(
320
347
  this.url('GetTokenMetadataBatch'),