rain-sdk-v2 1.0.4 → 1.0.6
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
CHANGED
|
@@ -156,6 +156,7 @@ const txs = await rain.buildCreateMarketTx({
|
|
|
156
156
|
barValues: [50, 50], // probability distribution (0-100, sums to 100)
|
|
157
157
|
baseToken: config.tokens.usdt.address, // USDT
|
|
158
158
|
tradingModel: TradingModel.AMM, // AMM = 0, OrderBook = 1
|
|
159
|
+
marketImage: 'https://cdn.example.com/market-image.png',
|
|
159
160
|
});
|
|
160
161
|
|
|
161
162
|
// Create market with RAIN token (18 decimals)
|
|
@@ -183,8 +184,9 @@ const txsRain = await rain.buildCreateMarketTx({
|
|
|
183
184
|
| `no_of_options` | `bigint` | Number of options |
|
|
184
185
|
| `inputAmountWei` | `bigint` | Initial liquidity in base token wei |
|
|
185
186
|
| `barValues` | `number[]` | Probability distribution (0-100 scale) |
|
|
186
|
-
| `baseToken` | `0x${string}` | Base token address (USDT) |
|
|
187
|
+
| `baseToken` | `0x${string}` | Base token address (USDT or RAIN) |
|
|
187
188
|
| `tradingModel` | `TradingModel` | `AMM (0)` or `OrderBook (1)` |
|
|
189
|
+
| `marketImage` | `string` | Market image URL (required) |
|
|
188
190
|
|
|
189
191
|
---
|
|
190
192
|
|
|
@@ -910,7 +912,11 @@ await rain.markNotificationAsRead({ notificationId: '...' }, accessToken);
|
|
|
910
912
|
|
|
911
913
|
```typescript
|
|
912
914
|
// Get price data for a pool
|
|
913
|
-
const prices = await rain.getPriceData({
|
|
915
|
+
const prices = await rain.getPriceData({
|
|
916
|
+
contractAddress: '0x...', // market contract address
|
|
917
|
+
side: 1, // 1 = YES, 2 = NO
|
|
918
|
+
filter: '1D', // '1H' | '6H' | '1D' | '1W' | '1M' | 'ALL'
|
|
919
|
+
});
|
|
914
920
|
```
|
|
915
921
|
|
|
916
922
|
### Pool Reviews
|
package/dist/api/priceData.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { buildHeaders, buildQuery, handleResponse } from './helpers.js';
|
|
2
2
|
export async function getPriceData(params, config) {
|
|
3
|
-
const qs = buildQuery({
|
|
3
|
+
const qs = buildQuery({ contractAddress: params.contractAddress, side: params.side, filter: params.filter });
|
|
4
4
|
const res = await fetch(`${config.apiUrl}/price-data/get-price-data${qs}`, {
|
|
5
5
|
method: 'GET',
|
|
6
6
|
headers: buildHeaders(config),
|
package/dist/api/types.d.ts
CHANGED
|
@@ -35,6 +35,8 @@ export function validateCreateMarketParams(params) {
|
|
|
35
35
|
throw new Error("barValues array is required and cannot be empty");
|
|
36
36
|
if (!baseToken)
|
|
37
37
|
throw new Error("baseToken address is required");
|
|
38
|
+
if (!params.marketImage)
|
|
39
|
+
throw new Error("marketImage is required");
|
|
38
40
|
if (!factoryContractAddress)
|
|
39
41
|
throw new Error("factoryContractAddress is required");
|
|
40
42
|
const decimals = tokenDecimals ?? 6;
|
|
@@ -20,7 +20,7 @@ export async function uploadMetaData(params) {
|
|
|
20
20
|
startDate: formattedStartDate,
|
|
21
21
|
endDate: formattedEndDate,
|
|
22
22
|
tradingModel: tradingModel ?? 0,
|
|
23
|
-
questionImage: params.
|
|
23
|
+
questionImage: params.marketImage,
|
|
24
24
|
tags: marketTags,
|
|
25
25
|
poolDescription: marketDescription,
|
|
26
26
|
isAiResolver: isPublicPoolResolverAi,
|
package/dist/tx/types.d.ts
CHANGED
|
@@ -108,7 +108,7 @@ export interface CreateMarketTxParams {
|
|
|
108
108
|
barValues: number[];
|
|
109
109
|
baseToken: `0x${string}`;
|
|
110
110
|
tradingModel?: TradingModel;
|
|
111
|
-
|
|
111
|
+
marketImage: string;
|
|
112
112
|
tokenDecimals?: number;
|
|
113
113
|
factoryContractAddress?: `0x${string}`;
|
|
114
114
|
oracleFixedFeePerOption?: bigint;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rain-sdk-v2",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
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",
|