rain-sdk-v2 1.2.0 → 1.2.1
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/dist/Rain.d.ts
CHANGED
|
@@ -38,6 +38,12 @@ export declare class Rain {
|
|
|
38
38
|
optionSide: number;
|
|
39
39
|
userAddress: `0x${string}`;
|
|
40
40
|
}): Promise<bigint>;
|
|
41
|
+
getUserSharesInEscrow(params: {
|
|
42
|
+
marketContractAddress: `0x${string}`;
|
|
43
|
+
option: bigint;
|
|
44
|
+
optionSide: number;
|
|
45
|
+
userAddress: `0x${string}`;
|
|
46
|
+
}): Promise<bigint>;
|
|
41
47
|
getDynamicPayout(params: {
|
|
42
48
|
marketContractAddress: `0x${string}`;
|
|
43
49
|
userAddress: `0x${string}`;
|
package/dist/Rain.js
CHANGED
|
@@ -17,6 +17,7 @@ import { loginUser } from './auth/login.js';
|
|
|
17
17
|
import { getUserOptionLPShares } from './markets/getUserOptionLPShares.js';
|
|
18
18
|
import { getUserOptionShares } from './markets/getUserOptionShares.js';
|
|
19
19
|
import { getDynamicPayout } from './markets/getDynamicPayout.js';
|
|
20
|
+
import { getUserSharesInEscrow } from './markets/getUserSharesInEscrow.js';
|
|
20
21
|
import { createPublicClient, http, parseAbi } from 'viem';
|
|
21
22
|
import { arbitrum } from 'viem/chains';
|
|
22
23
|
import * as usersApi from './api/users.js';
|
|
@@ -114,6 +115,9 @@ export class Rain {
|
|
|
114
115
|
async getUserOptionShares(params) {
|
|
115
116
|
return getUserOptionShares({ ...params, rpcUrl: this.rpcUrl });
|
|
116
117
|
}
|
|
118
|
+
async getUserSharesInEscrow(params) {
|
|
119
|
+
return getUserSharesInEscrow({ ...params, rpcUrl: this.rpcUrl });
|
|
120
|
+
}
|
|
117
121
|
async getDynamicPayout(params) {
|
|
118
122
|
return getDynamicPayout({ ...params, rpcUrl: this.rpcUrl });
|
|
119
123
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface GetUserSharesInEscrowParams {
|
|
2
|
+
marketContractAddress: `0x${string}`;
|
|
3
|
+
option: bigint;
|
|
4
|
+
optionSide: number;
|
|
5
|
+
userAddress: `0x${string}`;
|
|
6
|
+
rpcUrl: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function getUserSharesInEscrow(params: GetUserSharesInEscrowParams): Promise<bigint>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createPublicClient, http } from 'viem';
|
|
2
|
+
import { arbitrum } from 'viem/chains';
|
|
3
|
+
import { MarketsAbi } from '../abi/MarketsAbi.js';
|
|
4
|
+
export async function getUserSharesInEscrow(params) {
|
|
5
|
+
const { marketContractAddress, option, optionSide, userAddress, rpcUrl } = params;
|
|
6
|
+
const client = createPublicClient({
|
|
7
|
+
chain: arbitrum,
|
|
8
|
+
transport: http(rpcUrl),
|
|
9
|
+
});
|
|
10
|
+
const shares = await client.readContract({
|
|
11
|
+
address: marketContractAddress,
|
|
12
|
+
abi: MarketsAbi,
|
|
13
|
+
functionName: 'userSharesPerSideInEscrow',
|
|
14
|
+
args: [option, optionSide, userAddress],
|
|
15
|
+
});
|
|
16
|
+
return shares;
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rain-sdk-v2",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
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",
|