@0xsequence/metadata 0.0.0-20230505164841 → 0.0.0-20230509145455

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.
@@ -1 +1,11 @@
1
- export * from "./declarations/src/index";
1
+ // are you seeing an error that a default export doesn't exist but your source file has a default export?
2
+ // you should run `yarn` or `yarn preconstruct dev` if preconstruct dev isn't in your postinstall hook
3
+
4
+ // curious why you need to?
5
+ // this file exists so that you can import from the entrypoint normally
6
+ // except that it points to your source file and you don't need to run build constantly
7
+ // which means we need to re-export all of the modules from your source file
8
+ // and since export * doesn't include default exports, we need to read your source file
9
+ // to check for a default export and re-export it if it exists
10
+ // it's not ideal, but it works pretty well ¯\_(ツ)_/¯
11
+ export * from "../src/index";
@@ -1,7 +1,16 @@
1
- 'use strict';
1
+ "use strict";
2
+ // this file might look strange and you might be wondering what it's for
3
+ // it's lets you import your source files by importing this entrypoint
4
+ // as you would import it if it was built with preconstruct build
5
+ // this file is slightly different to some others though
6
+ // it has a require hook which compiles your code with Babel
7
+ // this means that you don't have to set up @babel/register or anything like that
8
+ // but you can still require this module and it'll be compiled
2
9
 
