-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathuseConsumerHostServices.tsx
More file actions
933 lines (839 loc) · 24.6 KB
/
useConsumerHostServices.tsx
File metadata and controls
933 lines (839 loc) · 24.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
// Copyright 2020-2022 SubQuery Pte Ltd authors & contributors
// SPDX-License-Identifier: Apache-2.0
import React, { useCallback } from 'react';
import { useEffect, useRef, useState } from 'react';
import { useAccount } from '@containers/Web3';
import { Modal, openNotification, Typography } from '@subql/components';
import { ProjectType } from '@subql/contract-sdk';
import { getAuthReqHeader, parseError, POST } from '@utils';
import { limitContract, makeCacheKey } from '@utils/limitation';
import { waitForSomething } from '@utils/waitForSomething';
import { Button } from 'antd';
import axios, { AxiosResponse } from 'axios';
import { BigNumberish } from 'ethers';
import { isObject } from 'lodash-es';
import { generateNonce, SiweMessage } from 'siwe';
import { useChainId, useSignMessage } from 'wagmi';
const instance = axios.create({
baseURL: import.meta.env.VITE_CONSUMER_HOST_ENDPOINT,
});
export const isConsumerHostError = (res: object): res is ConsumerHostError => {
if (!isObject(res)) return false;
return Object.hasOwn(res, 'error');
};
// Will add more controller along with below TODO
export type ConsumerHostServicesProps = {
alert?: boolean;
autoLogin?: boolean;
};
export enum LOGIN_CONSUMER_HOST_STATUS_MSG {
USE_CACHE = 'use cache',
OK = 'ok',
REJECT_SIGN = 'User denied message signature',
}
// TODO: add cache for api request
export const useConsumerHostServices = (
{ alert = false, autoLogin = true }: ConsumerHostServicesProps = { alert: false, autoLogin: true },
) => {
const { address: account } = useAccount();
const chainId = useChainId();
const { signMessageAsync } = useSignMessage();
const authHeaders = useRef<{ Authorization: string }>(
getAuthReqHeader(localStorage.getItem(`consumer-host-services-token-${account}`) || ''),
);
const [hasLogin, setHasLogin] = useState(false);
const [loading, setLoading] = useState(true);
const requestConsumerHostToken = async (account: string) => {
try {
const tokenRequestUrl = `${import.meta.env.VITE_CONSUMER_HOST_ENDPOINT}/login`;
const newMsg = new SiweMessage({
domain: window.location.host,
address: account,
statement: `Login to SubQuery Network`,
uri: window.location.origin,
version: '1',
chainId,
nonce: generateNonce(),
});
const signature = await signMessageAsync({
message: newMsg.prepareMessage(),
});
if (!signature) throw new Error();
const { response, error } = await POST({
endpoint: tokenRequestUrl,
requestBody: {
message: newMsg.prepareMessage(),
signature: signature,
},
});
const sortedResponse = response && (await response.json());
if (error || !response?.ok || sortedResponse?.error) {
throw new Error(sortedResponse?.error ?? error);
}
return { data: sortedResponse?.token };
} catch (error) {
return {
error: parseError(error, {
defaultGeneralMsg: 'Failed to request token of consumer host.',
errorMappings: [
{
error: 'Missing consumer',
message: 'Please deposit first',
},
],
}),
};
}
};
const alertResDecorator = <T extends (...args: any) => any>(
func: T,
): ((...args: Parameters<T>) => Promise<ReturnType<T>>) => {
return async (...args: Parameters<T>): Promise<ReturnType<T>> => {
const res = await func(...args);
if (alert && isConsumerHostError(res.data)) {
openNotification({
type: 'error',
description: res.data.error,
duration: 5000,
});
}
return res;
};
};
const loginConsumerHost = async (refresh = false) => {
if (account) {
if (!refresh) {
const cachedToken = localStorage.getItem(`consumer-host-services-token-${account}`);
if (cachedToken) {
authHeaders.current = getAuthReqHeader(cachedToken);
return {
status: true,
msg: 'use cache',
};
}
}
let acceptOrCancel: 'pending' | 'cancel' | 'pass' = 'pending';
Modal.confirm({
title: 'Login to SubQuery Network',
width: 572,
content: (
<Typography>
<p>You must sign a request using your wallet to login to SubQuery</p>
<p>
This is only required once for each browser and does not cost any transaction fees - it is used to prove
you have access to your wallet address.
</p>
</Typography>
),
cancelText: 'Cancel',
className: 'confirmModal',
okText: 'Sign Request using Wallet',
cancelButtonProps: {
shape: 'round',
size: 'large',
},
okButtonProps: {
shape: 'round',
size: 'large',
type: 'primary',
},
icon: null,
onOk: () => {
acceptOrCancel = 'pass';
},
onCancel: () => {
acceptOrCancel = 'cancel';
},
});
await waitForSomething({ func: () => acceptOrCancel !== 'pending' });
// https://github.com/microsoft/TypeScript/issues/9998
const isCancel = (res: typeof acceptOrCancel): res is 'cancel' => res === 'cancel';
if (isCancel(acceptOrCancel)) {
return {
status: false,
msg: 'user reject sign',
};
}
const res = await requestConsumerHostToken(account);
console.warn(res);
if (res.error) {
return {
status: false,
msg: res.error,
};
}
if (res.data) {
authHeaders.current = getAuthReqHeader(res.data);
localStorage.setItem(`consumer-host-services-token-${account}`, res.data);
setHasLogin(true);
return {
status: true,
msg: 'ok',
};
}
}
return {
status: false,
msg: 'Please check your wallet if works',
};
};
// do not need retry limitation
// login need user confirm sign, so it's a block operation
const checkLoginStatusAndLogin = async (res: unknown[] | object): Promise<boolean> => {
if (isConsumerHostError(res) && `${res.code}` === '403') {
const loginStatus = await loginConsumerHost(true);
if (loginStatus.status) {
return true;
}
} else {
setHasLogin(true);
}
return false;
};
const checkIfHasLogin = async () => {
// this api do not need arguments. so use it to check if need login.
try {
setLoading(true);
authHeaders.current = getAuthReqHeader(localStorage.getItem(`consumer-host-services-token-${account}`) || '');
const res = await limitContract(() => getUserApiKeysApi(), makeCacheKey('checkIfHasLogin', { prefix: account }));
if (isConsumerHostError(res.data) && `${res.data.code}` === '403') {
setHasLogin(false);
return;
}
setHasLogin(true);
} finally {
setLoading(false);
}
};
const loginResDecorator = <T extends (...args: any) => any>(
func: T,
): ((...args: Parameters<T>) => Promise<ReturnType<T>>) => {
return async (...args: Parameters<T>): Promise<ReturnType<T>> => {
const res = await func(...args);
const sdLogin = await checkLoginStatusAndLogin(res.data);
if (sdLogin) return await func(...args);
return res;
};
};
// the apis can use useCallback to speed up for re-render. if necessary
const getUserApiKeysApi = useCallback(async (): Promise<AxiosResponse<GetUserApiKeys[] | ConsumerHostError>> => {
const res = await instance.get<GetUserApiKeys[] | ConsumerHostError>('/users/apikeys', {
headers: authHeaders.current,
});
return res;
}, []);
const createNewApiKey = useCallback(
async (params: { name: string }): Promise<AxiosResponse<GetUserApiKeys | ConsumerHostError, { name: string }>> => {
const res = await instance.post<GetUserApiKeys>('/users/apikeys/new', params, {
headers: authHeaders.current,
});
return res;
},
[],
);
const deleteNewApiKey = useCallback(async (apikeyId: number) => {
const res = await instance.post<GetUserApiKeys>(
`/users/apikeys/${apikeyId}/delete`,
{},
{
headers: authHeaders.current,
},
);
return res;
}, []);
const createHostingPlanApi = useCallback(
async (params: IPostHostingPlansParams): Promise<AxiosResponse<IGetHostingPlans>> => {
const res = await instance.post<IGetHostingPlans>(`/users/hosting-plans`, params, {
headers: authHeaders.current,
});
return res;
},
[],
);
const updateHostingPlanApi = useCallback(
async (params: IPostHostingPlansParams & { id: string | number }): Promise<AxiosResponse<IGetHostingPlans>> => {
const res = await instance.post<IGetHostingPlans>(`/users/hosting-plans/${params.id}`, params, {
headers: authHeaders.current,
});
return res;
},
[],
);
const getHostingPlanApi = useCallback(
async (params: { account?: string }): Promise<AxiosResponse<IGetHostingPlans[]>> => {
const res = await instance.get<IGetHostingPlans[]>(`/hosting-plans/${params.account}`, {
headers: authHeaders.current,
});
return res;
},
[],
);
const getProjects = useCallback(async (params: { projectId: string; deployment?: string }) => {
const res = await instance.get<{ indexers: IIndexerFlexPlan[] }>(`/projects/${params.projectId}`, {
headers: authHeaders.current,
params,
});
return res;
}, []);
const getUserChannelState = useCallback(async (channelId: string): Promise<AxiosResponse<IGetUserChannelState>> => {
const res = await instance.get<IGetUserChannelState>(`/users/channels/${channelId}/state`, {
headers: authHeaders.current,
});
return res;
}, []);
const getChannelLimit = useCallback(async () => {
const res = await instance.get<IGetChannelLimit>('/channel-limit', {
headers: authHeaders.current,
});
return res;
}, []);
const getChannelSpent = useCallback(async (params: { consumer: string; channel?: string }) => {
const res = await instance.get<IGetChannelSpent>('/channel-spent', {
headers: authHeaders.current,
params,
});
return res;
}, []);
const refreshUserInfo = useCallback(async () => {
const res = await instance.get('/users/refresh', {
headers: authHeaders.current,
});
return res;
}, []);
const getSpentInfo = useCallback(async (params: { account: string; start?: string; end?: string }) => {
const res = await instance.get<IGetSpentInfo>(`/stats/user_aggregation/${params.account}`, {
headers: authHeaders.current,
params,
});
return res;
}, []);
const getStatisticQueries = useCallback(
async (params: { deployment: string[]; indexer?: string[]; start_date: string; end_date?: string }) => {
const res = await instance.post<IGetStatisticQueries>(`/stats/statistic-queries`, params, {
headers: authHeaders.current,
});
return res;
},
[],
);
const getStatisticQueriesByPrice = useCallback(
async (params: { start_date: string; end_date?: string; deployment: string[] }) => {
const res = await instance.post<IGetStatisticQueriesByPrice>(`/stats/deployment-price-count`, params, {
headers: authHeaders.current,
});
return res;
},
[],
);
const getUserQueriesAggregation = useCallback(
async (params: { start: string; end?: string; user_list: string[] }) => {
const res = await instance.post<IGetStatisticUserQueries>(`/stats/multi_user_aggregation`, params, {
headers: authHeaders.current,
});
return res;
},
[],
);
const requestTokenLayout = useCallback(
(pageTitle: string) => {
return (
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
<Typography variant="h5" weight={500}>
Session Token
</Typography>
<Typography
style={{ color: 'var(--sq-gray700)', marginTop: 16, marginBottom: 40, width: 344, textAlign: 'center' }}
>
To access {pageTitle}, you need to request a session token.
</Typography>
<Button
shape="round"
type="primary"
style={{ background: 'var(--sq-blue600)', borderColor: 'var(--sq-blue600)' }}
onClick={async () => {
const res = await loginConsumerHost(true);
if (!res.status) {
openNotification({
type: 'error',
title: 'Login failed',
description: res.msg,
});
}
}}
>
Request Session token
</Button>
</div>
);
},
[loginConsumerHost],
);
const getDominantPrice = useCallback(async (params: { ptype: ProjectType }) => {
const res = await instance.get<{ avg_price: string; ptype: ProjectType }>(
`price/get_ptype_dominant_price?ptype=${params.ptype}`,
{
headers: authHeaders.current,
},
);
return res;
}, []);
const getDominantPriceByDeployment = useCallback(async (params: { deployment_list: string[] }) => {
const res = await instance.post<{ deployment: string; price: string }[]>(`price/get_dominant_price`, params, {
headers: authHeaders.current,
});
return res;
}, []);
const getUserSubscriptions = useCallback(
async (address: string): Promise<AxiosResponse<IGetUserSubscription[] | ConsumerHostError>> => {
const res = await instance.get<IGetUserSubscription[] | ConsumerHostError>(`/subscriptions/wallet/${address}`, {
headers: authHeaders.current,
});
return res;
},
[],
);
// 新增: 创建订阅
const createSubscription = useCallback(
async (params: { project_id: number }): Promise<AxiosResponse<IGetUserSubscription | ConsumerHostError>> => {
const res = await instance.post<IGetUserSubscription | ConsumerHostError>('/users/subscriptions', params, {
headers: authHeaders.current,
});
return res;
},
[],
);
// New: Unsubscribe from a project
const unsubscribeProject = useCallback(
async (projectId: number): Promise<AxiosResponse<{ success: boolean; message: string } | ConsumerHostError>> => {
const res = await instance.post<{ success: boolean; message: string } | ConsumerHostError>(
`/users/subscriptions/${projectId}/unsubscribe`,
{},
{
headers: authHeaders.current,
},
);
return res;
},
[],
);
// Get user subscription for a specific project
const getUserSubscriptionByProject = useCallback(
async (
projectId: number,
): Promise<AxiosResponse<IGetUserSubscription | IGetUserSubscriptionNotFound | ConsumerHostError>> => {
const res = await instance.get<IGetUserSubscription | IGetUserSubscriptionNotFound | ConsumerHostError>(
`/users/subscriptions/${projectId}`,
{
headers: authHeaders.current,
},
);
return res;
},
[],
);
// Get user hosting plans for a specific project
const getUserHostingPlansByProject = useCallback(
async (projectId: number, wallet: string): Promise<AxiosResponse<IGetHostingPlans[] | ConsumerHostError>> => {
const res = await instance.get<IGetHostingPlans[] | ConsumerHostError>(`/hosting-plans/project/${projectId}`, {
headers: authHeaders.current,
params: {
wallet,
},
});
return res;
},
[],
);
useEffect(() => {
checkIfHasLogin();
if (autoLogin) {
loginConsumerHost();
}
}, [account, autoLogin]);
return {
getUserApiKeysApi: alertResDecorator(loginResDecorator(getUserApiKeysApi)),
createNewApiKey: alertResDecorator(loginResDecorator(createNewApiKey)),
deleteNewApiKey: alertResDecorator(loginResDecorator(deleteNewApiKey)),
createHostingPlanApi: alertResDecorator(loginResDecorator(createHostingPlanApi)),
updateHostingPlanApi: alertResDecorator(loginResDecorator(updateHostingPlanApi)),
getUserChannelState: alertResDecorator(loginResDecorator(getUserChannelState)),
getProjects: alertResDecorator(getProjects),
refreshUserInfo: loginResDecorator(refreshUserInfo),
getStatisticQueries: alertResDecorator(getStatisticQueries),
getStatisticQueriesByPrice: alertResDecorator(getStatisticQueriesByPrice),
getUserQueriesAggregation: alertResDecorator(getUserQueriesAggregation),
getUserSubscriptions: alertResDecorator(loginResDecorator(getUserSubscriptions)),
createSubscription: alertResDecorator(loginResDecorator(createSubscription)),
unsubscribeProject: alertResDecorator(loginResDecorator(unsubscribeProject)),
getUserSubscriptionByProject: alertResDecorator(loginResDecorator(getUserSubscriptionByProject)),
getUserHostingPlansByProject: alertResDecorator(loginResDecorator(getUserHostingPlansByProject)),
getSpentInfo,
getHostingPlanApi,
getChannelLimit,
requestConsumerHostToken,
checkIfHasLogin,
loginConsumerHost,
requestTokenLayout,
getChannelSpent,
getDominantPrice,
getDominantPriceByDeployment,
hasLogin,
loading,
};
};
export type IGetStatisticUserQueries = {
info: {
today: string;
total: string;
list: string[];
};
user: string;
}[];
export type IGetStatisticQueriesByPrice = {
count?: number;
price?: string; // per request price
}[];
export interface IGetStatisticQueries {
total: string;
list: {
indexer?: string;
list?: {
deployment: string;
queries: string;
}[];
// if no indexer at params
deployment?: string;
queries?: string;
}[];
}
export interface IGetSpentInfo {
list?: string[];
today: string;
total: string;
}
export interface IGetChannelSpent {
consumer: string;
total: string;
spent: string;
remain: string;
}
export interface IGetChannelLimit {
channel_max_num: number;
channel_min_amount: number;
channel_min_days: number;
}
export interface IGetUserChannelState {
channelId: string;
consumerSign: string;
indexerSign: string;
isFinal: boolean;
spent: string;
}
export interface IPostHostingPlansParams {
deploymentId: string;
price: BigNumberish;
expiration: number;
maximum: number;
}
export interface IGetHostingPlans {
id: number;
user_id: number;
deployment: {
created_at: Date;
// cid
deployment: string;
id: number;
is_actived: boolean;
project_id: number;
updated_at: Date;
version: string;
deployment_id: number;
};
project: {
metadata: string;
id: number;
};
channels: string;
maximum: number;
price: BigNumberish;
spent: string;
expired_at: string;
is_actived: true;
created_at: string;
updated_at: string;
}
export interface GetUserApiKeys {
id: number;
user_id: number;
name: string;
value: string;
times: number;
created_at: string;
updated_at: string;
}
export interface IIndexerFlexPlan {
id: number;
deployment_id: number;
indexer_id: number;
indexer: string;
price: string;
max_time: number;
block_height: string;
status: number;
status_at: Date;
score: number;
reality: number;
is_active: boolean;
create_at: Date;
updated_at: Date;
online: boolean;
price_token: string;
}
export interface IGetUserSubscription {
id: number;
user_id: number;
project_id: number;
auto_latest?: boolean;
max_versions?: number;
is_active: boolean;
created_at: string;
updated_at: string;
project?: {
id: number;
metadata: string;
};
}
// Return type when subscription is not found
export interface IGetUserSubscriptionNotFound {
subscribed: false;
project_id: number;
user_id: number;
message: string;
}
// Type guard: checks if the user is not subscribed
export const isNotSubscribed = (
res: IGetUserSubscription | IGetUserSubscriptionNotFound | ConsumerHostError,
): res is IGetUserSubscriptionNotFound => {
return 'subscribed' in res && res.subscribed === false;
};
export type ConsumerHostError =
| {
code: '2000';
error: 'Invalid: json parse error.';
}
| {
code: '2001';
error: 'Invalid: invalid fund amount.';
}
| {
code: '2002';
error: 'Invalid: invalid callback signature decode.';
}
| {
code: '2003';
error: 'Invalid: invalid callback signature length.';
}
| {
code: '2004';
error: 'Invalid: channel not expired.';
}
| {
code: '2005';
error: 'Invalid: send query channel failure.';
}
| {
code: '2006';
error: 'Invalid: invalid deployment and indexer.';
}
| {
code: '2007';
error: 'Invalid: invalid expiration time.';
}
| {
code: '2008';
error: 'Invalid: invalid total amount.';
}
| {
code: '2009';
error: 'Invalid: user balance in contract is not enough.';
}
| {
code: '2010';
error: 'Invalid: send open channel failure.';
}
| {
code: '2011';
error: 'Invalid: invalid ApiKey when remove.';
}
| {
code: '2012';
error: 'Invalid: price is too small.';
}
| {
code: '2013';
error: 'Invalid: hosting plan maximum too small, need >= 2.';
}
| {
code: '2014';
error: 'Invalid: user missing in contract.';
}
| {
code: '2020';
error: 'Forbidden: admin not super admin.';
}
| {
code: '2021';
error: 'Forbidden: user not approved.';
}
| {
code: '2022';
error: 'Forbidden: channel not actived.';
}
| {
code: '2023';
error: 'Forbidden: user not actived.';
}
| {
code: '2030';
error: 'Offline: indexer offline.';
}
| {
code: '2050';
error: 'Internal: db (sqlx) error.';
}
| {
code: '2051';
error: 'Internal: template (tera) error.';
}
| {
code: '2052';
error: 'Internal: null response.';
}
| {
code: '2053';
error: 'Internal: contract address and ABI error.';
}
| {
code: '2054';
error: 'Internal: app handle static file error.';
}
| {
code: '2055';
error: 'Internal: app from request parts SessionHandle error.';
}
| {
code: '2056';
error: 'Internal: app from request parts AppContext error.';
}
| {
code: '2057';
error: 'Internal: app from request parts Cookie error.';
}
| {
code: '2058';
error: 'Internal: argon2 hash password error.';
}
| {
code: '2059';
error: 'Internal: parse chain height to u64 error.';
}
| {
code: '2060';
error: 'Not found: indexer model.';
}
| {
code: '2061';
error: 'Not found: admin model.';
}
| {
code: '2062';
error: 'Not found: apikey model.';
}
| {
code: '2063';
error: 'Not found: deployment model.';
}
| {
code: '2064';
error: 'Not found: deployment indexer model.';
}
| {
code: '2065';
error: 'Not found: project model.';
}
| {
code: '2066';
error: 'Not found: state channel model.';
}
| {
code: '2067';
error: 'Not found: user model.';
}
| {
code: '2068';
error: 'Not found: hosting plan model.';
}
| {
code: '2069';
error: 'Not found: project has no online and active indexer.';
}
| {
code: '2070';
error: 'Not found: hosting plan is expired.';
}
| {
code: '2080';
error: 'Internal: contract endpoint cannot reach.';
}
| {
code: '2081';
error: 'Internal: contract signer cannot init.';
}
| {
code: '2082';
error: 'Internal: send transaction failure. see error log.';
}
| {
code: '2083';
error: 'Internal: wait transaction failure. see error log.';
}
| {
code: '2084';
error: 'Internal: contract channel open call failure. see error log.';
}
| {
code: '2085';
error: 'Internal: contract channel fund call failure. see error log.';
}
| {
code: '2086';
error: 'Internal: contract channel finish call failure. see error log.';
}
| {
code: '2087';
error: 'Internal: contract channel claim call failure. see error log.';
}
| {
code: '2088';
error: 'Internal: contract channel terminate call failure. see error log.';
}
| {
code: '2100';
error: 'Internal: MISSING ENDPOINT HTTP';
}
| {
code: '2101';
error: 'Internal: Chain sync token contract failure';
}
| {
code: '2102';
error: 'Internal: Chain sync consumer contract serialize.';
}
| {
code: '2103';
error: 'Internal: Indexer is invalid.';
}
| {
code: '403';
error: 'not login';
};