rain-sdk-v2 1.0.7 → 1.0.8
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/README.md +26 -4
- package/dist/api/dispute.js +8 -2
- package/dist/api/types.d.ts +8 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -973,12 +973,34 @@ const burn = await rain.getBurnPerPool({ poolId: '...' });
|
|
|
973
973
|
### Dispute
|
|
974
974
|
|
|
975
975
|
```typescript
|
|
976
|
-
// Create dispute message (
|
|
976
|
+
// Create dispute message (text)
|
|
977
|
+
await rain.createDisputeMessage({
|
|
978
|
+
pool: '...', // Parent pool document ID
|
|
979
|
+
subPool: '...', // SubPool document ID
|
|
980
|
+
role: 'disputer', // 'creator' | 'disputer' | 'proposer'
|
|
981
|
+
messageType: 'text', // 'text' | 'image' | 'video' | 'file' | 'youtube' | 'mixed'
|
|
982
|
+
evidence: {
|
|
983
|
+
options: ['Yes', 'No'], // required, at least 2
|
|
984
|
+
evidenceType: 'photo', // 'photo' | 'video' | 'pdf' | 'youtube' | 'mixed'
|
|
985
|
+
question: 'Did the event happen?', // optional
|
|
986
|
+
description: 'Screenshot of result', // optional
|
|
987
|
+
source: 'https://espn.com/result', // optional
|
|
988
|
+
youtubeUrls: ['https://youtube.com/watch?v=abc123'], // optional
|
|
989
|
+
urls: ['https://example.com/proof'], // optional
|
|
990
|
+
},
|
|
991
|
+
}, accessToken);
|
|
992
|
+
|
|
993
|
+
// Create dispute message with file attachments (image/video/pdf)
|
|
977
994
|
await rain.createDisputeMessage({
|
|
978
995
|
pool: '...',
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
996
|
+
subPool: '...',
|
|
997
|
+
role: 'creator',
|
|
998
|
+
messageType: 'image', // set to 'file' for PDF
|
|
999
|
+
files: [fileObject], // File[] — required for image/video/file/mixed types, max 25MB each
|
|
1000
|
+
evidence: {
|
|
1001
|
+
options: ['Yes', 'No'],
|
|
1002
|
+
evidenceType: 'photo', // use 'pdf' for PDF files
|
|
1003
|
+
},
|
|
982
1004
|
}, accessToken);
|
|
983
1005
|
|
|
984
1006
|
// Get dispute conversation for a sub-pool
|
package/dist/api/dispute.js
CHANGED
|
@@ -2,16 +2,22 @@ import { buildHeaders, buildQuery, handleResponse } from './helpers.js';
|
|
|
2
2
|
export async function createDisputeMessage(params, config) {
|
|
3
3
|
const formData = new FormData();
|
|
4
4
|
formData.append('pool', params.pool);
|
|
5
|
+
formData.append('subPool', params.subPool);
|
|
5
6
|
formData.append('role', params.role);
|
|
6
7
|
formData.append('messageType', params.messageType);
|
|
7
8
|
formData.append('evidence', JSON.stringify(params.evidence));
|
|
8
|
-
if (params.
|
|
9
|
-
|
|
9
|
+
if (params.files && params.files.length > 0) {
|
|
10
|
+
for (const file of params.files) {
|
|
11
|
+
formData.append('files', file);
|
|
12
|
+
}
|
|
10
13
|
}
|
|
11
14
|
const headers = {};
|
|
12
15
|
if (config.accessToken) {
|
|
13
16
|
headers['Authorization'] = `Bearer ${config.accessToken}`;
|
|
14
17
|
}
|
|
18
|
+
if (config.apiUrl?.includes('ngrok')) {
|
|
19
|
+
headers['ngrok-skip-browser-warning'] = 'true';
|
|
20
|
+
}
|
|
15
21
|
// Do not set Content-Type for FormData; the browser sets the boundary automatically.
|
|
16
22
|
const res = await fetch(`${config.apiUrl}/dispute/create-dispute-message`, {
|
|
17
23
|
method: 'POST',
|
package/dist/api/types.d.ts
CHANGED
|
@@ -256,16 +256,18 @@ export interface MarkNotificationAsReadParams {
|
|
|
256
256
|
}
|
|
257
257
|
export interface CreateDisputeMessageParams {
|
|
258
258
|
pool: string;
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
file
|
|
259
|
+
subPool: string;
|
|
260
|
+
role: 'creator' | 'disputer' | 'proposer';
|
|
261
|
+
messageType: 'text' | 'image' | 'video' | 'file' | 'youtube' | 'mixed';
|
|
262
|
+
files?: (Blob | File)[];
|
|
262
263
|
evidence: {
|
|
263
|
-
question
|
|
264
|
+
question?: string;
|
|
264
265
|
options: string[];
|
|
265
|
-
evidenceType: 'photo' | 'video' | 'pdf' | 'youtube';
|
|
266
|
+
evidenceType: 'photo' | 'video' | 'pdf' | 'youtube' | 'mixed';
|
|
266
267
|
description?: string;
|
|
267
268
|
source?: string;
|
|
268
|
-
|
|
269
|
+
youtubeUrls?: string[];
|
|
270
|
+
urls?: string[];
|
|
269
271
|
};
|
|
270
272
|
}
|
|
271
273
|
export interface GetPoolDisputeConvoParams {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rain-sdk-v2",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Rain SDK V2 — TypeScript SDK for Rain prediction markets on Arbitrum. Market creation, trading, liquidity, order book, split/merge, dispute, and smart account support.",
|
|
6
6
|
"main": "dist/index.js",
|