@0xsequence/metadata 0.0.0-2021827201516 → 0.0.0-20220412184039

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,212 @@
1
1
  # @0xsequence/metadata
2
2
 
3
- ## 0.0.0-2021827201516
3
+ ## 0.0.0-20220412184039
4
+
5
+ ### Patch Changes
6
+
7
+ - update metadata proto
8
+
9
+ ## 0.36.9
10
+
11
+ ### Patch Changes
12
+
13
+ - minor dev xp improvements
14
+
15
+ ## 0.36.8
16
+
17
+ ### Patch Changes
18
+
19
+ - more connect options (theme, payment providers, funding currencies)
20
+
21
+ ## 0.36.7
22
+
23
+ ### Patch Changes
24
+
25
+ - fix missing break
26
+
27
+ ## 0.36.6
28
+
29
+ ### Patch Changes
30
+
31
+ - wallet_switchEthereumChain support
32
+
33
+ ## 0.36.5
34
+
35
+ ### Patch Changes
36
+
37
+ - auth: bump ethauth to 0.7.0
38
+ network, wallet: don't assume position of auth network in list
39
+ api/indexer/metadata: trim trailing slash on hostname, and add endpoint urls
40
+ relayer: Allow to specify local relayer transaction parameters like gas price or gas limit
41
+
42
+ ## 0.36.4
43
+
44
+ ### Patch Changes
45
+
46
+ - Updating list of chain ids to include other ethereum compatible chains
47
+
48
+ ## 0.36.3
49
+
50
+ ### Patch Changes
51
+
52
+ - provider: pass connect options to prompter methods
53
+
54
+ ## 0.36.2
55
+
56
+ ### Patch Changes
57
+
58
+ - transactions: Setting target to 0x0 when empty to during SequenceTxAbiEncode
59
+
60
+ ## 0.36.1
61
+
62
+ ### Patch Changes
63
+
64
+ - metadata: update client with more fields
65
+
66
+ ## 0.36.0
67
+
68
+ ### Minor Changes
69
+
70
+ - relayer, wallet: fee quote support
71
+
72
+ ## 0.35.12
73
+
74
+ ### Patch Changes
75
+
76
+ - provider: rename wallet.commands to wallet.utils
77
+
78
+ ## 0.35.11
79
+
80
+ ### Patch Changes
81
+
82
+ - provider/utils: smoother message validation
83
+
84
+ ## 0.35.10
85
+
86
+ ### Patch Changes
87
+
88
+ - upgrade deps
89
+
90
+ ## 0.35.9
91
+
92
+ ### Patch Changes
93
+
94
+ - provider: window-transport override event handlers with new wallet instance
95
+
96
+ ## 0.35.8
97
+
98
+ ### Patch Changes
99
+
100
+ - provider: async wallet sign in improvements
101
+
102
+ ## 0.35.7
103
+
104
+ ### Patch Changes
105
+
106
+ - config: cache wallet configs
107
+
108
+ ## 0.35.6
109
+
110
+ ### Patch Changes
111
+
112
+ - provider: support async signin of wallet request handler
113
+
114
+ ## 0.35.5
115
+
116
+ ### Patch Changes
117
+
118
+ - wallet: skip threshold check during fee estimation
119
+
120
+ ## 0.35.4
121
+
122
+ ### Patch Changes
123
+
124
+ - - browser extension mode, center window
125
+
126
+ ## 0.35.3
127
+
128
+ ### Patch Changes
129
+
130
+ - - update window position when in browser extension mode
131
+
132
+ ## 0.35.2
133
+
134
+ ### Patch Changes
135
+
136
+ - - provider: WindowMessageHandler accept optional windowHref
137
+
138
+ ## 0.35.1
139
+
140
+ ### Patch Changes
141
+
142
+ - wallet: update config on undeployed too
143
+
144
+ ## 0.35.0
145
+
4
146
  ### Minor Changes
5
147
 
6
- - next release
148
+ - - config: add buildStubSignature
149
+ - provider: add checks to signing cases for wallet deployment and config statuses
150
+ - provider: add prompt for wallet deployment
151
+ - relayer: add BaseRelayer.prependWalletDeploy
152
+ - relayer: add Relayer.feeOptions
153
+ - relayer: account for wallet deployment in fee estimation
154
+ - transactions: add fromTransactionish
155
+ - wallet: add Account.prependConfigUpdate
156
+ - wallet: add Account.getFeeOptions
157
+
158
+ ## 0.34.0
159
+
160
+ ### Minor Changes
161
+
162
+ - - upgrade deps
163
+
164
+ ## 0.31.3
165
+
166
+ ### Patch Changes
167
+
168
+ - update metadata bindings
169
+
170
+ ## 0.31.0
171
+
172
+ ### Minor Changes
173
+
174
+ - - upgrading to ethers v5.5
175
+
176
+ ## 0.30.0
177
+
178
+ ### Minor Changes
179
+
180
+ - - upgrade most deps
181
+
182
+ ## 0.29.8
183
+
184
+ ### Patch Changes
185
+
186
+ - update api
187
+
188
+ ## 0.29.1
189
+
190
+ ### Patch Changes
191
+
192
+ - metadata: ContractInfo.decimals is now optional, i.e. may be undefined
193
+
194
+ api: new APIs for user storage and isUsingGoogleMail
195
+
196
+ ## 0.29.0
197
+
198
+ ### Minor Changes
199
+
200
+ - major architectural changes in Sequence design
201
+
202
+ - only one API instance, API is no longer a per-chain service
203
+ - separate per-chain indexer service, API no longer handles indexing
204
+ - single contract metadata service, API no longer serves metadata
205
+
206
+ chaind package has been removed, indexer and metadata packages have been added
207
+
208
+ stronger typing with new explicit ChainId type
209
+
210
+ multicall fixes and improvements
211
+
212
+ forbid "wait" transactions in sendTransactionBatch calls
@@ -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/@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-2021827201516",
3
+ "version": "0.0.0-20220412184039",
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",
@@ -13,7 +13,7 @@
13
13
  "typecheck": "tsc --noEmit"
