rain-sdk-v2 2.0.4 → 2.0.5
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 +11 -0
- package/dist/Rain.d.ts +3 -0
- package/dist/Rain.js +4 -0
- package/dist/markets/getDisputeWindow.d.ts +5 -0
- package/dist/markets/getDisputeWindow.js +16 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -531,6 +531,17 @@ const claimed = await rain.getOptionClaimed({
|
|
|
531
531
|
// true if already claimed, false otherwise
|
|
532
532
|
```
|
|
533
533
|
|
|
534
|
+
### `getDisputeWindow(params): Promise<bigint>`
|
|
535
|
+
|
|
536
|
+
Get the dispute window duration (in seconds) for a market contract.
|
|
537
|
+
|
|
538
|
+
```typescript
|
|
539
|
+
const window = await rain.getDisputeWindow({
|
|
540
|
+
marketContractAddress: '0x...',
|
|
541
|
+
});
|
|
542
|
+
// window = dispute window in seconds (e.g. 7200n = 2 hours)
|
|
543
|
+
```
|
|
544
|
+
|
|
534
545
|
### `getDynamicPayout(params): Promise<bigint[]>`
|
|
535
546
|
|
|
536
547
|
Get the dynamic payout amounts for a user on a specific option. Returns an array of payout values per side.
|
package/dist/Rain.d.ts
CHANGED
|
@@ -51,6 +51,9 @@ export declare class Rain {
|
|
|
51
51
|
option: bigint;
|
|
52
52
|
userAddress: `0x${string}`;
|
|
53
53
|
}): Promise<boolean>;
|
|
54
|
+
getDisputeWindow(params: {
|
|
55
|
+
marketContractAddress: `0x${string}`;
|
|
56
|
+
}): Promise<bigint>;
|
|
54
57
|
getDynamicPayout(params: {
|
|
55
58
|
marketContractAddress: `0x${string}`;
|
|
56
59
|
userAddress: `0x${string}`;
|
package/dist/Rain.js
CHANGED
|
@@ -19,6 +19,7 @@ import { getUserOptionShares } from './markets/getUserOptionShares.js';
|
|
|
19
19
|
import { getDynamicPayout } from './markets/getDynamicPayout.js';
|
|
20
20
|
import { getUserSharesInEscrow } from './markets/getUserSharesInEscrow.js';
|
|
21
21
|
import { getOptionClaimed } from './markets/getOptionClaimed.js';
|
|
22
|
+
import { getDisputeWindow } from './markets/getDisputeWindow.js';
|
|
22
23
|
import { createPublicClient, http, parseAbi } from 'viem';
|
|
23
24
|
import { arbitrum } from 'viem/chains';
|
|
24
25
|
import * as usersApi from './api/users.js';
|
|
@@ -123,6 +124,9 @@ export class Rain {
|
|
|
123
124
|
async getOptionClaimed(params) {
|
|
124
125
|
return getOptionClaimed({ ...params, rpcUrl: this.rpcUrl });
|
|
125
126
|
}
|
|
127
|
+
async getDisputeWindow(params) {
|
|
128
|
+
return getDisputeWindow({ ...params, rpcUrl: this.rpcUrl });
|
|
129
|
+
}
|
|
126
130
|
async getDynamicPayout(params) {
|
|
127
131
|
return getDynamicPayout({ ...params, rpcUrl: this.rpcUrl });
|
|
128
132
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createPublicClient, http } from 'viem';
|
|
2
|
+
import { arbitrum } from 'viem/chains';
|
|
3
|
+
import { MarketsAbi } from '../abi/MarketsAbi.js';
|
|
4
|
+
export async function getDisputeWindow(params) {
|
|
5
|
+
const { marketContractAddress, rpcUrl } = params;
|
|
6
|
+
const client = createPublicClient({
|
|
7
|
+
chain: arbitrum,
|
|
8
|
+
transport: http(rpcUrl),
|
|
9
|
+
});
|
|
10
|
+
const disputeWindow = await client.readContract({
|
|
11
|
+
address: marketContractAddress,
|
|
12
|
+
abi: MarketsAbi,
|
|
13
|
+
functionName: 'DISPUTE_WINDOW',
|
|
14
|
+
});
|
|
15
|
+
return disputeWindow;
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rain-sdk-v2",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
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",
|