rain-sdk-v2 1.0.0

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.
Files changed (102) hide show
  1. package/README.md +1074 -0
  2. package/dist/Rain.d.ts +212 -0
  3. package/dist/Rain.js +401 -0
  4. package/dist/RainAA.d.ts +62 -0
  5. package/dist/RainAA.js +304 -0
  6. package/dist/abi/CreateMarketAbi.d.ts +1125 -0
  7. package/dist/abi/CreateMarketAbi.js +1 -0
  8. package/dist/abi/ERC20Abi.d.ts +89 -0
  9. package/dist/abi/ERC20Abi.js +119 -0
  10. package/dist/abi/MarketsAbi.d.ts +2810 -0
  11. package/dist/abi/MarketsAbi.js +1 -0
  12. package/dist/abi/OracleAbi.d.ts +11 -0
  13. package/dist/abi/OracleAbi.js +15 -0
  14. package/dist/api/comments.d.ts +14 -0
  15. package/dist/api/comments.js +48 -0
  16. package/dist/api/dispute.d.ts +3 -0
  17. package/dist/api/dispute.js +30 -0
  18. package/dist/api/follow.d.ts +6 -0
  19. package/dist/api/follow.js +38 -0
  20. package/dist/api/helpers.d.ts +4 -0
  21. package/dist/api/helpers.js +26 -0
  22. package/dist/api/index.d.ts +14 -0
  23. package/dist/api/index.js +14 -0
  24. package/dist/api/investments.d.ts +21 -0
  25. package/dist/api/investments.js +135 -0
  26. package/dist/api/notifications.d.ts +4 -0
  27. package/dist/api/notifications.js +24 -0
  28. package/dist/api/orders.d.ts +8 -0
  29. package/dist/api/orders.js +40 -0
  30. package/dist/api/points.d.ts +5 -0
  31. package/dist/api/points.js +32 -0
  32. package/dist/api/poolReviews.d.ts +4 -0
  33. package/dist/api/poolReviews.js +23 -0
  34. package/dist/api/pools.d.ts +41 -0
  35. package/dist/api/pools.js +149 -0
  36. package/dist/api/priceData.d.ts +2 -0
  37. package/dist/api/priceData.js +9 -0
  38. package/dist/api/rainBurn.d.ts +3 -0
  39. package/dist/api/rainBurn.js +15 -0
  40. package/dist/api/types.d.ts +292 -0
  41. package/dist/api/types.js +2 -0
  42. package/dist/api/users.d.ts +15 -0
  43. package/dist/api/users.js +60 -0
  44. package/dist/auth/login.d.ts +4 -0
  45. package/dist/auth/login.js +27 -0
  46. package/dist/auth/types.d.ts +16 -0
  47. package/dist/auth/types.js +1 -0
  48. package/dist/config/environments.d.ts +15 -0
  49. package/dist/config/environments.js +41 -0
  50. package/dist/constants/contractmethods.d.ts +15 -0
  51. package/dist/constants/contractmethods.js +15 -0
  52. package/dist/index.d.ts +9 -0
  53. package/dist/index.js +6 -0
  54. package/dist/markets/getDisputeFee.d.ts +5 -0
  55. package/dist/markets/getDisputeFee.js +19 -0
  56. package/dist/markets/getOrderInfo.d.ts +53 -0
  57. package/dist/markets/getOrderInfo.js +80 -0
  58. package/dist/markets/getResolverBondAmount.d.ts +9 -0
  59. package/dist/markets/getResolverBondAmount.js +35 -0
  60. package/dist/markets/getUserOptionLPShares.d.ts +7 -0
  61. package/dist/markets/getUserOptionLPShares.js +17 -0
  62. package/dist/markets/getUserOptionShares.d.ts +8 -0
  63. package/dist/markets/getUserOptionShares.js +17 -0
  64. package/dist/socket/RainSocket.d.ts +175 -0
  65. package/dist/socket/RainSocket.js +186 -0
  66. package/dist/tx/CreateMarket/buildCreateMarketRawTx.d.ts +2 -0
  67. package/dist/tx/CreateMarket/buildCreateMarketRawTx.js +55 -0
  68. package/dist/tx/CreateMarket/createMarketValidation.d.ts +2 -0
  69. package/dist/tx/CreateMarket/createMarketValidation.js +48 -0
  70. package/dist/tx/CreateMarket/helpers.d.ts +3 -0
  71. package/dist/tx/CreateMarket/helpers.js +42 -0
  72. package/dist/tx/buildAddLiquidityRawTx.d.ts +2 -0
  73. package/dist/tx/buildAddLiquidityRawTx.js +23 -0
  74. package/dist/tx/buildApprovalRawTx.d.ts +2 -0
  75. package/dist/tx/buildApprovalRawTx.js +24 -0
  76. package/dist/tx/buildCalculateWinnerRawTx.d.ts +13 -0
  77. package/dist/tx/buildCalculateWinnerRawTx.js +37 -0
  78. package/dist/tx/buildCancelOrdersRawTx.d.ts +3 -0
  79. package/dist/tx/buildCancelOrdersRawTx.js +43 -0
  80. package/dist/tx/buildClaimRawTx.d.ts +2 -0
  81. package/dist/tx/buildClaimRawTx.js +19 -0
  82. package/dist/tx/buildClosePoolRawTx.d.ts +20 -0
  83. package/dist/tx/buildClosePoolRawTx.js +95 -0
  84. package/dist/tx/buildEnterOptionRawTx.d.ts +2 -0
  85. package/dist/tx/buildEnterOptionRawTx.js +25 -0
  86. package/dist/tx/buildMergeRawTx.d.ts +2 -0
  87. package/dist/tx/buildMergeRawTx.js +21 -0
  88. package/dist/tx/buildOpenDisputeRawTx.d.ts +8 -0
  89. package/dist/tx/buildOpenDisputeRawTx.js +39 -0
  90. package/dist/tx/buildPlaceOrderRawTx.d.ts +3 -0
  91. package/dist/tx/buildPlaceOrderRawTx.js +47 -0
  92. package/dist/tx/buildRemoveLiquidityRawTx.d.ts +2 -0
  93. package/dist/tx/buildRemoveLiquidityRawTx.js +23 -0
  94. package/dist/tx/buildSplitRawTx.d.ts +2 -0
  95. package/dist/tx/buildSplitRawTx.js +21 -0
  96. package/dist/tx/types.d.ts +117 -0
  97. package/dist/tx/types.js +10 -0
  98. package/dist/types.d.ts +15 -0
  99. package/dist/types.js +1 -0
  100. package/dist/utils/helpers.d.ts +4 -0
  101. package/dist/utils/helpers.js +28 -0
  102. package/package.json +66 -0