14
14
  },
15
15
  "dependencies": {
16
- "cross-fetch": "^3.1.4"
16
+ "cross-fetch": "^3.1.5"
17
17
  },
18
18
  "peerDependencies": {},
19
19
  "devDependencies": {},
package/src/index.ts CHANGED
@@ -5,7 +5,7 @@ import fetch from 'cross-fetch'
5
5
  import { Metadata as BaseSequenceMetadata } from './metadata.gen'
6
6
 
7
7
  export class SequenceMetadataClient extends BaseSequenceMetadata {
8
- constructor(hostname: string) {
9
- super(hostname, fetch)
8
+ constructor(hostname: string = 'https://metadata.sequence.app') {
9
+ super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch)
10
10
  }
11
11
  }
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable */
2
- // sequence-metadata v0.4.0 f1264bc1871ed85b966466b348374ace021d3723
2
+ // sequence-metadata v0.4.0 376fc6f21f770a4d0457a039d13b6aca6d174e3f
3
3
  // --
4
4
  // This file has been generated by https://github.com/webrpc/webrpc using gen/typescript
5
5
  // Do not edit by hand. Update your webrpc schema and re-generate.
@@ -11,18 +11,32 @@ export const WebRPCVersion = "v1"
11
11
  export const WebRPCSchemaVersion = "v0.4.0"
12
12
 
13
13
  // Schema hash generated from your RIDL schema
14
- export const WebRPCSchemaHash = "f1264bc1871ed85b966466b348374ace021d3723"
14
+ export const WebRPCSchemaHash = "376fc6f21f770a4d0457a039d13b6aca6d174e3f"
15
15
 
16
16
 
17
17
  //
18
18
  // Types
19
19
  //
20
+ export enum ContractType {
21
+ ERC20 = 'ERC20',
22
+ ContractURI = 'ContractURI',
23
+ OpenSea = 'OpenSea',
24
+ ERC1155 = 'ERC1155',
25
+ ERC721 = 'ERC721',
26
+ UNKNOWN = 'UNKNOWN'
27
+ }
28
+
20
29
  export enum SwapType {
21
30
  UNKNOWN = 'UNKNOWN',
22
31
  BUY = 'BUY',
23
32
  SELL = 'SELL'
24
33
  }
25
34
 