3
- if (process.env.NODE_ENV === "production") {
4
- module.exports = require("./0xsequence-metadata.cjs.prod.js");
5
- } else {
6
- module.exports = require("./0xsequence-metadata.cjs.dev.js");
7
- }
10
+ // this bit of code imports the require hook and registers it
11
+ let unregister = require("../../../node_modules/.pnpm/@preconstruct+hook@0.4.0/node_modules/@preconstruct/hook").___internalHook(typeof __dirname === 'undefined' ? undefined : __dirname, "../../..", "..");
12
+
13
+ // this re-exports the source file
14
+ module.exports = require("../src/index.ts");
15
+
16
+ unregister();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/metadata",
3
- "version": "0.0.0-20230505164841",
3
+ "version": "0.0.0-20230509145455",
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",
@@ -1,278 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- function _extends() {
6
- _extends = Object.assign ? Object.assign.bind() : function (target) {
7
- for (var i = 1; i < arguments.length; i++) {
8
- var source = arguments[i];
9
- for (var key in source) {
10
- if (Object.prototype.hasOwnProperty.call(source, key)) {
11
- target[key] = source[key];
12
- }
13
- }
14
- }
15
- return target;
16
- };
17
- return _extends.apply(this, arguments);
18
- }
19
-
20
- /* eslint-disable */
21
- // sequence-metadata v0.4.0 5d87d77b951c5d197544d97d75241bf3d02679d9
22
- // --
23
- // Code generated by webrpc-gen@v0.10.x-dev with typescript generator. DO NOT EDIT.
24
- //
25
- // webrpc-gen -schema=metadata.ridl -target=typescript -client -out=./clients/metadata.gen.ts
26
-
27
- // WebRPC description and code-gen version
28
- const WebRPCVersion = "v1";
29
-
30
- // Schema version of your RIDL schema
31
- const WebRPCSchemaVersion = "v0.4.0";
32
-
33
- // Schema hash generated from your RIDL schema
34
- const WebRPCSchemaHash = "5d87d77b951c5d197544d97d75241bf3d02679d9";
35
-
36
- //
37
- // Types
38
- //
39
-
40
- let ContractType = /*#__PURE__*/function (ContractType) {
41
- ContractType["UNKNOWN"] = "UNKNOWN";
42
- ContractType["ERC20"] = "ERC20";
43
- ContractType["ERC721"] = "ERC721";
44
- ContractType["ERC1155"] = "ERC1155";
45
- return ContractType;
46
- }({});
47
- let PropertyType = /*#__PURE__*/function (PropertyType) {
48
- PropertyType["INT"] = "INT";
49
- PropertyType["STRING"] = "STRING";
50
- PropertyType["ARRAY"] = "ARRAY";
51
- PropertyType["GENERIC"] = "GENERIC";
52
- return PropertyType;
53
- }({});
54
- let SwapType = /*#__PURE__*/function (SwapType) {
55
- SwapType["UNKNOWN"] = "UNKNOWN";
56
- SwapType["BUY"] = "BUY";
57
- SwapType["SELL"] = "SELL";
58
- return SwapType;
59
- }({});
60
- let SortOrder = /*#__PURE__*/function (SortOrder) {
61
- SortOrder["DESC"] = "DESC";
62
- SortOrder["ASC"] = "ASC";
63
- return SortOrder;
64
- }({});
65
- //
66
- // Client
67
- //
68
- class Metadata {
69
- constructor(hostname, fetch) {
70
- this.path = '/rpc/Metadata/';
71
- this.ping = headers => {
72
- return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
73
- return buildResponse(res).then(_data => {
74
- return {
75
- status: _data.status
76
- };
77
- });
78
- });
79
- };
80
- this.version = headers => {
81
- return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
82
- return buildResponse(res).then(_data => {
83
- return {
84
- version: _data.version
85
- };
86
- });
87
- });
88
- };
89
- this.runtimeStatus = headers => {
90
- return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
91
- return buildResponse(res).then(_data => {
92
- return {
93
- status: _data.status
94
- };
95
- });
96
- });
97
- };
98
- this.getTokenMetadata = (args, headers) => {
99
- return this.fetch(this.url('GetTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
100
- return buildResponse(res).then(_data => {
101
- return {
102
- tokenMetadata: _data.tokenMetadata
103
- };
104
- });
105
- });
106
- };
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
- this.getTokenMetadataBatch = (args, headers) => {
117
- return this.fetch(this.url('GetTokenMetadataBatch'), createHTTPRequest(args, headers)).then(res => {
118
- return buildResponse(res).then(_data => {
119
- return {
120
- contractTokenMetadata: _data.contractTokenMetadata
121
- };
122
- });
123
- });
124
- };
125
- this.searchTokenMetadata = (args, headers) => {
126
- return this.fetch(this.url('SearchTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
127
- return buildResponse(res).then(_data => {
128
- return {
129
- page: _data.page,
130
- tokenMetadata: _data.tokenMetadata
131
- };
132
- });
133
- });
134
- };
135
- this.searchTokenIDs = (args, headers) => {
136
- return this.fetch(this.url('SearchTokenIDs'), createHTTPRequest(args, headers)).then(res => {
137
- return buildResponse(res).then(_data => {
138
- return {
139
- page: _data.page,
140
- tokenIds: _data.tokenIds
141
- };
142
- });
143
- });
144
- };
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
- };
154
- this.getContractInfo = (args, headers) => {
155
- return this.fetch(this.url('GetContractInfo'), createHTTPRequest(args, headers)).then(res => {
156
- return buildResponse(res).then(_data => {
157
- return {
158
- contractInfo: _data.contractInfo
159
- };
160
- });
161
- });
162
- };
163
- this.getContractInfoBatch = (args, headers) => {
164
- return this.fetch(this.url('GetContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
165
- return buildResponse(res).then(_data => {
166
- return {
167
- contractInfoMap: _data.contractInfoMap
168
- };
169
- });
170
- });
171
- };
172
- this.searchContractInfo = (args, headers) => {
173
- return this.fetch(this.url('SearchContractInfo'), createHTTPRequest(args, headers)).then(res => {
174
- return buildResponse(res).then(_data => {
175
- return {
176
- contractInfoList: _data.contractInfoList
177
- };
178
- });
179
- });
180
- };
181
- this.searchContractInfoBatch = (args, headers) => {
182
- return this.fetch(this.url('SearchContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
183
- return buildResponse(res).then(_data => {
184
- return {
185
- contractInfoByChain: _data.contractInfoByChain
186
- };
187
- });
188
- });
189
- };
190
- this.searchMetadata = (args, headers) => {
191
- return this.fetch(this.url('SearchMetadata'), createHTTPRequest(args, headers)).then(res => {
192
- return buildResponse(res).then(_data => {
193
- return {
194
- tokenMetadata: _data.tokenMetadata,
195
- contractInfo: _data.contractInfo
196
- };
197
- });
198
- });
199
- };
200
- this.getNiftyswapTokenQuantity = (args, headers) => {
201
- return this.fetch(this.url('GetNiftyswapTokenQuantity'), createHTTPRequest(args, headers)).then(res => {
202
- return buildResponse(res).then(_data => {
203
- return {
204
- quantity: _data.quantity
205
- };
206
- });
207
- });
208
- };
209
- this.getNiftyswapUnitPrices = (args, headers) => {
210
- return this.fetch(this.url('GetNiftyswapUnitPrices'), createHTTPRequest(args, headers)).then(res => {
211
- return buildResponse(res).then(_data => {
212
- return {
213
- prices: _data.prices
214
- };
215
- });
216
- });
217
- };
218
- this.getNiftyswapUnitPricesWithQuantities = (args, headers) => {
219
- return this.fetch(this.url('GetNiftyswapUnitPricesWithQuantities'), createHTTPRequest(args, headers)).then(res => {
220
- return buildResponse(res).then(_data => {
221
- return {
222
- prices: _data.prices
223
- };
224
- });
225
- });
226
- };
227
- this.hostname = hostname;
228
- this.fetch = (input, init) => fetch(input, init);
229
- }
230
- url(name) {
231
- return this.hostname + this.path + name;
232
- }
233
- }
234
- const createHTTPRequest = (body = {}, headers = {}) => {
235
- return {
236
- method: 'POST',
237
- headers: _extends({}, headers, {
238
- 'Content-Type': 'application/json'
239
- }),
240
- body: JSON.stringify(body || {})
241
- };
242
- };
243
- const buildResponse = res => {
244
- return res.text().then(text => {
245
- let data;
246
- try {
247
- data = JSON.parse(text);
248
- } catch (err) {
249
- throw {
250
- code: 'unknown',
251
- msg: `expecting JSON, got: ${text}`,
252
- status: res.status
253
- };
254
- }
255
- if (!res.ok) {
256
- throw data; // webrpc error response
257
- }
258
-
259
- return data;
260
- });
261
- };
262
-
263
- const fetch = typeof global === 'object' ? global.fetch : window.fetch;
264
- class SequenceMetadataClient extends Metadata {
265
- constructor(hostname = 'https://metadata.sequence.app') {
266
- super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
267
- }
268
- }
269
-
270
- exports.ContractType = ContractType;
271
- exports.Metadata = Metadata;
272
- exports.PropertyType = PropertyType;
273
- exports.SequenceMetadataClient = SequenceMetadataClient;
274
- exports.SortOrder = SortOrder;
275
- exports.SwapType = SwapType;
276
- exports.WebRPCSchemaHash = WebRPCSchemaHash;
277
- exports.WebRPCSchemaVersion = WebRPCSchemaVersion;
278
- exports.WebRPCVersion = WebRPCVersion;
@@ -1,278 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- function _extends() {
6
- _extends = Object.assign ? Object.assign.bind() : function (target) {
7
- for (var i = 1; i < arguments.length; i++) {
8
- var source = arguments[i];
9
- for (var key in source) {
10
- if (Object.prototype.hasOwnProperty.call(source, key)) {
11
- target[key] = source[key];
12
- }
13
- }
14
- }
15
- return target;
16
- };
17
- return _extends.apply(this, arguments);
18
- }
19
-
20
- /* eslint-disable */
21
- // sequence-metadata v0.4.0 5d87d77b951c5d197544d97d75241bf3d02679d9
22
- // --
23
- // Code generated by webrpc-gen@v0.10.x-dev with typescript generator. DO NOT EDIT.
24
- //
25
- // webrpc-gen -schema=metadata.ridl -target=typescript -client -out=./clients/metadata.gen.ts
26
-
27
- // WebRPC description and code-gen version
28
- const WebRPCVersion = "v1";
29
-
30
- // Schema version of your RIDL schema
31
- const WebRPCSchemaVersion = "v0.4.0";
32
-
33
- // Schema hash generated from your RIDL schema
34
- const WebRPCSchemaHash = "5d87d77b951c5d197544d97d75241bf3d02679d9";
35
-
36
- //
37
- // Types
38
- //
39
-
40
- let ContractType = /*#__PURE__*/function (ContractType) {
41
- ContractType["UNKNOWN"] = "UNKNOWN";
42
- ContractType["ERC20"] = "ERC20";
43
- ContractType["ERC721"] = "ERC721";
44
- ContractType["ERC1155"] = "ERC1155";
45
- return ContractType;
46
- }({});
47
- let PropertyType = /*#__PURE__*/function (PropertyType) {
48
- PropertyType["INT"] = "INT";
49
- PropertyType["STRING"] = "STRING";
50
- PropertyType["ARRAY"] = "ARRAY";
51
- PropertyType["GENERIC"] = "GENERIC";
52
- return PropertyType;
53
- }({});
54
- let SwapType = /*#__PURE__*/function (SwapType) {
55
- SwapType["UNKNOWN"] = "UNKNOWN";
56
- SwapType["BUY"] = "BUY";
57
- SwapType["SELL"] = "SELL";
58
- return SwapType;
59
- }({});
60
- let SortOrder = /*#__PURE__*/function (SortOrder) {
61
- SortOrder["DESC"] = "DESC";
62
- SortOrder["ASC"] = "ASC";
63
- return SortOrder;
64
- }({});
65
- //
66
- // Client
67
- //
68
- class Metadata {
69
- constructor(hostname, fetch) {
70
- this.path = '/rpc/Metadata/';
71
- this.ping = headers => {
72
- return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
73
- return buildResponse(res).then(_data => {
74
- return {
75
- status: _data.status
76
- };
77
- });
78
- });
79
- };
80
- this.version = headers => {
81
- return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
82
- return buildResponse(res).then(_data => {
83
- return {
84
- version: _data.version
85
- };
86
- });
87
- });
88
- };
89
- this.runtimeStatus = headers => {
90
- return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
91
- return buildResponse(res).then(_data => {
92
- return {
93
- status: _data.status
94
- };
95
- });
96
- });
97
- };
98
- this.getTokenMetadata = (args, headers) => {
99
- return this.fetch(this.url('GetTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
100
- return buildResponse(res).then(_data => {
101
- return {
102
- tokenMetadata: _data.tokenMetadata
103
- };
104
- });
105
- });
106
- };
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
- this.getTokenMetadataBatch = (args, headers) => {
117
- return this.fetch(this.url('GetTokenMetadataBatch'), createHTTPRequest(args, headers)).then(res => {
118
- return buildResponse(res).then(_data => {
119
- return {
120
- contractTokenMetadata: _data.contractTokenMetadata
121
- };
122
- });
123
- });
124
- };
125
- this.searchTokenMetadata = (args, headers) => {
126
- return this.fetch(this.url('SearchTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
127
- return buildResponse(res).then(_data => {
128
- return {
129
- page: _data.page,
130
- tokenMetadata: _data.tokenMetadata
131
- };
132
- });
133
- });
134
- };
135
- this.searchTokenIDs = (args, headers) => {
136
- return this.fetch(this.url('SearchTokenIDs'), createHTTPRequest(args, headers)).then(res => {
137
- return buildResponse(res).then(_data => {
138
- return {
139
- page: _data.page,
140
- tokenIds: _data.tokenIds
141
- };
142
- });
143
- });
144
- };
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
- };
154
- this.getContractInfo = (args, headers) => {
155
- return this.fetch(this.url('GetContractInfo'), createHTTPRequest(args, headers)).then(res => {
156
- return buildResponse(res).then(_data => {
157
- return {
158
- contractInfo: _data.contractInfo
159
- };
160
- });
161
- });
162
- };
163
- this.getContractInfoBatch = (args, headers) => {
164
- return this.fetch(this.url('GetContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
165
- return buildResponse(res).then(_data => {
166
- return {
167
- contractInfoMap: _data.contractInfoMap
168
- };
169
- });
170
- });
171
- };
172
- this.searchContractInfo = (args, headers) => {
173
- return this.fetch(this.url('SearchContractInfo'), createHTTPRequest(args, headers)).then(res => {
174
- return buildResponse(res).then(_data => {
175
- return {
176
- contractInfoList: _data.contractInfoList
177
- };
178
- });
179
- });
180
- };
181
- this.searchContractInfoBatch = (args, headers) => {
182
- return this.fetch(this.url('SearchContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
183
- return buildResponse(res).then(_data => {
184
- return {
185
- contractInfoByChain: _data.contractInfoByChain
186
- };
187
- });
188
- });
189
- };
190
- this.searchMetadata = (args, headers) => {
191
- return this.fetch(this.url('SearchMetadata'), createHTTPRequest(args, headers)).then(res => {
192
- return buildResponse(res).then(_data => {
193
- return {
194
- tokenMetadata: _data.tokenMetadata,
195
- contractInfo: _data.contractInfo
196
- };
197
- });
198
- });
199
- };
200
- this.getNiftyswapTokenQuantity = (args, headers) => {
201
- return this.fetch(this.url('GetNiftyswapTokenQuantity'), createHTTPRequest(args, headers)).then(res => {
202
- return buildResponse(res).then(_data => {
203
- return {
204
- quantity: _data.quantity
205
- };
206
- });
207
- });
208
- };
209
- this.getNiftyswapUnitPrices = (args, headers) => {
210
- return this.fetch(this.url('GetNiftyswapUnitPrices'), createHTTPRequest(args, headers)).then(res => {
211
- return buildResponse(res).then(_data => {
212
- return {
213
- prices: _data.prices
214
- };
215
- });
216
- });
217
- };
218
- this.getNiftyswapUnitPricesWithQuantities = (args, headers) => {
219
- return this.fetch(this.url('GetNiftyswapUnitPricesWithQuantities'), createHTTPRequest(args, headers)).then(res => {
220
- return buildResponse(res).then(_data => {
221
- return {
222
- prices: _data.prices
223
- };
224
- });
225
- });
226
- };
227
- this.hostname = hostname;
228
- this.fetch = (input, init) => fetch(input, init);
229
- }
230
- url(name) {
231
- return this.hostname + this.path + name;
232
- }
233
- }
234
- const createHTTPRequest = (body = {}, headers = {}) => {
235
- return {
236
- method: 'POST',
237
- headers: _extends({}, headers, {
238
- 'Content-Type': 'application/json'
239
- }),
240
- body: JSON.stringify(body || {})
241
- };
242
- };
243
- const buildResponse = res => {
244
- return res.text().then(text => {
245
- let data;
246
- try {
247
- data = JSON.parse(text);
248
- } catch (err) {
249
- throw {
250
- code: 'unknown',
251
- msg: `expecting JSON, got: ${text}`,
252
- status: res.status
253
- };
254
- }
255
- if (!res.ok) {
256
- throw data; // webrpc error response
257
- }
258
-
259
- return data;
260
- });
261
- };
262
-
263
- const fetch = typeof global === 'object' ? global.fetch : window.fetch;
264
- class SequenceMetadataClient extends Metadata {
265
- constructor(hostname = 'https://metadata.sequence.app') {
266
- super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
267
- }
268
- }
269
-
270
- exports.ContractType = ContractType;
271
- exports.Metadata = Metadata;
272
- exports.PropertyType = PropertyType;
273
- exports.SequenceMetadataClient = SequenceMetadataClient;
274
- exports.SortOrder = SortOrder;
275
- exports.SwapType = SwapType;
276
- exports.WebRPCSchemaHash = WebRPCSchemaHash;
277
- exports.WebRPCSchemaVersion = WebRPCSchemaVersion;
278
- exports.WebRPCVersion = WebRPCVersion;
@@ -1,266 +0,0 @@
1
- function _extends() {
2
- _extends = Object.assign ? Object.assign.bind() : function (target) {
3
- for (var i = 1; i < arguments.length; i++) {
4
- var source = arguments[i];
5
- for (var key in source) {
6
- if (Object.prototype.hasOwnProperty.call(source, key)) {
7
- target[key] = source[key];
8
- }
9
- }
10
- }
11
- return target;
12
- };
13
- return _extends.apply(this, arguments);
14
- }
15
-
16
- /* eslint-disable */
17
- // sequence-metadata v0.4.0 5d87d77b951c5d197544d97d75241bf3d02679d9
18
- // --
19
- // Code generated by webrpc-gen@v0.10.x-dev with typescript generator. DO NOT EDIT.
20
- //
21
- // webrpc-gen -schema=metadata.ridl -target=typescript -client -out=./clients/metadata.gen.ts
22
-
23
- // WebRPC description and code-gen version
24
- const WebRPCVersion = "v1";
25
-
26
- // Schema version of your RIDL schema
27
- const WebRPCSchemaVersion = "v0.4.0";
28
-
29
- // Schema hash generated from your RIDL schema
30
- const WebRPCSchemaHash = "5d87d77b951c5d197544d97d75241bf3d02679d9";
31
-
32
- //
33
- // Types
34
- //
35
-
36
- let ContractType = /*#__PURE__*/function (ContractType) {
37
- ContractType["UNKNOWN"] = "UNKNOWN";
38
- ContractType["ERC20"] = "ERC20";
39
- ContractType["ERC721"] = "ERC721";
40
- ContractType["ERC1155"] = "ERC1155";
41
- return ContractType;
42
- }({});
43
- let PropertyType = /*#__PURE__*/function (PropertyType) {
44
- PropertyType["INT"] = "INT";
45
- PropertyType["STRING"] = "STRING";
46
- PropertyType["ARRAY"] = "ARRAY";
47
- PropertyType["GENERIC"] = "GENERIC";
48
- return PropertyType;
49
- }({});
50
- let SwapType = /*#__PURE__*/function (SwapType) {
51
- SwapType["UNKNOWN"] = "UNKNOWN";
52
- SwapType["BUY"] = "BUY";
53
- SwapType["SELL"] = "SELL";
54
- return SwapType;
55
- }({});
56
- let SortOrder = /*#__PURE__*/function (SortOrder) {
57
- SortOrder["DESC"] = "DESC";
58
- SortOrder["ASC"] = "ASC";
59
- return SortOrder;
60
- }({});
61
- //
62
- // Client
63
- //
64
- class Metadata {
65
- constructor(hostname, fetch) {
66
- this.path = '/rpc/Metadata/';
67
- this.ping = headers => {
68
- return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
69
- return buildResponse(res).then(_data => {
70
- return {
71
- status: _data.status
72
- };
73
- });
74
- });
75
- };
76
- this.version = headers => {
77
- return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
78
- return buildResponse(res).then(_data => {
79
- return {
80
- version: _data.version
81
- };
82
- });
83
- });
84
- };
85
- this.runtimeStatus = headers => {
86
- return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
87
- return buildResponse(res).then(_data => {
88
- return {
89
- status: _data.status
90
- };
91
- });
92
- });
93
- };
94
- this.getTokenMetadata = (args, headers) => {
95
- return this.fetch(this.url('GetTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
96
- return buildResponse(res).then(_data => {
97
- return {
98
- tokenMetadata: _data.tokenMetadata
99
- };
100
- });
101
- });
102
- };
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
- };
112
- this.getTokenMetadataBatch = (args, headers) => {
113
- return this.fetch(this.url('GetTokenMetadataBatch'), createHTTPRequest(args, headers)).then(res => {
114
- return buildResponse(res).then(_data => {
115
- return {
116
- contractTokenMetadata: _data.contractTokenMetadata
117
- };
118
- });
119
- });
120
- };
121
- this.searchTokenMetadata = (args, headers) => {
122
- return this.fetch(this.url('SearchTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
123
- return buildResponse(res).then(_data => {
124
- return {
125
- page: _data.page,
126
- tokenMetadata: _data.tokenMetadata
127
- };
128
- });
129
- });
130
- };
131
- this.searchTokenIDs = (args, headers) => {
132
- return this.fetch(this.url('SearchTokenIDs'), createHTTPRequest(args, headers)).then(res => {
133
- return buildResponse(res).then(_data => {
134
- return {
135
- page: _data.page,
136
- tokenIds: _data.tokenIds
137
- };
138
- });
139
- });
140
- };
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
- };
150
- this.getContractInfo = (args, headers) => {
151
- return this.fetch(this.url('GetContractInfo'), createHTTPRequest(args, headers)).then(res => {
152
- return buildResponse(res).then(_data => {
153
- return {
154
- contractInfo: _data.contractInfo
155
- };
156
- });
157
- });
158
- };
159
- this.getContractInfoBatch = (args, headers) => {
160
- return this.fetch(this.url('GetContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
161
- return buildResponse(res).then(_data => {
162
- return {
163
- contractInfoMap: _data.contractInfoMap
164
- };
165
- });
166
- });
167
- };
168
- this.searchContractInfo = (args, headers) => {
169
- return this.fetch(this.url('SearchContractInfo'), createHTTPRequest(args, headers)).then(res => {
170
- return buildResponse(res).then(_data => {
171
- return {
172
- contractInfoList: _data.contractInfoList
173
- };
174
- });
175
- });
176
- };
177
- this.searchContractInfoBatch = (args, headers) => {
178
- return this.fetch(this.url('SearchContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
179
- return buildResponse(res).then(_data => {
180
- return {
181
- contractInfoByChain: _data.contractInfoByChain
182
- };
183
- });
184
- });
185
- };
186
- this.searchMetadata = (args, headers) => {
187
- return this.fetch(this.url('SearchMetadata'), createHTTPRequest(args, headers)).then(res => {
188
- return buildResponse(res).then(_data => {
189
- return {
190
- tokenMetadata: _data.tokenMetadata,
191
- contractInfo: _data.contractInfo
192
- };
193
- });
194
- });
195
- };
196
- this.getNiftyswapTokenQuantity = (args, headers) => {
197
- return this.fetch(this.url('GetNiftyswapTokenQuantity'), createHTTPRequest(args, headers)).then(res => {
198
- return buildResponse(res).then(_data => {
199
- return {
200
- quantity: _data.quantity
201
- };
202
- });
203
- });
204
- };
205
- this.getNiftyswapUnitPrices = (args, headers) => {
206
- return this.fetch(this.url('GetNiftyswapUnitPrices'), createHTTPRequest(args, headers)).then(res => {
207
- return buildResponse(res).then(_data => {
208
- return {
209
- prices: _data.prices
210
- };
211
- });
212
- });
213
- };
214
- this.getNiftyswapUnitPricesWithQuantities = (args, headers) => {
215
- return this.fetch(this.url('GetNiftyswapUnitPricesWithQuantities'), createHTTPRequest(args, headers)).then(res => {
216
- return buildResponse(res).then(_data => {
217
- return {
218
- prices: _data.prices
219
- };
220
- });
221
- });
222
- };
223
- this.hostname = hostname;
224
- this.fetch = (input, init) => fetch(input, init);
225
- }
226
- url(name) {
227
- return this.hostname + this.path + name;
228
- }
229
- }
230
- const createHTTPRequest = (body = {}, headers = {}) => {
231
- return {
232
- method: 'POST',
233
- headers: _extends({}, headers, {
234
- 'Content-Type': 'application/json'
235
- }),
236
- body: JSON.stringify(body || {})
237
- };
238
- };
239
- const buildResponse = res => {
240
- return res.text().then(text => {
241
- let data;
242
- try {
243
- data = JSON.parse(text);
244
- } catch (err) {
245
- throw {
246
- code: 'unknown',
247
- msg: `expecting JSON, got: ${text}`,
248
- status: res.status
249
- };
250
- }
251
- if (!res.ok) {
252
- throw data; // webrpc error response
253
- }
254
-
255
- return data;
256
- });
257
- };
258
-
259
- const fetch = typeof global === 'object' ? global.fetch : window.fetch;
260
- class SequenceMetadataClient extends Metadata {
261
- constructor(hostname = 'https://metadata.sequence.app') {
262
- super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
263
- }
264
- }
265
-
266
- export { ContractType, Metadata, PropertyType, SequenceMetadataClient, SortOrder, SwapType, WebRPCSchemaHash, WebRPCSchemaVersion, WebRPCVersion };
@@ -1,5 +0,0 @@
1
- export * from './metadata.gen';
2
- import { Metadata as MetadataRpc } from './metadata.gen';
3
- export declare class SequenceMetadataClient extends MetadataRpc {
4
- constructor(hostname?: string);
5
- }
@@ -1,322 +0,0 @@
1
- export declare const WebRPCVersion = "v1";
2
- export declare const WebRPCSchemaVersion = "v0.4.0";
3
- export declare const WebRPCSchemaHash = "5d87d77b951c5d197544d97d75241bf3d02679d9";
4
- export declare enum ContractType {
5
- UNKNOWN = "UNKNOWN",
6
- ERC20 = "ERC20",
7
- ERC721 = "ERC721",
8
- ERC1155 = "ERC1155"
9
- }
10
- export declare enum PropertyType {
11
- INT = "INT",
12
- STRING = "STRING",
13
- ARRAY = "ARRAY",
14
- GENERIC = "GENERIC"
15
- }
16
- export declare enum SwapType {
17
- UNKNOWN = "UNKNOWN",
18
- BUY = "BUY",
19
- SELL = "SELL"
20
- }
21
- export declare enum SortOrder {
22
- DESC = "DESC",
23
- ASC = "ASC"
24
- }
25
- export interface Version {
26
- webrpcVersion: string;
27
- schemaVersion: string;
28
- schemaHash: string;
29
- appVersion: string;
30
- }
31
- export interface RuntimeStatus {
32
- healthOK: boolean;
33
- startTime: string;
34
- uptime: number;
35
- ver: string;
36
- branch: string;
37
- commitHash: string;
38
- checks: RuntimeChecks;
39
- }
40
- export interface RuntimeChecks {
41
- }
42
- export interface ContractIndex {
43
- chainId: number;
44
- address: string;
45
- type: ContractType;
46
- metadata: {
47
- [key: string]: any;
48
- };
49
- contentHash: number;
50
- deployed: boolean;
51
- bytecodeHash: string;
52
- notFound: boolean;
53
- }
54
- export interface TokenIndex {
55
- key: string;
56
- chainId: number;
57
- contractAddress: string;
58
- tokenId: string;
59
- metadata: {
60
- [key: string]: any;
61
- };
62
- notFound: boolean;
63
- }
64
- export interface ContractInfo {
65
- chainId: number;
66
- address: string;
67
- name: string;
68
- type: string;
69
- symbol: string;
70
- decimals?: number;
71
- logoURI: string;
72
- deployed: boolean;
73
- bytecodeHash: string;
74
- extensions: ContractInfoExtensions;
75
- }
76
- export interface ContractInfoExtensions {
77
- link: string;
78
- description: string;
79
- ogImage: string;
80
- originChainId: number;
81
- originAddress: string;
82
- blacklist: boolean;
83
- }
84
- export interface TokenMetadata {
85
- tokenId: string;
86
- contractAddress: string;
87
- name: string;
88
- description: string;
89
- image: string;
90
- decimals: number;
91
- properties: {
92
- [key: string]: any;
93
- };
94
- video: string;
95
- audio: string;
96
- image_data: string;
97
- external_url: string;
98
- background_color: string;
99
- animation_url: string;
100
- attributes: Array<{
101
- [key: string]: any;
102
- }>;
103
- }
104
- export interface PropertyFilter {
105
- name: string;
106
- type: PropertyType;
107
- min?: number;
108
- max?: number;
109
- values?: Array<any>;
110
- }
111
- export interface Filter {
112
- text?: string;
113
- properties?: Array<PropertyFilter>;
114
- }
115
- export interface GetNiftyswapUnitPricesRequest {
116
- swapType: SwapType;
117
- ids: Array<string>;
118
- amounts: Array<string>;
119
- }
120
- export interface GetNiftyswapUnitPricesResponse {
121
- unitPrice: string;
122
- unitAmount: string;
123
- availableAmount: string;
124
- }
125
- export interface Page {
126
- pageSize?: number;
127
- page?: number;
128
- }
129
- export interface SortBy {
130
- column: string;
131
- order: SortOrder;
132
- }
133
- export interface Metadata {
134
- ping(headers?: object): Promise<PingReturn>;
135
- version(headers?: object): Promise<VersionReturn>;
136
- runtimeStatus(headers?: object): Promise<RuntimeStatusReturn>;
137
- getTokenMetadata(args: GetTokenMetadataArgs, headers?: object): Promise<GetTokenMetadataReturn>;
138
- refreshTokenMetadata(args: RefreshTokenMetadataArgs, headers?: object): Promise<RefreshTokenMetadataReturn>;
139
- getTokenMetadataBatch(args: GetTokenMetadataBatchArgs, headers?: object): Promise<GetTokenMetadataBatchReturn>;
140
- searchTokenMetadata(args: SearchTokenMetadataArgs, headers?: object): Promise<SearchTokenMetadataReturn>;
141
- searchTokenIDs(args: SearchTokenIDsArgs, headers?: object): Promise<SearchTokenIDsReturn>;
142
- tokenCollectionFilters(args: TokenCollectionFiltersArgs, headers?: object): Promise<TokenCollectionFiltersReturn>;
143
- getContractInfo(args: GetContractInfoArgs, headers?: object): Promise<GetContractInfoReturn>;
144
- getContractInfoBatch(args: GetContractInfoBatchArgs, headers?: object): Promise<GetContractInfoBatchReturn>;
145
- searchContractInfo(args: SearchContractInfoArgs, headers?: object): Promise<SearchContractInfoReturn>;
146
- searchContractInfoBatch(args: SearchContractInfoBatchArgs, headers?: object): Promise<SearchContractInfoBatchReturn>;
147
- searchMetadata(args: SearchMetadataArgs, headers?: object): Promise<SearchMetadataReturn>;
148
- getNiftyswapTokenQuantity(args: GetNiftyswapTokenQuantityArgs, headers?: object): Promise<GetNiftyswapTokenQuantityReturn>;
149
- getNiftyswapUnitPrices(args: GetNiftyswapUnitPricesArgs, headers?: object): Promise<GetNiftyswapUnitPricesReturn>;
150
- getNiftyswapUnitPricesWithQuantities(args: GetNiftyswapUnitPricesWithQuantitiesArgs, headers?: object): Promise<GetNiftyswapUnitPricesWithQuantitiesReturn>;
151
- }
152
- export interface PingArgs {
153
- }
154
- export interface PingReturn {
155
- status: boolean;
156
- }
157
- export interface VersionArgs {
158
- }
159
- export interface VersionReturn {
160
- version: Version;
161
- }
162
- export interface RuntimeStatusArgs {
163
- }
164
- export interface RuntimeStatusReturn {
165
- status: RuntimeStatus;
166
- }
167
- export interface GetTokenMetadataArgs {
168
- chainID: string;
169
- contractAddress: string;
170
- tokenIDs: Array<string>;
171
- }
172
- export interface GetTokenMetadataReturn {
173
- tokenMetadata: Array<TokenMetadata>;
174
- }
175
- export interface RefreshTokenMetadataArgs {
176
- chainID: string;
177
- contractAddress: string;
178
- tokenIDs?: Array<string>;
179
- refreshAll?: boolean;
180
- }
181
- export interface RefreshTokenMetadataReturn {
182
- status: {
183
- [key: string]: boolean;
184
- };
185
- }
186
- export interface GetTokenMetadataBatchArgs {
187
- chainID: string;
188
- contractTokenMap: {
189
- [key: string]: Array<string>;
190
- };
191
- }
192
- export interface GetTokenMetadataBatchReturn {
193
- contractTokenMetadata: {
194
- [key: string]: Array<TokenMetadata>;
195
- };
196
- }
197
- export interface SearchTokenMetadataArgs {
198
- chainID: string;
199
- contractAddress: string;
200
- filter: Filter;
201
- page?: Page;
202
- }
203
- export interface SearchTokenMetadataReturn {
204
- page: Page;
205
- tokenMetadata: Array<TokenMetadata>;
206
- }
207
- export interface SearchTokenIDsArgs {
208
- chainID: string;
209
- contractAddress: string;
210
- filter: Filter;
211
- page?: Page;
212
- }
213
- export interface SearchTokenIDsReturn {
214
- page: Page;
215
- tokenIds: Array<string>;
216
- }
217
- export interface TokenCollectionFiltersArgs {
218
- chainID: string;
219
- contractAddress: string;
220
- }
221
- export interface TokenCollectionFiltersReturn {
222
- filters: Array<PropertyFilter>;
223
- }
224
- export interface GetContractInfoArgs {
225
- chainID: string;
226
- contractAddress: string;
227
- }
228
- export interface GetContractInfoReturn {
229
- contractInfo: ContractInfo;
230
- }
231
- export interface GetContractInfoBatchArgs {
232
- chainID: string;
233
- contractAddresses: Array<string>;
234
- }
235
- export interface GetContractInfoBatchReturn {
236
- contractInfoMap: {
237
- [key: string]: ContractInfo;
238
- };
239
- }
240
- export interface SearchContractInfoArgs {
241
- contractAddress: string;
242
- }
243
- export interface SearchContractInfoReturn {
244
- contractInfoList: Array<ContractInfo>;
245
- }
246
- export interface SearchContractInfoBatchArgs {
247
- contractAddresses: Array<string>;
248
- }
249
- export interface SearchContractInfoBatchReturn {
250
- contractInfoByChain: {
251
- [key: string]: Array<ContractInfo>;
252
- };
253
- }
254
- export interface SearchMetadataArgs {
255
- filter: string;
256
- }
257
- export interface SearchMetadataReturn {
258
- tokenMetadata: Array<TokenMetadata>;
259
- contractInfo: Array<ContractInfo>;
260
- }
261
- export interface GetNiftyswapTokenQuantityArgs {
262
- chainID: string;
263
- contractAddress: string;
264
- tokenIDs: Array<string>;
265
- }
266
- export interface GetNiftyswapTokenQuantityReturn {
267
- quantity: {
268
- [key: string]: string;
269
- };
270
- }
271
- export interface GetNiftyswapUnitPricesArgs {
272
- chainID: string;
273
- contractAddress: string;
274
- req: GetNiftyswapUnitPricesRequest;
275
- fresh: boolean;
276
- }
277
- export interface GetNiftyswapUnitPricesReturn {
278
- prices: {
279
- [key: string]: string;
280
- };
281
- }
282
- export interface GetNiftyswapUnitPricesWithQuantitiesArgs {
283
- chainID: string;
284
- contractAddress: string;
285
- req: GetNiftyswapUnitPricesRequest;
286
- fresh: boolean;
287
- }
288
- export interface GetNiftyswapUnitPricesWithQuantitiesReturn {
289
- prices: {
290
- [key: string]: GetNiftyswapUnitPricesResponse;
291
- };
292
- }
293
- export declare class Metadata implements Metadata {
294
- protected hostname: string;
295
- protected fetch: Fetch;
296
- protected path: string;
297
- constructor(hostname: string, fetch: Fetch);
298
- private url;
299
- ping: (headers?: object | undefined) => Promise<PingReturn>;
300
- version: (headers?: object | undefined) => Promise<VersionReturn>;
301
- runtimeStatus: (headers?: object | undefined) => Promise<RuntimeStatusReturn>;
302
- getTokenMetadata: (args: GetTokenMetadataArgs, headers?: object | undefined) => Promise<GetTokenMetadataReturn>;
303
- refreshTokenMetadata: (args: RefreshTokenMetadataArgs, headers?: object | undefined) => Promise<RefreshTokenMetadataReturn>;
304
- getTokenMetadataBatch: (args: GetTokenMetadataBatchArgs, headers?: object | undefined) => Promise<GetTokenMetadataBatchReturn>;
305
- searchTokenMetadata: (args: SearchTokenMetadataArgs, headers?: object | undefined) => Promise<SearchTokenMetadataReturn>;
306
- searchTokenIDs: (args: SearchTokenIDsArgs, headers?: object | undefined) => Promise<SearchTokenIDsReturn>;
307
- tokenCollectionFilters: (args: TokenCollectionFiltersArgs, headers?: object | undefined) => Promise<TokenCollectionFiltersReturn>;
308
- getContractInfo: (args: GetContractInfoArgs, headers?: object | undefined) => Promise<GetContractInfoReturn>;
309
- getContractInfoBatch: (args: GetContractInfoBatchArgs, headers?: object | undefined) => Promise<GetContractInfoBatchReturn>;
310
- searchContractInfo: (args: SearchContractInfoArgs, headers?: object | undefined) => Promise<SearchContractInfoReturn>;
311
- searchContractInfoBatch: (args: SearchContractInfoBatchArgs, headers?: object | undefined) => Promise<SearchContractInfoBatchReturn>;
312
- searchMetadata: (args: SearchMetadataArgs, headers?: object | undefined) => Promise<SearchMetadataReturn>;
313
- getNiftyswapTokenQuantity: (args: GetNiftyswapTokenQuantityArgs, headers?: object | undefined) => Promise<GetNiftyswapTokenQuantityReturn>;
314
- getNiftyswapUnitPrices: (args: GetNiftyswapUnitPricesArgs, headers?: object | undefined) => Promise<GetNiftyswapUnitPricesReturn>;
315
- getNiftyswapUnitPricesWithQuantities: (args: GetNiftyswapUnitPricesWithQuantitiesArgs, headers?: object | undefined) => Promise<GetNiftyswapUnitPricesWithQuantitiesReturn>;
316
- }
317
- export interface WebRPCError extends Error {
318
- code: string;
319
- msg: string;
320
- status: number;
321
- }
322
- export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>;