@@ -0,0 +1,8 @@
1
+ import { ApiConfig, ApiResponse, GetUserOrdersParams, OrderBookParams, GetUserOrderByPoolIdParams, OrdersListingByPoolParams } from './types.js';
2
+ export declare function getUserOrders(params: GetUserOrdersParams, config: ApiConfig): Promise<ApiResponse>;
3
+ export declare function getOrderBook(params: OrderBookParams, config: ApiConfig): Promise<ApiResponse>;
4
+ export declare function getUserOrderByPoolId(params: GetUserOrderByPoolIdParams, config: ApiConfig): Promise<ApiResponse>;
5
+ export declare function getOrdersListingByPool(params: OrdersListingByPoolParams, config: ApiConfig): Promise<ApiResponse>;
6
+ export declare function getOrderById(params: {
7
+ orderId: string;
8
+ }, config: ApiConfig): Promise<ApiResponse>;
@@ -0,0 +1,40 @@
1
+ import { buildHeaders, buildQuery, handleResponse } from './helpers.js';
2
+ export async function getUserOrders(params, config) {
3
+ const qs = buildQuery({ filter: params.filter, limit: params.limit, offset: params.offset });
4
+ const res = await fetch(`${config.apiUrl}/orders/get-user-orders${qs}`, {
5
+ method: 'GET',
6
+ headers: buildHeaders(config),
7
+ });
8
+ return handleResponse(res);
9
+ }
10
+ export async function getOrderBook(params, config) {
11
+ const qs = buildQuery({ pool: params.pool, limit: params.limit, offset: params.offset });
12
+ const res = await fetch(`${config.apiUrl}/orders/order-book${qs}`, {
13
+ method: 'GET',
14
+ headers: buildHeaders(config),
15
+ });
16
+ return handleResponse(res);
17
+ }
18
+ export async function getUserOrderByPoolId(params, config) {
19
+ const qs = buildQuery({ filter: params.filter });
20
+ const res = await fetch(`${config.apiUrl}/orders/get-user-order-by-poolId/${encodeURIComponent(params.poolId)}${qs}`, {
21
+ method: 'GET',
22
+ headers: buildHeaders(config),
23
+ });
24
+ return handleResponse(res);
25
+ }
26
+ export async function getOrdersListingByPool(params, config) {
27
+ const qs = buildQuery({ pool: params.pool, limit: params.limit, offset: params.offset });
28
+ const res = await fetch(`${config.apiUrl}/orders/orders-listing-by-pool${qs}`, {
29
+ method: 'GET',
30
+ headers: buildHeaders(config),
31
+ });
32
+ return handleResponse(res);
33
+ }
34
+ export async function getOrderById(params, config) {
35
+ const res = await fetch(`${config.apiUrl}/orders/get-order/${encodeURIComponent(params.orderId)}`, {
36
+ method: 'GET',
37
+ headers: buildHeaders(config),
38
+ });
39
+ return handleResponse(res);
40
+ }
@@ -0,0 +1,5 @@
1
+ import { ApiConfig, ApiResponse, AddUserPointsParams, UserOnboardingParams, PointsGraphParams } from './types.js';
2
+ export declare function addUserPoints(params: AddUserPointsParams, config: ApiConfig): Promise<ApiResponse>;
3
+ export declare function getUserPoints(config: ApiConfig): Promise<ApiResponse>;
4
+ export declare function userSuccessfulOnboarding(params: UserOnboardingParams, config: ApiConfig): Promise<ApiResponse>;
5
+ export declare function getUserPointsGraph(params: PointsGraphParams, config: ApiConfig): Promise<ApiResponse>;
@@ -0,0 +1,32 @@
1
+ import { buildHeaders, buildQuery, handleResponse } from './helpers.js';
2
+ export async function addUserPoints(params, config) {
3
+ const res = await fetch(`${config.apiUrl}/points/add-user-points`, {
4
+ method: 'POST',
5
+ headers: buildHeaders(config, 'application/json'),
6
+ body: JSON.stringify(params),
7
+ });
8
+ return handleResponse(res);
9
+ }
10
+ export async function getUserPoints(config) {
11
+ const res = await fetch(`${config.apiUrl}/points/get-user-points`, {
12
+ method: 'GET',
13
+ headers: buildHeaders(config),
14
+ });
15
+ return handleResponse(res);
16
+ }
17
+ export async function userSuccessfulOnboarding(params, config) {
18
+ const res = await fetch(`${config.apiUrl}/points/user-succesfull-onboarding`, {
19
+ method: 'POST',
20
+ headers: buildHeaders(config, 'application/json'),
21
+ body: JSON.stringify(params),
22
+ });
23
+ return handleResponse(res);
24
+ }
25
+ export async function getUserPointsGraph(params, config) {
26
+ const qs = buildQuery({ range: params.range });
27
+ const res = await fetch(`${config.apiUrl}/points/get-user-points-graph${qs}`, {
28
+ method: 'GET',
29
+ headers: buildHeaders(config),
30
+ });
31
+ return handleResponse(res);
32
+ }
@@ -0,0 +1,4 @@
1
+ import { ApiConfig, ApiResponse, AddReviewParams } from './types.js';
2
+ export declare function addReview(params: AddReviewParams, config: ApiConfig): Promise<ApiResponse>;
3
+ export declare function getUserReviews(config: ApiConfig): Promise<ApiResponse>;
4
+ export declare function getPoolsByCreatorReviews(config: ApiConfig): Promise<ApiResponse>;
@@ -0,0 +1,23 @@
1
+ import { buildHeaders, handleResponse } from './helpers.js';
2
+ export async function addReview(params, config) {
3
+ const res = await fetch(`${config.apiUrl}/pool-reviews/add-review`, {
4
+ method: 'POST',
5
+ headers: buildHeaders(config, 'application/json'),
6
+ body: JSON.stringify(params),
7
+ });
8
+ return handleResponse(res);
9
+ }
10
+ export async function getUserReviews(config) {
11
+ const res = await fetch(`${config.apiUrl}/pool-reviews/user-reviews`, {
12
+ method: 'GET',
13
+ headers: buildHeaders(config),
14
+ });
15
+ return handleResponse(res);
16
+ }
17
+ export async function getPoolsByCreatorReviews(config) {
18
+ const res = await fetch(`${config.apiUrl}/pool-reviews/pools-by-creator`, {
19
+ method: 'GET',
20
+ headers: buildHeaders(config),
21
+ });
22
+ return handleResponse(res);
23
+ }
@@ -0,0 +1,41 @@
1
+ import { ApiConfig, ApiResponse, PublicPoolsParams, PrivatePoolsParams, PoolListingByCreatorParams, VerifyAccessCodeParams, PoolTotalParticipantsParams, SearchPoolParams, RelatedPoolsParams, UpdateStreamingParams, UpdatePoolResolutionTimeParams, FindPoolFallbackParams, SignOraclesExtendTimeParams } from './types.js';
2
+ export declare function accessPool(params: {
3
+ poolId: string;
4
+ accessCode: string;
5
+ }, config: ApiConfig): Promise<ApiResponse>;
6
+ export declare function getPublicPools(params: PublicPoolsParams, config: ApiConfig): Promise<ApiResponse>;
7
+ export declare function getPrivatePools(params: PrivatePoolsParams, config: ApiConfig): Promise<ApiResponse>;
8
+ export declare function getPoolById(params: {
9
+ id: string;
10
+ }, config: ApiConfig): Promise<ApiResponse>;
11
+ export declare function getPoolByContractAddress(params: {
12
+ contractAddress: string;
13
+ }, config: ApiConfig): Promise<ApiResponse>;
14
+ export declare function searchPool(params: SearchPoolParams, config: ApiConfig): Promise<ApiResponse>;
15
+ export declare function verifyAccessCode(params: VerifyAccessCodeParams, config: ApiConfig): Promise<ApiResponse>;
16
+ export declare function getPoolListingByCreator(params: PoolListingByCreatorParams, config: ApiConfig): Promise<ApiResponse>;
17
+ export declare function searchPoolById(params: {
18
+ poolId: string;
19
+ }, config: ApiConfig): Promise<ApiResponse>;
20
+ export declare function getPoolTotalParticipants(params: PoolTotalParticipantsParams, config: ApiConfig): Promise<ApiResponse<{
21
+ totalParticipants: number;
22
+ }>>;
23
+ export declare function getTotalPoolsByUser(config: ApiConfig): Promise<ApiResponse<{
24
+ totalPoolsCreated: number;
25
+ }>>;
26
+ export declare function signOraclesExtendTime(params: SignOraclesExtendTimeParams, config: ApiConfig): Promise<ApiResponse>;
27
+ export declare function getTotalPredictionsByUser(config: ApiConfig): Promise<ApiResponse<{
28
+ totalPredictions: number;
29
+ }>>;
30
+ export declare function updateStreaming(params: UpdateStreamingParams, config: ApiConfig): Promise<ApiResponse>;
31
+ export declare function getAllPoolsCount(config: ApiConfig): Promise<ApiResponse<{
32
+ openPoolsCount: number;
33
+ }>>;
34
+ export declare function getRelatedPools(params: RelatedPoolsParams, config: ApiConfig): Promise<ApiResponse>;
35
+ export declare function getPoolResolutionHistory(params: {
36
+ poolId: string;
37
+ subPool: string;
38
+ }, config: ApiConfig): Promise<ApiResponse>;
39
+ export declare function updatePoolResolutionTime(params: UpdatePoolResolutionTimeParams, config: ApiConfig): Promise<ApiResponse>;
40
+ export declare function findPoolFallback(params: FindPoolFallbackParams, config: ApiConfig): Promise<ApiResponse>;
41
+ export declare function getFeaturedPools(config: ApiConfig): Promise<ApiResponse>;
@@ -0,0 +1,149 @@
1
+ import { buildHeaders, buildQuery, handleResponse } from './helpers.js';
2
+ export async function accessPool(params, config) {
3
+ const res = await fetch(`${config.apiUrl}/pools/access-pool/${encodeURIComponent(params.poolId)}/${encodeURIComponent(params.accessCode)}`, { method: 'GET', headers: buildHeaders(config) });
4
+ return handleResponse(res);
5
+ }
6
+ export async function getPublicPools(params, config) {
7
+ const qs = buildQuery({ limit: params.limit, offset: params.offset, tag: params.tag, sortBy: params.sortBy, status: params.status });
8
+ const res = await fetch(`${config.apiUrl}/pools/public-pools${qs}`, {
9
+ method: 'GET',
10
+ headers: buildHeaders(config),
11
+ });
12
+ return handleResponse(res);
13
+ }
14
+ export async function getPrivatePools(params, config) {
15
+ const qs = buildQuery({ limit: params.limit, offset: params.offset, tag: params.tag, status: params.status });
16
+ const res = await fetch(`${config.apiUrl}/pools/pools-private${qs}`, {
17
+ method: 'GET',
18
+ headers: buildHeaders(config),
19
+ });
20
+ return handleResponse(res);
21
+ }
22
+ export async function getPoolById(params, config) {
23
+ const res = await fetch(`${config.apiUrl}/pools/pool/${encodeURIComponent(params.id)}`, {
24
+ method: 'GET',
25
+ headers: buildHeaders(config),
26
+ });
27
+ return handleResponse(res);
28
+ }
29
+ export async function getPoolByContractAddress(params, config) {
30
+ const res = await fetch(`${config.apiUrl}/pools/poolByContractAddress/${encodeURIComponent(params.contractAddress)}`, {
31
+ method: 'GET',
32
+ headers: buildHeaders(config),
33
+ });
34
+ return handleResponse(res);
35
+ }
36
+ export async function searchPool(params, config) {
37
+ const qs = buildQuery({ question: params.question });
38
+ const res = await fetch(`${config.apiUrl}/pools/search-pool${qs}`, {
39
+ method: 'GET',
40
+ headers: buildHeaders(config),
41
+ });
42
+ return handleResponse(res);
43
+ }
44
+ export async function verifyAccessCode(params, config) {
45
+ const res = await fetch(`${config.apiUrl}/pools/verify-access-code`, {
46
+ method: 'POST',
47
+ headers: buildHeaders(config, 'application/json'),
48
+ body: JSON.stringify(params),
49
+ });
50
+ return handleResponse(res);
51
+ }
52
+ export async function getPoolListingByCreator(params, config) {
53
+ const qs = buildQuery({ limit: params.limit, offset: params.offset, filter: params.filter });
54
+ const res = await fetch(`${config.apiUrl}/pools/pool-listing-by-creator${qs}`, {
55
+ method: 'GET',
56
+ headers: buildHeaders(config),
57
+ });
58
+ return handleResponse(res);
59
+ }
60
+ export async function searchPoolById(params, config) {
61
+ const res = await fetch(`${config.apiUrl}/pools/search/${encodeURIComponent(params.poolId)}`, {
62
+ method: 'GET',
63
+ headers: buildHeaders(config),
64
+ });
65
+ return handleResponse(res);
66
+ }
67
+ export async function getPoolTotalParticipants(params, config) {
68
+ const qs = buildQuery({ poolId: params.poolId });
69
+ const res = await fetch(`${config.apiUrl}/pools/pool-total-participants${qs}`, {
70
+ method: 'GET',
71
+ headers: buildHeaders(config),
72
+ });
73
+ return handleResponse(res);
74
+ }
75
+ export async function getTotalPoolsByUser(config) {
76
+ const res = await fetch(`${config.apiUrl}/pools/total-pools-created-by-user`, {
77
+ method: 'GET',
78
+ headers: buildHeaders(config),
79
+ });
80
+ return handleResponse(res);
81
+ }
82
+ export async function signOraclesExtendTime(params, config) {
83
+ const qs = buildQuery({ contractAddress: params.contractAddress, walletAddress: params.walletAddress });
84
+ const res = await fetch(`${config.apiUrl}/pools/sign-oracles-extend-time${qs}`, {
85
+ method: 'GET',
86
+ headers: buildHeaders(config),
87
+ });
88
+ return handleResponse(res);
89
+ }
90
+ export async function getTotalPredictionsByUser(config) {
91
+ const res = await fetch(`${config.apiUrl}/pools/total-predictions-by-user`, {
92
+ method: 'GET',
93
+ headers: buildHeaders(config),
94
+ });
95
+ return handleResponse(res);
96
+ }
97
+ export async function updateStreaming(params, config) {
98
+ const res = await fetch(`${config.apiUrl}/pools/update-streaming`, {
99
+ method: 'POST',
100
+ headers: buildHeaders(config, 'application/json'),
101
+ body: JSON.stringify(params),
102
+ });
103
+ return handleResponse(res);
104
+ }
105
+ export async function getAllPoolsCount(config) {
106
+ const res = await fetch(`${config.apiUrl}/pools/get-all-pools-count`, {
107
+ method: 'GET',
108
+ headers: buildHeaders(config),
109
+ });
110
+ return handleResponse(res);
111
+ }
112
+ export async function getRelatedPools(params, config) {
113
+ const qs = buildQuery({ limit: params.limit, offset: params.offset });
114
+ const res = await fetch(`${config.apiUrl}/pools/get-related-pools/${encodeURIComponent(params.poolId)}${qs}`, {
115
+ method: 'GET',
116
+ headers: buildHeaders(config),
117
+ });
118
+ return handleResponse(res);
119
+ }
120
+ export async function getPoolResolutionHistory(params, config) {
121
+ const res = await fetch(`${config.apiUrl}/pools/get-pool-resolution-history/${encodeURIComponent(params.poolId)}/${encodeURIComponent(params.subPool)}`, {
122
+ method: 'GET',
123
+ headers: buildHeaders(config),
124
+ });
125
+ return handleResponse(res);
126
+ }
127
+ export async function updatePoolResolutionTime(params, config) {
128
+ const res = await fetch(`${config.apiUrl}/pools/update-pool-resolution-time`, {
129
+ method: 'POST',
130
+ headers: buildHeaders(config, 'application/json'),
131
+ body: JSON.stringify(params),
132
+ });
133
+ return handleResponse(res);
134
+ }
135
+ export async function findPoolFallback(params, config) {
136
+ const res = await fetch(`${config.apiUrl}/pools/find-pool-fallback`, {
137
+ method: 'POST',
138
+ headers: buildHeaders(config, 'application/json'),
139
+ body: JSON.stringify(params),
140
+ });
141
+ return handleResponse(res);
142
+ }
143
+ export async function getFeaturedPools(config) {
144
+ const res = await fetch(`${config.apiUrl}/pools/get-featured-pools`, {
145
+ method: 'GET',
146
+ headers: buildHeaders(config),
147
+ });
148
+ return handleResponse(res);
149
+ }
@@ -0,0 +1,2 @@
1
+ import { ApiConfig, ApiResponse, PriceDataParams } from './types.js';
2
+ export declare function getPriceData(params: PriceDataParams, config: ApiConfig): Promise<ApiResponse>;
@@ -0,0 +1,9 @@
1
+ import { buildHeaders, buildQuery, handleResponse } from './helpers.js';
2
+ export async function getPriceData(params, config) {
3
+ const qs = buildQuery({ contractAddress: params.contractAddress, filter: params.filter });
4
+ const res = await fetch(`${config.apiUrl}/price-data/get-price-data${qs}`, {
5
+ method: 'GET',
6
+ headers: buildHeaders(config),
7
+ });
8
+ return handleResponse(res);
9
+ }
@@ -0,0 +1,3 @@
1
+ import { ApiConfig, ApiResponse, RainBurnPerPoolParams } from './types.js';
2
+ export declare function getTotalBurned(config: ApiConfig): Promise<ApiResponse>;
3
+ export declare function getBurnPerPool(params: RainBurnPerPoolParams, config: ApiConfig): Promise<ApiResponse>;
@@ -0,0 +1,15 @@
1
+ import { buildHeaders, handleResponse } from './helpers.js';
2
+ export async function getTotalBurned(config) {
3
+ const res = await fetch(`${config.apiUrl}/rain-token/total-burned`, {
4
+ method: 'GET',
5
+ headers: buildHeaders(config),
6
+ });
7
+ return handleResponse(res);
8
+ }
9
+ export async function getBurnPerPool(params, config) {
10
+ const res = await fetch(`${config.apiUrl}/rain-token/per-pool/${encodeURIComponent(params.poolId)}`, {
11
+ method: 'GET',
12
+ headers: buildHeaders(config),
13
+ });
14
+ return handleResponse(res);
15
+ }
@@ -0,0 +1,292 @@
1
+ export interface ApiConfig {
2
+ apiUrl: string;
3
+ accessToken?: string;
4
+ }
5
+ export interface ApiResponse<T = unknown> {
6
+ statusCode: number;
7
+ message: string;
8
+ data?: T;
9
+ details?: unknown;
10
+ }
11
+ export interface UserProfile {
12
+ _id: string;
13
+ walletAddress: string;
14
+ name?: string;
15
+ bio?: string;
16
+ profilePic?: string;
17
+ twitterLink?: string;
18
+ instagramLink?: string;
19
+ discordLink?: string;
20
+ telegramLink?: string;
21
+ facebookLink?: string;
22
+ createdAt?: string;
23
+ updatedAt?: string;
24
+ }
25
+ export interface UserProfileUpdateParams {
26
+ name?: string;
27
+ bio?: string;
28
+ profilePic?: string;
29
+ twitterLink?: string;
30
+ instagramLink?: string;
31
+ discordLink?: string;
32
+ telegramLink?: string;
33
+ facebookLink?: string;
34
+ }
35
+ export interface UserHistoryParams {
36
+ limit?: number;
37
+ offset?: number;
38
+ }
39
+ export interface UserHistoryItem {
40
+ action: string;
41
+ poolQuestion?: string;
42
+ poolToken?: Record<string, unknown>;
43
+ optionName?: string;
44
+ amount?: number;
45
+ txHash?: string;
46
+ createdAt?: string;
47
+ }
48
+ export interface UserHistoryResponse {
49
+ totalPoints: number;
50
+ followedTwitter: boolean;
51
+ joinedTomi: boolean;
52
+ history: UserHistoryItem[];
53
+ pagination: {
54
+ total: number;
55
+ offset: number;
56
+ limit: number;
57
+ totalPages: number;
58
+ };
59
+ }
60
+ export interface CreateCommentParams {
61
+ comment: string;
62
+ poolId: string;
63
+ parentCommentId?: string;
64
+ }
65
+ export interface CommentsListingParams {
66
+ poolId: string;
67
+ limit?: number;
68
+ offset?: number;
69
+ }
70
+ export interface UpdateCommentParams {
71
+ commentId: string;
72
+ comment: string;
73
+ }
74
+ export interface CommentCountParams {
75
+ poolId: string;
76
+ }
77
+ export interface PoolOption {
78
+ optionName: string;
79
+ optionImage?: string;
80
+ choiceIndex?: number;
81
+ }
82
+ export interface PoolToken {
83
+ tokenAddress: string;
84
+ tokenSymbol: string;
85
+ tokenDecimals: number;
86
+ tokenName?: string;
87
+ tokenLogo?: string;
88
+ }
89
+ export type PoolStatus = 'New' | 'Live' | 'Closing_Soon' | 'Pending_Finalization' | 'Waiting_for_Result' | 'Dispute_Window_Open' | 'Under_Dispute' | 'Appeal_Window_Open' | 'Under_Appeal' | 'Closed';
90
+ export interface CreatePoolParams {
91
+ question: string;
92
+ isPrivate: boolean;
93
+ contractAddress: string;
94
+ poolTrxHash: string;
95
+ ipfsURL?: string;
96
+ poolDescription?: string;
97
+ tags?: string[];
98
+ options: {
99
+ optionName: string;
100
+ }[];
101
+ startDate: string;
102
+ endDate: string;
103
+ liquidityMax: number;
104
+ }
105
+ export interface PublicPoolsParams {
106
+ limit?: number;
107
+ offset?: number;
108
+ tag?: string;
109
+ sortBy?: string;
110
+ status?: PoolStatus;
111
+ }
112
+ export interface PrivatePoolsParams {
113
+ limit?: number;
114
+ offset?: number;
115
+ tag?: string;
116
+ status?: PoolStatus;
117
+ }
118
+ export interface PoolListingByCreatorParams {
119
+ limit: number;
120
+ offset: number;
121
+ filter?: 'privatePools' | 'publicPools';
122
+ }
123
+ export interface VerifyAccessCodeParams {
124
+ poolId: string;
125
+ accessCode: string;
126
+ }
127
+ export interface PoolTotalParticipantsParams {
128
+ poolId: string;
129
+ }
130
+ export interface SearchPoolParams {
131
+ question: string;
132
+ }
133
+ export interface RelatedPoolsParams {
134
+ poolId: string;
135
+ limit?: number;
136
+ offset?: number;
137
+ }
138
+ export interface UpdateStreamingParams {
139
+ poolId: string;
140
+ action: 'start' | 'stop';
141
+ videoStreamingID?: string;
142
+ }
143
+ export interface UpdatePoolResolutionTimeParams {
144
+ poolId: string;
145
+ resolutionTime?: string;
146
+ }
147
+ export interface FindPoolFallbackParams {
148
+ question: string;
149
+ isPrivate: boolean;
150
+ poolDescription?: string;
151
+ options: {
152
+ optionName: string;
153
+ }[];
154
+ startDate: string;
155
+ endDate: string;
156
+ tags?: string | string[];
157
+ }
158
+ export interface SignOraclesExtendTimeParams {
159
+ contractAddress: string;
160
+ walletAddress: string;
161
+ }
162
+ export interface UserTotalInvestmentParams {
163
+ poolId: string;
164
+ }
165
+ export interface OptionsTotalVolumeParams {
166
+ poolId: string;
167
+ }
168
+ export interface PoolActivityParams {
169
+ poolId: string;
170
+ limit?: number;
171
+ offset?: number;
172
+ }
173
+ export interface TopHoldersParams {
174
+ poolId: string;
175
+ subPoolIndex: number;
176
+ limit?: number;
177
+ offset?: number;
178
+ }
179
+ export interface UserInvestedPoolsParams {
180
+ limit?: number;
181
+ offset?: number;
182
+ }
183
+ export interface InvestmentVolumeGraphParams {
184
+ timeframe: 'day' | 'week' | 'month';
185
+ }
186
+ export interface UserPnlGraphParams {
187
+ timeframe: 'day' | 'week' | 'month' | 'all';
188
+ }
189
+ export interface TopWinnersLosersParams {
190
+ timeFilter?: 'all' | 'day' | 'week' | 'month';
191
+ }
192
+ export interface PnlByPoolIdParams {
193
+ poolId: string;
194
+ }
195
+ export interface PriceDataParams {
196
+ contractAddress: string;
197
+ filter?: '1H' | '6H' | '1D' | '1W' | '1M' | 'ALL';
198
+ }
199
+ export interface AddReviewParams {
200
+ poolId: string;
201
+ rating: number;
202
+ review?: string;
203
+ }
204
+ export interface CreateOrderParams {
205
+ pool: string;
206
+ quantity: number;
207
+ totalPrice: number;
208
+ externalID: string;
209
+ subPool: string;
210
+ subPoolIndex: number;
211
+ side: 1 | 2;
212
+ orderType: 'buy' | 'sell';
213
+ }
214
+ export interface GetUserOrdersParams {
215
+ filter?: 'open' | 'orderHistory';
216
+ limit?: number;
217
+ offset?: number;
218
+ }
219
+ export interface OrderBookParams {
220
+ pool: string;
221
+ limit?: number;
222
+ offset?: number;
223
+ }
224
+ export interface GetUserOrderByPoolIdParams {
225
+ poolId: string;
226
+ filter?: 'open' | 'orderHistory';
227
+ }
228
+ export interface OrdersListingByPoolParams {
229
+ pool: string;
230
+ limit?: number;
231
+ offset?: number;
232
+ }
233
+ export type PointsEventType = 'deposit' | 'withdraw' | 'trade' | 'add_liquidity' | 'open_market' | 'invite' | 'follow_twitter' | 'join_tomi';
234
+ export interface AddUserPointsParams {
235
+ eventType: PointsEventType;
236
+ value: number;
237
+ points: number;
238
+ transactionHash: string;
239
+ }
240
+ export interface UserOnboardingParams {
241
+ points: number;
242
+ value: number;
243
+ eventType: 'invite';
244
+ }
245
+ export interface PointsGraphParams {
246
+ range?: 'day' | 'week' | 'month' | 'all';
247
+ }
248
+ export interface GetNotificationsParams {
249
+ page?: number;
250
+ limit?: number;
251
+ status?: 'all' | 'unread' | 'read';
252
+ }
253
+ export interface MarkNotificationAsReadParams {
254
+ id: string;
255
+ }
256
+ export interface CreateDisputeMessageParams {
257
+ pool: string;
258
+ role: 'creator' | 'disputer';
259
+ messageType: 'text' | 'image' | 'video' | 'file' | 'youtube';
260
+ file?: Blob | File;
261
+ evidence: {
262
+ question: string;
263
+ options: string[];
264
+ evidenceType: 'photo' | 'video' | 'pdf' | 'youtube';
265
+ description?: string;
266
+ source?: string;
267
+ youtubeUrl?: string;
268
+ };
269
+ }
270
+ export interface GetPoolDisputeConvoParams {
271
+ poolId: string;
272
+ subPool: string;
273
+ limit?: number;
274
+ offset?: number;
275
+ }
276
+ export interface FollowToggleParams {
277
+ userId: string;
278
+ }
279
+ export interface FollowCheckParams {
280
+ userId: string;
281
+ }
282
+ export interface FollowListParams {
283
+ userId: string;
284
+ page?: number;
285
+ limit?: number;
286
+ }
287
+ export interface FollowStatsParams {
288
+ userId: string;
289
+ }
290
+ export interface RainBurnPerPoolParams {
291
+ poolId: string;
292
+ }
@@ -0,0 +1,2 @@
1
+ // ─── Common ───────────────────────────────────────────────────────────────────
2
+ export {};
@@ -0,0 +1,15 @@
1
+ import { ApiConfig, ApiResponse, UserProfile, UserProfileUpdateParams, UserHistoryParams, UserHistoryResponse } from './types.js';
2
+ export declare function findUserByWalletAddress(params: {
3
+ walletAddress: string;
4
+ }, config: ApiConfig): Promise<ApiResponse<UserProfile>>;
5
+ export declare function updateUserProfile(params: UserProfileUpdateParams, config: ApiConfig): Promise<ApiResponse<UserProfile>>;
6
+ export declare function getUserProfile(config: ApiConfig): Promise<ApiResponse<UserProfile>>;
7
+ export declare function getUsersTotalCount(config: ApiConfig): Promise<ApiResponse<{
8
+ totalUsers: number;
9
+ }>>;
10
+ export declare function removeUserProfilePic(config: ApiConfig): Promise<ApiResponse<UserProfile>>;
11
+ export declare function getUserHistory(params: UserHistoryParams, config: ApiConfig): Promise<ApiResponse<UserHistoryResponse>>;
12
+ export declare function viewUserProfile(params: {
13
+ userId: string;
14
+ }, config: ApiConfig): Promise<ApiResponse>;
15
+ export declare function checkTokenExpiration(config: ApiConfig): Promise<ApiResponse>;