35
+ export enum SortOrder {
36
+ DESC = 'DESC',
37
+ ASC = 'ASC'
38
+ }
39
+
26
40
  export interface Version {
27
41
  webrpcVersion: string
28
42
  schemaVersion: string
@@ -43,13 +57,20 @@ export interface RuntimeStatus {
43
57
  export interface RuntimeChecks {
44
58
  }
45
59
 
60
+ export interface ContractIndex {
61
+ chainId: string
62
+ address: string
63
+ type: ContractType
64
+ metadata: {[key: string]: any}
65
+ }
66
+
46
67
  export interface ContractInfo {
47
68
  chainId: number
48
69
  address: string
49
70
  name: string
50
71
  type: string
51
72
  symbol: string
52
- decimals: number
73
+ decimals?: number
53
74
  logoURI: string
54
75
  extensions: ContractInfoExtensions
55
76
  }
@@ -60,6 +81,15 @@ export interface ContractInfoExtensions {
60
81
  ogImage: string
61
82
  originChainId: number
62
83
  originAddress: string
84
+ blacklist: boolean
85
+ }
86
+
87
+ export interface TokenIndex {
88
+ chainId: string
89
+ contractAddress: string
90
+ tokenId: string
91
+ metadata: {[key: string]: any}
92
+
63
93
  }
64
94
 
65
95
  export interface TokenMetadata {
@@ -70,9 +100,12 @@ export interface TokenMetadata {
70
100
  image: string
71
101
  decimals: number
72
102
  properties: {[key: string]: any}
103
+ video: string
104
+ audio: string
73
105
  image_data: string
74
106
  external_url: string
75
107
  background_color: string
108
+ animation_url: string
76
109
  attributes: Array<{[key: string]: any}>
77
110
  }
78
111
 
@@ -82,12 +115,24 @@ export interface GetNiftyswapUnitPricesRequest {
82
115
  amounts: Array<string>
83
116
  }
84
117
 
118
+ export interface Page {
119
+ pageSize?: number
120
+ page?: number
121
+ }
122
+
123
+ export interface SortBy {
124
+ column: string
125
+ order: SortOrder
126
+ }
127
+
85
128
  export interface Metadata {
86
129
  ping(headers?: object): Promise<PingReturn>
87
130
  version(headers?: object): Promise<VersionReturn>
88
131
  runtimeStatus(headers?: object): Promise<RuntimeStatusReturn>
89
132
  getTokenMetadata(args: GetTokenMetadataArgs, headers?: object): Promise<GetTokenMetadataReturn>
90
133
  getTokenMetadataBatch(args: GetTokenMetadataBatchArgs, headers?: object): Promise<GetTokenMetadataBatchReturn>
134
+ searchTokenMetadata(args: SearchTokenMetadataArgs, headers?: object): Promise<SearchTokenMetadataReturn>
135
+ searchTokenIDs(args: SearchTokenIDsArgs, headers?: object): Promise<SearchTokenIDsReturn>
91
136
  getContractInfo(args: GetContractInfoArgs, headers?: object): Promise<GetContractInfoReturn>
92
137
  getContractInfoBatch(args: GetContractInfoBatchArgs, headers?: object): Promise<GetContractInfoBatchReturn>
93
138
  searchContractInfo(args: SearchContractInfoArgs, headers?: object): Promise<SearchContractInfoReturn>
@@ -131,6 +176,28 @@ export interface GetTokenMetadataBatchArgs {
131
176
  export interface GetTokenMetadataBatchReturn {
132
177
  contractTokenMetadata: {[key: string]: Array<TokenMetadata>}
133
178
  }
179
+ export interface SearchTokenMetadataArgs {
180
+ chainID: string
181
+ contractAddress: string
182
+ filter: string
183
+ page?: Page
184
+ }
185
+
186
+ export interface SearchTokenMetadataReturn {
187
+ page: Page
188
+ tokenMetadata: Array<TokenMetadata>
189
+ }
190
+ export interface SearchTokenIDsArgs {
191
+ chainID: string
192
+ contractAddress: string
193
+ filter: string
194
+ page?: Page
195
+ }
196
+
197
+ export interface SearchTokenIDsReturn {
198
+ page: Page
199
+ tokenIds: Array<string>
200
+ }
134
201
  export interface GetContractInfoArgs {
135
202
  chainID: string
136
203
  contractAddress: string
@@ -262,6 +329,32 @@ export class Metadata implements Metadata {
262
329
  })
263
330
  }
264
331
 
332
+ searchTokenMetadata = (args: SearchTokenMetadataArgs, headers?: object): Promise<SearchTokenMetadataReturn> => {
333
+ return this.fetch(
334
+ this.url('SearchTokenMetadata'),
335
+ createHTTPRequest(args, headers)).then((res) => {
336
+ return buildResponse(res).then(_data => {
337
+ return {
338
+ page: <Page>(_data.page),
339
+ tokenMetadata: <Array<TokenMetadata>>(_data.tokenMetadata)
340
+ }
341
+ })
342
+ })
343
+ }
344
+
345
+ searchTokenIDs = (args: SearchTokenIDsArgs, headers?: object): Promise<SearchTokenIDsReturn> => {
346
+ return this.fetch(
347
+ this.url('SearchTokenIDs'),
348
+ createHTTPRequest(args, headers)).then((res) => {
349
+ return buildResponse(res).then(_data => {
350
+ return {
351
+ page: <Page>(_data.page),
352
+ tokenIds: <Array<string>>(_data.tokenIds)
353
+ }
354
+ })
355
+ })
356
+ }
357
+
265
358
  getContractInfo = (args: GetContractInfoArgs, headers?: object): Promise<GetContractInfoReturn> => {
266
359
  return this.fetch(
267
360
  this.url('GetContractInfo'),
@@ -366,4 +459,4 @@ const buildResponse = (res: Response): Promise<any> => {
366
459
  })
367
460
  }
368
461
 
369
- export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>
462
+ export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>
@@ -1,223 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
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
- function _extends() {
12
- _extends = Object.assign || function (target) {
13
- for (var i = 1; i < arguments.length; i++) {
14
- var source = arguments[i];
15
-
16
- for (var key in source) {
17
- if (Object.prototype.hasOwnProperty.call(source, key)) {
18
- target[key] = source[key];
19
- }
20
- }
21
- }
22
-
23
- return target;
24
- };
25
-
26
- return _extends.apply(this, arguments);
27
- }
28
-
29
- /* eslint-disable */
30
- // sequence-metadata v0.4.0 f1264bc1871ed85b966466b348374ace021d3723
31
- // --
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.
34
- // WebRPC description and code-gen version
35
- const WebRPCVersion = "v1"; // Schema version of your RIDL schema
36
-
37
- const WebRPCSchemaVersion = "v0.4.0"; // Schema hash generated from your RIDL schema
38
-
39
- const WebRPCSchemaHash = "f1264bc1871ed85b966466b348374ace021d3723"; //
40
- // Types
41
- //
42
-
43
- exports.SwapType = void 0;
44
-
45
- (function (SwapType) {
46
- SwapType["UNKNOWN"] = "UNKNOWN";
47
- SwapType["BUY"] = "BUY";
48
- SwapType["SELL"] = "SELL";
49
- })(exports.SwapType || (exports.SwapType = {}));
50
-
51
- //
52
- // Client
53
- //
54
- class Metadata {
55
- constructor(hostname, fetch) {
56
- this.hostname = void 0;
57
- this.fetch = void 0;
58
- this.path = '/rpc/Metadata/';
59
-
60
- this.ping = headers => {
61
- return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
62
- return buildResponse(res).then(_data => {
63
- return {
64
- status: _data.status
65
- };
66
- });
67
- });
68
- };
69
-
70
- this.version = headers => {
71
- return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
72
- return buildResponse(res).then(_data => {
73
- return {
74
- version: _data.version
75
- };
76
- });
77
- });
78
- };
79
-
80
- this.runtimeStatus = headers => {
81
- return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
82
- return buildResponse(res).then(_data => {
83
- return {
84
- status: _data.status
85
- };
86
- });
87
- });
88
- };
89
-
90
- this.getTokenMetadata = (args, headers) => {
91
- return this.fetch(this.url('GetTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
92
- return buildResponse(res).then(_data => {
93
- return {
94
- tokenMetadata: _data.tokenMetadata
95
- };
96
- });
97
- });
98
- };
99
-
100
- this.getTokenMetadataBatch = (args, headers) => {
101
- return this.fetch(this.url('GetTokenMetadataBatch'), createHTTPRequest(args, headers)).then(res => {
102
- return buildResponse(res).then(_data => {
103
- return {
104
- contractTokenMetadata: _data.contractTokenMetadata
105
- };
106
- });
107
- });
108
- };
109
-
110
- this.getContractInfo = (args, headers) => {
111
- return this.fetch(this.url('GetContractInfo'), createHTTPRequest(args, headers)).then(res => {
112
- return buildResponse(res).then(_data => {
113
- return {
114
- contractInfo: _data.contractInfo
115
- };
116
- });
117
- });
118
- };
119
-
120
- this.getContractInfoBatch = (args, headers) => {
121
- return this.fetch(this.url('GetContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
122
- return buildResponse(res).then(_data => {
123
- return {
124
- contractInfoMap: _data.contractInfoMap
125
- };
126
- });
127
- });
128
- };
129
-
130
- this.searchContractInfo = (args, headers) => {
131
- return this.fetch(this.url('SearchContractInfo'), createHTTPRequest(args, headers)).then(res => {
132
- return buildResponse(res).then(_data => {
133
- return {
134
- contractInfoList: _data.contractInfoList
135
- };
136
- });
137
- });
138
- };
139
-
140
- this.searchContractInfoBatch = (args, headers) => {
141
- return this.fetch(this.url('SearchContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
142
- return buildResponse(res).then(_data => {
143
- return {
144
- contractInfoByChain: _data.contractInfoByChain
145
- };
146
- });
147
- });
148
- };
149
-
150
- this.getNiftyswapTokenQuantity = (args, headers) => {
151
- return this.fetch(this.url('GetNiftyswapTokenQuantity'), createHTTPRequest(args, headers)).then(res => {
152
- return buildResponse(res).then(_data => {
153
- return {
154
- quantity: _data.quantity
155
- };
156
- });
157
- });
158
- };
159
-
160
- this.getNiftyswapUnitPrices = (args, headers) => {
161
- return this.fetch(this.url('GetNiftyswapUnitPrices'), createHTTPRequest(args, headers)).then(res => {
162
- return buildResponse(res).then(_data => {
163
- return {
164
- prices: _data.prices
165
- };
166
- });
167
- });
168
- };
169
-
170
- this.hostname = hostname;
171
- this.fetch = fetch;
172
- }
173
-
174
- url(name) {
175
- return this.hostname + this.path + name;
176
- }
177
-
178
- }
179
-
180
- const createHTTPRequest = (body = {}, headers = {}) => {
181
- return {
182
- method: 'POST',
183
- headers: _extends({}, headers, {
184
- 'Content-Type': 'application/json'
185
- }),
186
- body: JSON.stringify(body || {})
187
- };
188
- };
189
-
190
- const buildResponse = res => {
191
- return res.text().then(text => {
192
- let data;
193
-
194
- try {
195
- data = JSON.parse(text);
196
- } catch (err) {
197
- throw {
198
- code: 'unknown',
199
- msg: `expecting JSON, got: ${text}`,
200
- status: res.status
201
- };
202
- }
203
-
204
- if (!res.ok) {
205
- throw data; // webrpc error response
206
- }
207
-
208
- return data;
209
- });
210
- };
211
-
212
- class SequenceMetadataClient extends Metadata {
213
- constructor(hostname) {
214
- super(hostname, fetch__default['default']);
215
- }
216
-
217
- }
218
-
219
- exports.Metadata = Metadata;
220
- exports.SequenceMetadataClient = SequenceMetadataClient;
221
- exports.WebRPCSchemaHash = WebRPCSchemaHash;
222
- exports.WebRPCSchemaVersion = WebRPCSchemaVersion;
223
- exports.WebRPCVersion = WebRPCVersion;
@@ -1,223 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
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
- function _extends() {
12
- _extends = Object.assign || function (target) {
13
- for (var i = 1; i < arguments.length; i++) {
14
- var source = arguments[i];
15
-
16
- for (var key in source) {
17
- if (Object.prototype.hasOwnProperty.call(source, key)) {
18
- target[key] = source[key];
19
- }
20
- }
21
- }
22
-
23
- return target;
24
- };
25
-
26
- return _extends.apply(this, arguments);
27
- }
28
-
29
- /* eslint-disable */
30
- // sequence-metadata v0.4.0 f1264bc1871ed85b966466b348374ace021d3723
31
- // --
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.
34
- // WebRPC description and code-gen version
35
- const WebRPCVersion = "v1"; // Schema version of your RIDL schema
36
-
37
- const WebRPCSchemaVersion = "v0.4.0"; // Schema hash generated from your RIDL schema
38
-
39
- const WebRPCSchemaHash = "f1264bc1871ed85b966466b348374ace021d3723"; //
40
- // Types
41
- //
42
-
43
- exports.SwapType = void 0;
44
-
45
- (function (SwapType) {
46
- SwapType["UNKNOWN"] = "UNKNOWN";
47
- SwapType["BUY"] = "BUY";
48
- SwapType["SELL"] = "SELL";
49
- })(exports.SwapType || (exports.SwapType = {}));
50
-
51
- //
52
- // Client
53
- //
54
- class Metadata {
55
- constructor(hostname, fetch) {
56
- this.hostname = void 0;
57
- this.fetch = void 0;
58
- this.path = '/rpc/Metadata/';
59
-
60
- this.ping = headers => {
61
- return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
62
- return buildResponse(res).then(_data => {
63
- return {
64
- status: _data.status
65
- };
66
- });
67
- });
68
- };
69
-
70
- this.version = headers => {
71
- return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
72
- return buildResponse(res).then(_data => {
73
- return {
74
- version: _data.version
75
- };
76
- });
77
- });
78
- };
79
-
80
- this.runtimeStatus = headers => {
81
- return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
82
- return buildResponse(res).then(_data => {
83
- return {
84
- status: _data.status
85
- };
86
- });
87
- });
88
- };
89
-
90
- this.getTokenMetadata = (args, headers) => {
91
- return this.fetch(this.url('GetTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
92
- return buildResponse(res).then(_data => {
93
- return {
94
- tokenMetadata: _data.tokenMetadata
95
- };
96
- });
97
- });
98
- };
99
-
100
- this.getTokenMetadataBatch = (args, headers) => {
101
- return this.fetch(this.url('GetTokenMetadataBatch'), createHTTPRequest(args, headers)).then(res => {
102
- return buildResponse(res).then(_data => {
103
- return {
104
- contractTokenMetadata: _data.contractTokenMetadata
105
- };
106
- });
107
- });
108
- };
109
-
110
- this.getContractInfo = (args, headers) => {
111
- return this.fetch(this.url('GetContractInfo'), createHTTPRequest(args, headers)).then(res => {
112
- return buildResponse(res).then(_data => {
113
- return {
114
- contractInfo: _data.contractInfo
115
- };
116
- });
117
- });
118
- };
119
-
120
- this.getContractInfoBatch = (args, headers) => {
121
- return this.fetch(this.url('GetContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
122
- return buildResponse(res).then(_data => {
123
- return {
124
- contractInfoMap: _data.contractInfoMap
125
- };
126
- });
127
- });
128
- };
129
-
130
- this.searchContractInfo = (args, headers) => {
131
- return this.fetch(this.url('SearchContractInfo'), createHTTPRequest(args, headers)).then(res => {
132
- return buildResponse(res).then(_data => {
133
- return {
134
- contractInfoList: _data.contractInfoList
135
- };
136
- });
137
- });
138
- };
139
-
140
- this.searchContractInfoBatch = (args, headers) => {
141
- return this.fetch(this.url('SearchContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
142
- return buildResponse(res).then(_data => {
143
- return {
144
- contractInfoByChain: _data.contractInfoByChain
145
- };
146
- });
147
- });
148
- };
149
-
150
- this.getNiftyswapTokenQuantity = (args, headers) => {
151
- return this.fetch(this.url('GetNiftyswapTokenQuantity'), createHTTPRequest(args, headers)).then(res => {
152
- return buildResponse(res).then(_data => {
153
- return {
154
- quantity: _data.quantity
155
- };
156
- });
157
- });
158
- };
159
-
160
- this.getNiftyswapUnitPrices = (args, headers) => {
161
- return this.fetch(this.url('GetNiftyswapUnitPrices'), createHTTPRequest(args, headers)).then(res => {
162
- return buildResponse(res).then(_data => {
163
- return {
164
- prices: _data.prices
165
- };
166
- });
167
- });
168
- };
169
-
170
- this.hostname = hostname;
171
- this.fetch = fetch;
172
- }
173
-
174
- url(name) {
175
- return this.hostname + this.path + name;
176
- }
177
-
178
- }
179
-
180
- const createHTTPRequest = (body = {}, headers = {}) => {
181
- return {
182
- method: 'POST',
183
- headers: _extends({}, headers, {
184
- 'Content-Type': 'application/json'
185
- }),
186
- body: JSON.stringify(body || {})
187
- };
188
- };
189
-
190
- const buildResponse = res => {
191
- return res.text().then(text => {
192
- let data;
193
-
194
- try {
195
- data = JSON.parse(text);
196
- } catch (err) {
197
- throw {
198
- code: 'unknown',
199
- msg: `expecting JSON, got: ${text}`,
200
- status: res.status
201
- };
202
- }
203
-
204
- if (!res.ok) {
205
- throw data; // webrpc error response
206
- }
207
-
208
- return data;
209
- });
210
- };
211
-
212
- class SequenceMetadataClient extends Metadata {
213
- constructor(hostname) {
214
- super(hostname, fetch__default['default']);
215
- }
216
-
217
- }
218
-
219
- exports.Metadata = Metadata;
220
- exports.SequenceMetadataClient = SequenceMetadataClient;
221
- exports.WebRPCSchemaHash = WebRPCSchemaHash;
222
- exports.WebRPCSchemaVersion = WebRPCSchemaVersion;
223
- exports.WebRPCVersion = WebRPCVersion;
@@ -1,211 +0,0 @@
1
- import fetch from 'cross-fetch';
2
-
3
- function _extends() {
4
- _extends = Object.assign || function (target) {
5
- for (var i = 1; i < arguments.length; i++) {
6
- var source = arguments[i];
7
-
8
- for (var key in source) {
9
- if (Object.prototype.hasOwnProperty.call(source, key)) {
10
- target[key] = source[key];
11
- }
12
- }
13
- }
14
-
15
- return target;
16
- };
17
-
18
- return _extends.apply(this, arguments);
19
- }
20
-
21
- /* eslint-disable */
22
- // sequence-metadata v0.4.0 f1264bc1871ed85b966466b348374ace021d3723
23
- // --
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.
26
- // WebRPC description and code-gen version
27
- const WebRPCVersion = "v1"; // Schema version of your RIDL schema
28
-
29
- const WebRPCSchemaVersion = "v0.4.0"; // Schema hash generated from your RIDL schema
30
-
31
- const WebRPCSchemaHash = "f1264bc1871ed85b966466b348374ace021d3723"; //
32
- // Types
33
- //
34
-
35
- let SwapType;
36
-
37
- (function (SwapType) {
38
- SwapType["UNKNOWN"] = "UNKNOWN";
39
- SwapType["BUY"] = "BUY";
40
- SwapType["SELL"] = "SELL";
41
- })(SwapType || (SwapType = {}));
42
-
43
- //
44
- // Client
45
- //
46
- class Metadata {
47
- constructor(hostname, fetch) {
48
- this.hostname = void 0;
49
- this.fetch = void 0;
50
- this.path = '/rpc/Metadata/';
51
-
52
- this.ping = headers => {
53
- return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
54
- return buildResponse(res).then(_data => {
55
- return {
56
- status: _data.status
57
- };
58
- });
59
- });
60
- };
61
-
62
- this.version = headers => {
63
- return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
64
- return buildResponse(res).then(_data => {
65
- return {
66
- version: _data.version
67
- };
68
- });
69
- });
70
- };
71
-
72
- this.runtimeStatus = headers => {
73
- return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
74
- return buildResponse(res).then(_data => {
75
- return {
76
- status: _data.status
77
- };
78
- });
79
- });
80
- };
81
-
82
- this.getTokenMetadata = (args, headers) => {
83
- return this.fetch(this.url('GetTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
84
- return buildResponse(res).then(_data => {
85
- return {
86
- tokenMetadata: _data.tokenMetadata
87
- };
88
- });
89
- });
90
- };
91
-
92
- this.getTokenMetadataBatch = (args, headers) => {
93
- return this.fetch(this.url('GetTokenMetadataBatch'), createHTTPRequest(args, headers)).then(res => {
94
- return buildResponse(res).then(_data => {
95
- return {
96
- contractTokenMetadata: _data.contractTokenMetadata
97
- };
98
- });
99
- });
100
- };
101
-
102
- this.getContractInfo = (args, headers) => {
103
- return this.fetch(this.url('GetContractInfo'), createHTTPRequest(args, headers)).then(res => {
104
- return buildResponse(res).then(_data => {
105
- return {
106
- contractInfo: _data.contractInfo
107
- };
108
- });
109
- });
110
- };
111
-
112
- this.getContractInfoBatch = (args, headers) => {
113
- return this.fetch(this.url('GetContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
114
- return buildResponse(res).then(_data => {
115
- return {
116
- contractInfoMap: _data.contractInfoMap
117
- };
118
- });
119
- });
120
- };
121
-
122
- this.searchContractInfo = (args, headers) => {
123
- return this.fetch(this.url('SearchContractInfo'), createHTTPRequest(args, headers)).then(res => {
124
- return buildResponse(res).then(_data => {
125
- return {
126
- contractInfoList: _data.contractInfoList
127
- };
128
- });
129
- });
130
- };
131
-
132
- this.searchContractInfoBatch = (args, headers) => {
133
- return this.fetch(this.url('SearchContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
134
- return buildResponse(res).then(_data => {
135
- return {
136
- contractInfoByChain: _data.contractInfoByChain
137
- };
138
- });
139
- });
140
- };
141
-
142
- this.getNiftyswapTokenQuantity = (args, headers) => {
143
- return this.fetch(this.url('GetNiftyswapTokenQuantity'), createHTTPRequest(args, headers)).then(res => {
144
- return buildResponse(res).then(_data => {
145
- return {
146
- quantity: _data.quantity
147
- };
148
- });
149
- });
150
- };
151
-
152
- this.getNiftyswapUnitPrices = (args, headers) => {
153
- return this.fetch(this.url('GetNiftyswapUnitPrices'), createHTTPRequest(args, headers)).then(res => {
154
- return buildResponse(res).then(_data => {
155
- return {
156
- prices: _data.prices
157
- };
158
- });
159
- });
160
- };
161
-
162
- this.hostname = hostname;
163
- this.fetch = fetch;
164
- }
165
-
166
- url(name) {
167
- return this.hostname + this.path + name;
168
- }
169
-
170
- }
171
-
172
- const createHTTPRequest = (body = {}, headers = {}) => {
173
- return {
174
- method: 'POST',
175
- headers: _extends({}, headers, {
176
- 'Content-Type': 'application/json'
177
- }),
178
- body: JSON.stringify(body || {})
179
- };
180
- };
181
-
182
- const buildResponse = res => {
183
- return res.text().then(text => {
184
- let data;
185
-
186
- try {
187
- data = JSON.parse(text);
188
- } catch (err) {
189
- throw {
190
- code: 'unknown',
191
- msg: `expecting JSON, got: ${text}`,
192
- status: res.status
193
- };
194
- }
195
-
196
- if (!res.ok) {
197
- throw data; // webrpc error response
198
- }
199
-
200
- return data;
201
- });
202
- };
203
-
204
- class SequenceMetadataClient extends Metadata {
205
- constructor(hostname) {
206
- super(hostname, fetch);
207
- }
208
-
209
- }
210
-
211
- export { Metadata, SequenceMetadataClient, SwapType, WebRPCSchemaHash, WebRPCSchemaVersion, WebRPCVersion };
@@ -1,5 +0,0 @@
1
- export * from './metadata.gen';
2
- import { Metadata as BaseSequenceMetadata } from './metadata.gen';
3
- export declare class SequenceMetadataClient extends BaseSequenceMetadata {
4
- constructor(hostname: string);
5
- }
@@ -1,185 +0,0 @@
1
- export declare const WebRPCVersion = "v1";
2
- export declare const WebRPCSchemaVersion = "v0.4.0";
3
- export declare const WebRPCSchemaHash = "f1264bc1871ed85b966466b348374ace021d3723";
4
- export declare enum SwapType {
5
- UNKNOWN = "UNKNOWN",
6
- BUY = "BUY",
7
- SELL = "SELL"
8
- }
9
- export interface Version {
10
- webrpcVersion: string;
11
- schemaVersion: string;
12
- schemaHash: string;
13
- appVersion: string;
14
- }
15
- export interface RuntimeStatus {
16
- healthOK: boolean;
17
- startTime: string;
18
- uptime: number;
19
- ver: string;
20
- branch: string;
21
- commitHash: string;
22
- checks: RuntimeChecks;
23
- }
24
- export interface RuntimeChecks {
25
- }
26
- export interface ContractInfo {
27
- chainId: number;
28
- address: string;
29
- name: string;
30
- type: string;
31
- symbol: string;
32
- decimals: number;
33
- logoURI: string;
34
- extensions: ContractInfoExtensions;
35
- }
36
- export interface ContractInfoExtensions {
37
- link: string;
38
- description: string;
39
- ogImage: string;
40
- originChainId: number;
41
- originAddress: string;
42
- }
43
- export interface TokenMetadata {
44
- tokenId: string;
45
- contractAddress: string;
46
- name: string;
47
- description: string;
48
- image: string;
49
- decimals: number;
50
- properties: {
51
- [key: string]: any;
52
- };
53
- image_data: string;
54
- external_url: string;
55
- background_color: string;
56
- attributes: Array<{
57
- [key: string]: any;
58
- }>;
59
- }
60
- export interface GetNiftyswapUnitPricesRequest {
61
- swapType: SwapType;
62
- ids: Array<string>;
63
- amounts: Array<string>;
64
- }
65
- export interface Metadata {
66
- ping(headers?: object): Promise<PingReturn>;
67
- version(headers?: object): Promise<VersionReturn>;
68
- runtimeStatus(headers?: object): Promise<RuntimeStatusReturn>;
69
- getTokenMetadata(args: GetTokenMetadataArgs, headers?: object): Promise<GetTokenMetadataReturn>;
70
- getTokenMetadataBatch(args: GetTokenMetadataBatchArgs, headers?: object): Promise<GetTokenMetadataBatchReturn>;
71
- getContractInfo(args: GetContractInfoArgs, headers?: object): Promise<GetContractInfoReturn>;
72
- getContractInfoBatch(args: GetContractInfoBatchArgs, headers?: object): Promise<GetContractInfoBatchReturn>;
73
- searchContractInfo(args: SearchContractInfoArgs, headers?: object): Promise<SearchContractInfoReturn>;
74
- searchContractInfoBatch(args: SearchContractInfoBatchArgs, headers?: object): Promise<SearchContractInfoBatchReturn>;
75
- getNiftyswapTokenQuantity(args: GetNiftyswapTokenQuantityArgs, headers?: object): Promise<GetNiftyswapTokenQuantityReturn>;
76
- getNiftyswapUnitPrices(args: GetNiftyswapUnitPricesArgs, headers?: object): Promise<GetNiftyswapUnitPricesReturn>;
77
- }
78
- export interface PingArgs {
79
- }
80
- export interface PingReturn {
81
- status: boolean;
82
- }
83
- export interface VersionArgs {
84
- }
85
- export interface VersionReturn {
86
- version: Version;
87
- }
88
- export interface RuntimeStatusArgs {
89
- }
90
- export interface RuntimeStatusReturn {
91
- status: RuntimeStatus;
92
- }
93
- export interface GetTokenMetadataArgs {
94
- chainID: string;
95
- contractAddress: string;
96
- tokenIDs: Array<string>;
97
- }
98
- export interface GetTokenMetadataReturn {
99
- tokenMetadata: Array<TokenMetadata>;
100
- }
101
- export interface GetTokenMetadataBatchArgs {
102
- chainID: string;
103
- contractTokenMap: {
104
- [key: string]: Array<string>;
105
- };
106
- }
107
- export interface GetTokenMetadataBatchReturn {
108
- contractTokenMetadata: {
109
- [key: string]: Array<TokenMetadata>;
110
- };
111
- }
112
- export interface GetContractInfoArgs {
113
- chainID: string;
114
- contractAddress: string;
115
- }
116
- export interface GetContractInfoReturn {
117
- contractInfo: ContractInfo;
118
- }
119
- export interface GetContractInfoBatchArgs {
120
- chainID: string;
121
- contractAddresses: Array<string>;
122
- }
123
- export interface GetContractInfoBatchReturn {
124
- contractInfoMap: {
125
- [key: string]: ContractInfo;
126
- };
127
- }
128
- export interface SearchContractInfoArgs {
129
- contractAddress: string;
130
- }
131
- export interface SearchContractInfoReturn {
132
- contractInfoList: Array<ContractInfo>;
133
- }
134
- export interface SearchContractInfoBatchArgs {
135
- contractAddresses: Array<string>;
136
- }
137
- export interface SearchContractInfoBatchReturn {
138
- contractInfoByChain: {
139
- [key: string]: Array<ContractInfo>;
140
- };
141
- }
142
- export interface GetNiftyswapTokenQuantityArgs {
143
- chainID: string;
144
- contractAddress: string;
145
- tokenIDs: Array<string>;
146
- }
147
- export interface GetNiftyswapTokenQuantityReturn {
148
- quantity: {
149
- [key: string]: string;
150
- };
151
- }
152
- export interface GetNiftyswapUnitPricesArgs {
153
- chainID: string;
154
- contractAddress: string;
155
- req: GetNiftyswapUnitPricesRequest;
156
- }
157
- export interface GetNiftyswapUnitPricesReturn {
158
- prices: {
159
- [key: string]: string;
160
- };
161
- }
162
- export declare class Metadata implements Metadata {
163
- protected hostname: string;
164
- protected fetch: Fetch;
165
- protected path: string;
166
- constructor(hostname: string, fetch: Fetch);
167
- private url;
168
- ping: (headers?: object | undefined) => Promise<PingReturn>;
169
- version: (headers?: object | undefined) => Promise<VersionReturn>;
170
- runtimeStatus: (headers?: object | undefined) => Promise<RuntimeStatusReturn>;
171
- getTokenMetadata: (args: GetTokenMetadataArgs, headers?: object | undefined) => Promise<GetTokenMetadataReturn>;
172
- getTokenMetadataBatch: (args: GetTokenMetadataBatchArgs, headers?: object | undefined) => Promise<GetTokenMetadataBatchReturn>;
173
- getContractInfo: (args: GetContractInfoArgs, headers?: object | undefined) => Promise<GetContractInfoReturn>;
174
- getContractInfoBatch: (args: GetContractInfoBatchArgs, headers?: object | undefined) => Promise<GetContractInfoBatchReturn>;
175
- searchContractInfo: (args: SearchContractInfoArgs, headers?: object | undefined) => Promise<SearchContractInfoReturn>;
176
- searchContractInfoBatch: (args: SearchContractInfoBatchArgs, headers?: object | undefined) => Promise<SearchContractInfoBatchReturn>;
177
- getNiftyswapTokenQuantity: (args: GetNiftyswapTokenQuantityArgs, headers?: object | undefined) => Promise<GetNiftyswapTokenQuantityReturn>;
178
- getNiftyswapUnitPrices: (args: GetNiftyswapUnitPricesArgs, headers?: object | undefined) => Promise<GetNiftyswapUnitPricesReturn>;
179
- }
180
- export interface WebRPCError extends Error {
181
- code: string;
182
- msg: string;
183
- status: number;
184
- }
185
- export declare type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>;