@0xsequence/api 0.0.0-202182516517 → 0.0.0-20220418165517
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/dist/0xsequence-api.cjs.d.ts +1 -11
- package/dist/0xsequence-api.cjs.dev.js +386 -0
- package/dist/0xsequence-api.cjs.js +6 -15
- package/dist/0xsequence-api.cjs.prod.js +386 -0
- package/dist/0xsequence-api.esm.js +374 -0
- package/dist/declarations/src/api.gen.d.ts +345 -0
- package/dist/declarations/src/index.d.ts +7 -0
- package/package.json +2 -2
- package/src/api.gen.ts +172 -2
- package/src/index.ts +1 -1
- package/CHANGELOG.md +0 -362
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
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
|
+
export * from "./declarations/src/index";
|
|
@@ -0,0 +1,386 @@
|
|
|
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-api v0.4.0 db6421c0a8d94ad6eafa79249ba7692c55059b39
|
|
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 = "db6421c0a8d94ad6eafa79249ba7692c55059b39"; //
|
|
40
|
+
// Types
|
|
41
|
+
//
|
|
42
|
+
|
|
43
|
+
exports.SortOrder = void 0;
|
|
44
|
+
|
|
45
|
+
(function (SortOrder) {
|
|
46
|
+
SortOrder["DESC"] = "DESC";
|
|
47
|
+
SortOrder["ASC"] = "ASC";
|
|
48
|
+
})(exports.SortOrder || (exports.SortOrder = {}));
|
|
49
|
+
|
|
50
|
+
//
|
|
51
|
+
// Client
|
|
52
|
+
//
|
|
53
|
+
class API {
|
|
54
|
+
constructor(hostname, fetch) {
|
|
55
|
+
this.hostname = void 0;
|
|
56
|
+
this.fetch = void 0;
|
|
57
|
+
this.path = '/rpc/API/';
|
|
58
|
+
|
|
59
|
+
this.ping = headers => {
|
|
60
|
+
return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
|
|
61
|
+
return buildResponse(res).then(_data => {
|
|
62
|
+
return {
|
|
63
|
+
status: _data.status
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
this.version = headers => {
|
|
70
|
+
return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
|
|
71
|
+
return buildResponse(res).then(_data => {
|
|
72
|
+
return {
|
|
73
|
+
version: _data.version
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
this.runtimeStatus = headers => {
|
|
80
|
+
return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
|
|
81
|
+
return buildResponse(res).then(_data => {
|
|
82
|
+
return {
|
|
83
|
+
status: _data.status
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
this.getSequenceContext = headers => {
|
|
90
|
+
return this.fetch(this.url('GetSequenceContext'), createHTTPRequest({}, headers)).then(res => {
|
|
91
|
+
return buildResponse(res).then(_data => {
|
|
92
|
+
return {
|
|
93
|
+
data: _data.data
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
this.getAuthToken = (args, headers) => {
|
|
100
|
+
return this.fetch(this.url('GetAuthToken'), createHTTPRequest(args, headers)).then(res => {
|
|
101
|
+
return buildResponse(res).then(_data => {
|
|
102
|
+
return {
|
|
103
|
+
status: _data.status,
|
|
104
|
+
jwtToken: _data.jwtToken,
|
|
105
|
+
address: _data.address,
|
|
106
|
+
user: _data.user
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
this.sendPasswordlessLink = (args, headers) => {
|
|
113
|
+
return this.fetch(this.url('SendPasswordlessLink'), createHTTPRequest(args, headers)).then(res => {
|
|
114
|
+
return buildResponse(res).then(_data => {
|
|
115
|
+
return {
|
|
116
|
+
status: _data.status
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
this.friendList = (args, headers) => {
|
|
123
|
+
return this.fetch(this.url('FriendList'), createHTTPRequest(args, headers)).then(res => {
|
|
124
|
+
return buildResponse(res).then(_data => {
|
|
125
|
+
return {
|
|
126
|
+
page: _data.page,
|
|
127
|
+
friends: _data.friends
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
this.getFriendByAddress = (args, headers) => {
|
|
134
|
+
return this.fetch(this.url('GetFriendByAddress'), createHTTPRequest(args, headers)).then(res => {
|
|
135
|
+
return buildResponse(res).then(_data => {
|
|
136
|
+
return {
|
|
137
|
+
status: _data.status,
|
|
138
|
+
friend: _data.friend
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
this.searchFriends = (args, headers) => {
|
|
145
|
+
return this.fetch(this.url('SearchFriends'), createHTTPRequest(args, headers)).then(res => {
|
|
146
|
+
return buildResponse(res).then(_data => {
|
|
147
|
+
return {
|
|
148
|
+
friends: _data.friends
|
|
149
|
+
};
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
this.addFriend = (args, headers) => {
|
|
155
|
+
return this.fetch(this.url('AddFriend'), createHTTPRequest(args, headers)).then(res => {
|
|
156
|
+
return buildResponse(res).then(_data => {
|
|
157
|
+
return {
|
|
158
|
+
status: _data.status,
|
|
159
|
+
friend: _data.friend
|
|
160
|
+
};
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
this.updateFriendNickname = (args, headers) => {
|
|
166
|
+
return this.fetch(this.url('UpdateFriendNickname'), createHTTPRequest(args, headers)).then(res => {
|
|
167
|
+
return buildResponse(res).then(_data => {
|
|
168
|
+
return {
|
|
169
|
+
status: _data.status,
|
|
170
|
+
friend: _data.friend
|
|
171
|
+
};
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
this.removeFriend = (args, headers) => {
|
|
177
|
+
return this.fetch(this.url('RemoveFriend'), createHTTPRequest(args, headers)).then(res => {
|
|
178
|
+
return buildResponse(res).then(_data => {
|
|
179
|
+
return {
|
|
180
|
+
status: _data.status
|
|
181
|
+
};
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
this.contractCall = (args, headers) => {
|
|
187
|
+
return this.fetch(this.url('ContractCall'), createHTTPRequest(args, headers)).then(res => {
|
|
188
|
+
return buildResponse(res).then(_data => {
|
|
189
|
+
return {
|
|
190
|
+
returns: _data.returns
|
|
191
|
+
};
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
this.decodeContractCall = (args, headers) => {
|
|
197
|
+
return this.fetch(this.url('DecodeContractCall'), createHTTPRequest(args, headers)).then(res => {
|
|
198
|
+
return buildResponse(res).then(_data => {
|
|
199
|
+
return {
|
|
200
|
+
call: _data.call
|
|
201
|
+
};
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
this.lookupContractCallSelectors = (args, headers) => {
|
|
207
|
+
return this.fetch(this.url('LookupContractCallSelectors'), createHTTPRequest(args, headers)).then(res => {
|
|
208
|
+
return buildResponse(res).then(_data => {
|
|
209
|
+
return {
|
|
210
|
+
signatures: _data.signatures
|
|
211
|
+
};
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
this.userStorageFetch = (args, headers) => {
|
|
217
|
+
return this.fetch(this.url('UserStorageFetch'), createHTTPRequest(args, headers)).then(res => {
|
|
218
|
+
return buildResponse(res).then(_data => {
|
|
219
|
+
return {
|
|
220
|
+
object: _data.object
|
|
221
|
+
};
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
this.userStorageSave = (args, headers) => {
|
|
227
|
+
return this.fetch(this.url('UserStorageSave'), createHTTPRequest(args, headers)).then(res => {
|
|
228
|
+
return buildResponse(res).then(_data => {
|
|
229
|
+
return {
|
|
230
|
+
ok: _data.ok
|
|
231
|
+
};
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
this.userStorageDelete = (args, headers) => {
|
|
237
|
+
return this.fetch(this.url('UserStorageDelete'), createHTTPRequest(args, headers)).then(res => {
|
|
238
|
+
return buildResponse(res).then(_data => {
|
|
239
|
+
return {
|
|
240
|
+
ok: _data.ok
|
|
241
|
+
};
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
this.userStorageFetchAll = (args, headers) => {
|
|
247
|
+
return this.fetch(this.url('UserStorageFetchAll'), createHTTPRequest(args, headers)).then(res => {
|
|
248
|
+
return buildResponse(res).then(_data => {
|
|
249
|
+
return {
|
|
250
|
+
objects: _data.objects
|
|
251
|
+
};
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
this.getMoonpayLink = (args, headers) => {
|
|
257
|
+
return this.fetch(this.url('GetMoonpayLink'), createHTTPRequest(args, headers)).then(res => {
|
|
258
|
+
return buildResponse(res).then(_data => {
|
|
259
|
+
return {
|
|
260
|
+
signedUrl: _data.signedUrl
|
|
261
|
+
};
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
this.isUsingGoogleMail = (args, headers) => {
|
|
267
|
+
return this.fetch(this.url('IsUsingGoogleMail'), createHTTPRequest(args, headers)).then(res => {
|
|
268
|
+
return buildResponse(res).then(_data => {
|
|
269
|
+
return {
|
|
270
|
+
yes: _data.yes
|
|
271
|
+
};
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
this.getInviteInfo = headers => {
|
|
277
|
+
return this.fetch(this.url('GetInviteInfo'), createHTTPRequest({}, headers)).then(res => {
|
|
278
|
+
return buildResponse(res).then(_data => {
|
|
279
|
+
return {
|
|
280
|
+
inviteInfo: _data.inviteInfo
|
|
281
|
+
};
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
this.isValidAccessCode = (args, headers) => {
|
|
287
|
+
return this.fetch(this.url('IsValidAccessCode'), createHTTPRequest(args, headers)).then(res => {
|
|
288
|
+
return buildResponse(res).then(_data => {
|
|
289
|
+
return {
|
|
290
|
+
status: _data.status
|
|
291
|
+
};
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
this.internalClaimAccessCode = (args, headers) => {
|
|
297
|
+
return this.fetch(this.url('InternalClaimAccessCode'), createHTTPRequest(args, headers)).then(res => {
|
|
298
|
+
return buildResponse(res).then(_data => {
|
|
299
|
+
return {
|
|
300
|
+
status: _data.status
|
|
301
|
+
};
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
this.walletRecover = (args, headers) => {
|
|
307
|
+
return this.fetch(this.url('WalletRecover'), createHTTPRequest(args, headers)).then(res => {
|
|
308
|
+
return buildResponse(res).then(_data => {
|
|
309
|
+
return {
|
|
310
|
+
encryptedWallet: _data.encryptedWallet
|
|
311
|
+
};
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
this.hostname = hostname;
|
|
317
|
+
this.fetch = fetch;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
url(name) {
|
|
321
|
+
return this.hostname + this.path + name;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
const createHTTPRequest = (body = {}, headers = {}) => {
|
|
327
|
+
return {
|
|
328
|
+
method: 'POST',
|
|
329
|
+
headers: _extends({}, headers, {
|
|
330
|
+
'Content-Type': 'application/json'
|
|
331
|
+
}),
|
|
332
|
+
body: JSON.stringify(body || {})
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
const buildResponse = res => {
|
|
337
|
+
return res.text().then(text => {
|
|
338
|
+
let data;
|
|
339
|
+
|
|
340
|
+
try {
|
|
341
|
+
data = JSON.parse(text);
|
|
342
|
+
} catch (err) {
|
|
343
|
+
throw {
|
|
344
|
+
code: 'unknown',
|
|
345
|
+
msg: `expecting JSON, got: ${text}`,
|
|
346
|
+
status: res.status
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
if (!res.ok) {
|
|
351
|
+
throw data; // webrpc error response
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
return data;
|
|
355
|
+
});
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
class SequenceAPIClient extends API {
|
|
359
|
+
constructor(hostname, jwtAuth) {
|
|
360
|
+
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch__default["default"]);
|
|
361
|
+
this.jwtAuth = jwtAuth;
|
|
362
|
+
|
|
363
|
+
this._fetch = (input, init) => {
|
|
364
|
+
// automatically include jwt auth header to requests
|
|
365
|
+
// if its been set on the api client
|
|
366
|
+
const headers = {};
|
|
367
|
+
|
|
368
|
+
if (this.jwtAuth && this.jwtAuth.length > 0) {
|
|
369
|
+
headers['Authorization'] = `BEARER ${this.jwtAuth}`;
|
|
370
|
+
} // before the request is made
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
init.headers = _extends({}, init.headers, headers);
|
|
374
|
+
return fetch__default["default"](input, init);
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
this.fetch = this._fetch;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
exports.API = API;
|
|
383
|
+
exports.SequenceAPIClient = SequenceAPIClient;
|
|
384
|
+
exports.WebRPCSchemaHash = WebRPCSchemaHash;
|
|
385
|
+
exports.WebRPCSchemaVersion = WebRPCSchemaVersion;
|
|
386
|
+
exports.WebRPCVersion = WebRPCVersion;
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
|
|
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
|
|
1
|
+
'use strict';
|
|
9
2
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
unregister();
|
|
3
|
+
if (process.env.NODE_ENV === "production") {
|
|
4
|
+
module.exports = require("./0xsequence-api.cjs.prod.js");
|
|
5
|
+
} else {
|
|
6
|
+
module.exports = require("./0xsequence-api.cjs.dev.js");
|
|
7
|
+
}
|