@0xsequence/api 0.0.0-2021827201516 → 0.0.0-20220427054350

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,294 +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-api v0.4.0 8e3575e965dc76a152d48e0b6660271db4d0c5be
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 = "8e3575e965dc76a152d48e0b6660271db4d0c5be"; //
32
- // Types
33
- //
34
-
35
- let SortOrder;
36
-
37
- (function (SortOrder) {
38
- SortOrder["DESC"] = "DESC";
39
- SortOrder["ASC"] = "ASC";
40
- })(SortOrder || (SortOrder = {}));
41
-
42
- //
43
- // Client
44
- //
45
- class API {
46
- constructor(hostname, fetch) {
47
- this.hostname = void 0;
48
- this.fetch = void 0;
49
- this.path = '/rpc/API/';
50
-
51
- this.ping = headers => {
52
- return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
53
- return buildResponse(res).then(_data => {
54
- return {
55
- status: _data.status
56
- };
57
- });
58
- });
59
- };
60
-
61
- this.version = headers => {
62
- return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
63
- return buildResponse(res).then(_data => {
64
- return {
65
- version: _data.version
66
- };
67
- });
68
- });
69
- };
70
-
71
- this.runtimeStatus = headers => {
72
- return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
73
- return buildResponse(res).then(_data => {
74
- return {
75
- status: _data.status
76
- };
77
- });
78
- });
79
- };
80
-
81
- this.getSequenceContext = headers => {
82
- return this.fetch(this.url('GetSequenceContext'), createHTTPRequest({}, headers)).then(res => {
83
- return buildResponse(res).then(_data => {
84
- return {
85
- data: _data.data
86
- };
87
- });
88
- });
89
- };
90
-
91
- this.getAuthToken = (args, headers) => {
92
- return this.fetch(this.url('GetAuthToken'), createHTTPRequest(args, headers)).then(res => {
93
- return buildResponse(res).then(_data => {
94
- return {
95
- status: _data.status,
96
- jwtToken: _data.jwtToken,
97
- address: _data.address,
98
- user: _data.user
99
- };
100
- });
101
- });
102
- };
103
-
104
- this.friendList = (args, headers) => {
105
- return this.fetch(this.url('FriendList'), createHTTPRequest(args, headers)).then(res => {
106
- return buildResponse(res).then(_data => {
107
- return {
108
- page: _data.page,
109
- friends: _data.friends
110
- };
111
- });
112
- });
113
- };
114
-
115
- this.getFriendByAddress = (args, headers) => {
116
- return this.fetch(this.url('GetFriendByAddress'), createHTTPRequest(args, headers)).then(res => {
117
- return buildResponse(res).then(_data => {
118
- return {
119
- status: _data.status,
120
- friend: _data.friend
121
- };
122
- });
123
- });
124
- };
125
-
126
- this.searchFriends = (args, headers) => {
127
- return this.fetch(this.url('SearchFriends'), createHTTPRequest(args, headers)).then(res => {
128
- return buildResponse(res).then(_data => {
129
- return {
130
- friends: _data.friends
131
- };
132
- });
133
- });
134
- };
135
-
136
- this.addFriend = (args, headers) => {
137
- return this.fetch(this.url('AddFriend'), createHTTPRequest(args, headers)).then(res => {
138
- return buildResponse(res).then(_data => {
139
- return {
140
- status: _data.status,
141
- friend: _data.friend
142
- };
143
- });
144
- });
145
- };
146
-
147
- this.updateFriendNickname = (args, headers) => {
148
- return this.fetch(this.url('UpdateFriendNickname'), createHTTPRequest(args, headers)).then(res => {
149
- return buildResponse(res).then(_data => {
150
- return {
151
- status: _data.status,
152
- friend: _data.friend
153
- };
154
- });
155
- });
156
- };
157
-
158
- this.removeFriend = (args, headers) => {
159
- return this.fetch(this.url('RemoveFriend'), createHTTPRequest(args, headers)).then(res => {
160
- return buildResponse(res).then(_data => {
161
- return {
162
- status: _data.status
163
- };
164
- });
165
- });
166
- };
167
-
168
- this.contractCall = (args, headers) => {
169
- return this.fetch(this.url('ContractCall'), createHTTPRequest(args, headers)).then(res => {
170
- return buildResponse(res).then(_data => {
171
- return {
172
- returns: _data.returns
173
- };
174
- });
175
- });
176
- };
177
-
178
- this.decodeContractCall = (args, headers) => {
179
- return this.fetch(this.url('DecodeContractCall'), createHTTPRequest(args, headers)).then(res => {
180
- return buildResponse(res).then(_data => {
181
- return {
182
- call: _data.call
183
- };
184
- });
185
- });
186
- };
187
-
188
- this.lookupContractCallSelectors = (args, headers) => {
189
- return this.fetch(this.url('LookupContractCallSelectors'), createHTTPRequest(args, headers)).then(res => {
190
- return buildResponse(res).then(_data => {
191
- return {
192
- signatures: _data.signatures
193
- };
194
- });
195
- });
196
- };
197
-
198
- this.getInviteInfo = headers => {
199
- return this.fetch(this.url('GetInviteInfo'), createHTTPRequest({}, headers)).then(res => {
200
- return buildResponse(res).then(_data => {
201
- return {
202
- inviteInfo: _data.inviteInfo
203
- };
204
- });
205
- });
206
- };
207
-
208
- this.internalClaimAccessCode = (args, headers) => {
209
- return this.fetch(this.url('InternalClaimAccessCode'), createHTTPRequest(args, headers)).then(res => {
210
- return buildResponse(res).then(_data => {
211
- return {
212
- status: _data.status
213
- };
214
- });
215
- });
216
- };
217
-
218
- this.walletRecover = (args, headers) => {
219
- return this.fetch(this.url('WalletRecover'), createHTTPRequest(args, headers)).then(res => {
220
- return buildResponse(res).then(_data => {
221
- return {
222
- encryptedWallet: _data.encryptedWallet
223
- };
224
- });
225
- });
226
- };
227
-
228
- this.hostname = hostname;
229
- this.fetch = fetch;
230
- }
231
-
232
- url(name) {
233
- return this.hostname + this.path + name;
234
- }
235
-
236
- }
237
-
238
- const createHTTPRequest = (body = {}, headers = {}) => {
239
- return {
240
- method: 'POST',
241
- headers: _extends({}, headers, {
242
- 'Content-Type': 'application/json'
243
- }),
244
- body: JSON.stringify(body || {})
245
- };
246
- };
247
-
248
- const buildResponse = res => {
249
- return res.text().then(text => {
250
- let data;
251
-
252
- try {
253
- data = JSON.parse(text);
254
- } catch (err) {
255
- throw {
256
- code: 'unknown',
257
- msg: `expecting JSON, got: ${text}`,
258
- status: res.status
259
- };
260
- }
261
-
262
- if (!res.ok) {
263
- throw data; // webrpc error response
264
- }
265
-
266
- return data;
267
- });
268
- };
269
-
270
- class SequenceAPIClient extends API {
271
- constructor(hostname, jwtAuth) {
272
- super(hostname, fetch);
273
- this.jwtAuth = jwtAuth;
274
-
275
- this._fetch = (input, init) => {
276
- // automatically include jwt auth header to requests
277
- // if its been set on the api client
278
- const headers = {};
279
-
280
- if (this.jwtAuth && this.jwtAuth.length > 0) {
281
- headers['Authorization'] = `BEARER ${this.jwtAuth}`;
282
- } // before the request is made
283
-
284
-
285
- init.headers = _extends({}, init.headers, headers);
286
- return fetch(input, init);
287
- };
288
-
289
- this.fetch = this._fetch;
290
- }
291
-
292
- }
293
-
294
- export { API, SequenceAPIClient, SortOrder, WebRPCSchemaHash, WebRPCSchemaVersion, WebRPCVersion };
@@ -1,270 +0,0 @@
1
- export declare const WebRPCVersion = "v1";
2
- export declare const WebRPCSchemaVersion = "v0.4.0";
3
- export declare const WebRPCSchemaHash = "8e3575e965dc76a152d48e0b6660271db4d0c5be";
4
- export declare enum SortOrder {
5
- DESC = "DESC",
6
- ASC = "ASC"
7
- }
8
- export interface Version {
9
- webrpcVersion: string;
10
- schemaVersion: string;
11
- schemaHash: string;
12
- appVersion: string;
13
- }
14
- export interface RuntimeStatus {
15
- healthOK: boolean;
16
- startTime: string;
17
- uptime: number;
18
- ver: string;
19
- branch: string;
20
- commitHash: string;
21
- checks: RuntimeChecks;
22
- }
23
- export interface RuntimeChecks {
24
- }
25
- export interface SequenceContext {
26
- factory: string;
27
- mainModule: string;
28
- mainModuleUpgradable: string;
29
- guestModule: string;
30
- utils: string;
31
- }
32
- export interface User {
33
- address: string;
34
- username: string;
35
- avatar: string;
36
- bio: string;
37
- location: string;
38
- locale: string;
39
- backup?: boolean;
40
- backupConfirmed?: boolean;
41
- maxInvites?: number;
42
- updatedAt?: string;
43
- createdAt?: string;
44
- }
45
- export interface WalletBackup {
46
- accountAddress: string;
47
- secretHash: string;
48
- encryptedWallet: string;
49
- userConfirmed: boolean;
50
- updatedAt?: string;
51
- createdAt?: string;
52
- }
53
- export interface Friend {
54
- id: number;
55
- userAddress: string;
56
- friendAddress: string;
57
- nickname: string;
58
- user?: User;
59
- createdAt?: string;
60
- }
61
- export interface InviteCode {
62
- usesLeft: number;
63
- ownerAccount: string;
64
- email?: string;
65
- url: string;
66
- createdAt?: string;
67
- expiresAt?: string;
68
- }
69
- export interface InviteCodeAccount {
70
- claimedByUserAddress: string;
71
- claimedAt?: string;
72
- }
73
- export interface InviteInfo {
74
- expiryInHours: number;
75
- max: number;
76
- invites: Array<InviteCode>;
77
- }
78
- export interface ContractCall {
79
- signature: string;
80
- function: string;
81
- args: Array<ContractCallArg>;
82
- }
83
- export interface ContractCallArg {
84
- name?: string;
85
- type: string;
86
- value: any;
87
- }
88
- export interface Transaction {
89
- delegateCall: boolean;
90
- revertOnError: boolean;
91
- gasLimit: string;
92
- target: string;
93
- value: string;
94
- data: string;
95
- call?: ContractCall;
96
- }
97
- export interface Page {
98
- pageSize?: number;
99
- page?: number;
100
- totalRecords?: number;
101
- column?: string;
102
- before?: any;
103
- after?: any;
104
- sort?: Array<SortBy>;
105
- }
106
- export interface SortBy {
107
- column: string;
108
- order: SortOrder;
109
- }
110
- export interface API {
111
- ping(headers?: object): Promise<PingReturn>;
112
- version(headers?: object): Promise<VersionReturn>;
113
- runtimeStatus(headers?: object): Promise<RuntimeStatusReturn>;
114
- getSequenceContext(headers?: object): Promise<GetSequenceContextReturn>;
115
- getAuthToken(args: GetAuthTokenArgs, headers?: object): Promise<GetAuthTokenReturn>;
116
- friendList(args: FriendListArgs, headers?: object): Promise<FriendListReturn>;
117
- getFriendByAddress(args: GetFriendByAddressArgs, headers?: object): Promise<GetFriendByAddressReturn>;
118
- searchFriends(args: SearchFriendsArgs, headers?: object): Promise<SearchFriendsReturn>;
119
- addFriend(args: AddFriendArgs, headers?: object): Promise<AddFriendReturn>;
120
- updateFriendNickname(args: UpdateFriendNicknameArgs, headers?: object): Promise<UpdateFriendNicknameReturn>;
121
- removeFriend(args: RemoveFriendArgs, headers?: object): Promise<RemoveFriendReturn>;
122
- contractCall(args: ContractCallArgs, headers?: object): Promise<ContractCallReturn>;
123
- decodeContractCall(args: DecodeContractCallArgs, headers?: object): Promise<DecodeContractCallReturn>;
124
- lookupContractCallSelectors(args: LookupContractCallSelectorsArgs, headers?: object): Promise<LookupContractCallSelectorsReturn>;
125
- getInviteInfo(headers?: object): Promise<GetInviteInfoReturn>;
126
- internalClaimAccessCode(args: InternalClaimAccessCodeArgs, headers?: object): Promise<InternalClaimAccessCodeReturn>;
127
- walletRecover(args: WalletRecoverArgs, headers?: object): Promise<WalletRecoverReturn>;
128
- }
129
- export interface PingArgs {
130
- }
131
- export interface PingReturn {
132
- status: boolean;
133
- }
134
- export interface VersionArgs {
135
- }
136
- export interface VersionReturn {
137
- version: Version;
138
- }
139
- export interface RuntimeStatusArgs {
140
- }
141
- export interface RuntimeStatusReturn {
142
- status: RuntimeStatus;
143
- }
144
- export interface GetSequenceContextArgs {
145
- }
146
- export interface GetSequenceContextReturn {
147
- data: SequenceContext;
148
- }
149
- export interface GetAuthTokenArgs {
150
- ewtString: string;
151
- }
152
- export interface GetAuthTokenReturn {
153
- status: boolean;
154
- jwtToken: string;
155
- address: string;
156
- user?: User;
157
- }
158
- export interface FriendListArgs {
159
- page?: Page;
160
- }
161
- export interface FriendListReturn {
162
- page: Page;
163
- friends: Array<Friend>;
164
- }
165
- export interface GetFriendByAddressArgs {
166
- friendAddress: string;
167
- }
168
- export interface GetFriendByAddressReturn {
169
- status: boolean;
170
- friend: Friend;
171
- }
172
- export interface SearchFriendsArgs {
173
- filterUsername: string;
174
- }
175
- export interface SearchFriendsReturn {
176
- friends: Array<Friend>;
177
- }
178
- export interface AddFriendArgs {
179
- friendAddress: string;
180
- optionalNickname?: string;
181
- }
182
- export interface AddFriendReturn {
183
- status: boolean;
184
- friend?: Friend;
185
- }
186
- export interface UpdateFriendNicknameArgs {
187
- friendAddress: string;
188
- nickname: string;
189
- }
190
- export interface UpdateFriendNicknameReturn {
191
- status: boolean;
192
- friend?: Friend;
193
- }
194
- export interface RemoveFriendArgs {
195
- friendAddress: string;
196
- }
197
- export interface RemoveFriendReturn {
198
- status: boolean;
199
- }
200
- export interface ContractCallArgs {
201
- chainID: string;
202
- contract: string;
203
- inputExpr: string;
204
- outputExpr: string;
205
- args: Array<string>;
206
- }
207
- export interface ContractCallReturn {
208
- returns: Array<string>;
209
- }
210
- export interface DecodeContractCallArgs {
211
- callData: string;
212
- }
213
- export interface DecodeContractCallReturn {
214
- call: ContractCall;
215
- }
216
- export interface LookupContractCallSelectorsArgs {
217
- selectors: Array<string>;
218
- }
219
- export interface LookupContractCallSelectorsReturn {
220
- signatures: Array<Array<string>>;
221
- }
222
- export interface GetInviteInfoArgs {
223
- }
224
- export interface GetInviteInfoReturn {
225
- inviteInfo: InviteInfo;
226
- }
227
- export interface InternalClaimAccessCodeArgs {
228
- address: string;
229
- accessCode: string;
230
- }
231
- export interface InternalClaimAccessCodeReturn {
232
- status: boolean;
233
- }
234
- export interface WalletRecoverArgs {
235
- username: string;
236
- secretHash: string;
237
- }
238
- export interface WalletRecoverReturn {
239
- encryptedWallet: string;
240
- }
241
- export declare class API implements API {
242
- protected hostname: string;
243
- protected fetch: Fetch;
244
- protected path: string;
245
- constructor(hostname: string, fetch: Fetch);
246
- private url;
247
- ping: (headers?: object | undefined) => Promise<PingReturn>;
248
- version: (headers?: object | undefined) => Promise<VersionReturn>;
249
- runtimeStatus: (headers?: object | undefined) => Promise<RuntimeStatusReturn>;
250
- getSequenceContext: (headers?: object | undefined) => Promise<GetSequenceContextReturn>;
251
- getAuthToken: (args: GetAuthTokenArgs, headers?: object | undefined) => Promise<GetAuthTokenReturn>;
252
- friendList: (args: FriendListArgs, headers?: object | undefined) => Promise<FriendListReturn>;
253
- getFriendByAddress: (args: GetFriendByAddressArgs, headers?: object | undefined) => Promise<GetFriendByAddressReturn>;
254
- searchFriends: (args: SearchFriendsArgs, headers?: object | undefined) => Promise<SearchFriendsReturn>;
255
- addFriend: (args: AddFriendArgs, headers?: object | undefined) => Promise<AddFriendReturn>;
256
- updateFriendNickname: (args: UpdateFriendNicknameArgs, headers?: object | undefined) => Promise<UpdateFriendNicknameReturn>;
257
- removeFriend: (args: RemoveFriendArgs, headers?: object | undefined) => Promise<RemoveFriendReturn>;
258
- contractCall: (args: ContractCallArgs, headers?: object | undefined) => Promise<ContractCallReturn>;
259
- decodeContractCall: (args: DecodeContractCallArgs, headers?: object | undefined) => Promise<DecodeContractCallReturn>;
260
- lookupContractCallSelectors: (args: LookupContractCallSelectorsArgs, headers?: object | undefined) => Promise<LookupContractCallSelectorsReturn>;
261
- getInviteInfo: (headers?: object | undefined) => Promise<GetInviteInfoReturn>;
262
- internalClaimAccessCode: (args: InternalClaimAccessCodeArgs, headers?: object | undefined) => Promise<InternalClaimAccessCodeReturn>;
263
- walletRecover: (args: WalletRecoverArgs, headers?: object | undefined) => Promise<WalletRecoverReturn>;
264
- }
265
- export interface WebRPCError extends Error {
266
- code: string;
267
- msg: string;
268
- status: number;
269
- }
270
- export declare type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>;
@@ -1,7 +0,0 @@
1
- export * from './api.gen';
2
- import { API as BaseSequenceAPI } from './api.gen';
3
- export declare class SequenceAPIClient extends BaseSequenceAPI {
4
- jwtAuth?: string | undefined;
5
- constructor(hostname: string, jwtAuth?: string | undefined);
6
- _fetch: (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
7
- }