@rainprotocolsdk/sdk 1.0.0 → 1.0.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/README.md +191 -0
- package/dist/Rain.d.ts +2 -1
- package/dist/Rain.js +4 -0
- package/dist/{Rainaa.d.ts → RainAA.d.ts} +1 -1
- package/dist/{Rainaa.js → RainAA.js} +1 -2
- package/dist/abi/ERC20Abi.d.ts +594 -0
- package/dist/abi/ERC20Abi.js +772 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/markets/getMarkets.js +4 -4
- package/dist/markets/types.d.ts +1 -1
- package/dist/tx/buildApprovalRawTx.d.ts +2 -0
- package/dist/tx/buildApprovalRawTx.js +20 -0
- package/dist/tx/types.d.ts +6 -0
- package/dist/types.d.ts +2 -2
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export async function getMarkets(params) {
|
|
2
2
|
const query = new URLSearchParams();
|
|
3
3
|
const apiBaseUrl = 'https://dev-api.rain.one'; // Dev API base URL
|
|
4
|
-
if (params
|
|
4
|
+
if (params?.limit)
|
|
5
5
|
query.append('limit', params.limit.toString());
|
|
6
|
-
if (params
|
|
6
|
+
if (params?.offset)
|
|
7
7
|
query.append('offset', params.offset.toString());
|
|
8
|
-
if (params
|
|
8
|
+
if (params?.sortBy)
|
|
9
9
|
query.append('sortBy', params.sortBy);
|
|
10
|
-
if (params
|
|
10
|
+
if (params?.status)
|
|
11
11
|
query.append('status', params.status);
|
|
12
12
|
const res = await fetch(`${apiBaseUrl}/pools/public-pools?${query.toString()}`);
|
|
13
13
|
if (!res.ok) {
|
package/dist/markets/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type MarketStatus = 'Live' | 'Closed' | '
|
|
1
|
+
export type MarketStatus = 'Live' | 'New' | 'Closing Soon' | 'Closed' | 'pending finalization';
|
|
2
2
|
export type MarketSortBy = 'totalVolume' | 'createdAt' | 'endTime';
|
|
3
3
|
export interface GetMarketsParams {
|
|
4
4
|
limit?: number;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { encodeFunctionData } from "viem";
|
|
2
|
+
import { ERC20Abi } from "../abi/ERC20Abi";
|
|
3
|
+
import { ethers } from "ethers";
|
|
4
|
+
const DEFAULT_APPROVE_AMOUNT = ethers.MaxUint256;
|
|
5
|
+
export function buildApproveRawTx(params) {
|
|
6
|
+
const { tokenAddress, spender, amount = DEFAULT_APPROVE_AMOUNT, } = params;
|
|
7
|
+
if (!params.tokenAddress)
|
|
8
|
+
throw new Error("token address is required");
|
|
9
|
+
if (!params.spender)
|
|
10
|
+
throw new Error("spender address is required");
|
|
11
|
+
return {
|
|
12
|
+
to: tokenAddress,
|
|
13
|
+
data: encodeFunctionData({
|
|
14
|
+
abi: ERC20Abi,
|
|
15
|
+
functionName: "approve",
|
|
16
|
+
args: [spender, amount],
|
|
17
|
+
}),
|
|
18
|
+
value: 0n,
|
|
19
|
+
};
|
|
20
|
+
}
|
package/dist/tx/types.d.ts
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { WalletClient } from 'viem';
|
|
|
2
2
|
import { Chain } from 'viem/chains';
|
|
3
3
|
export interface RainConfig {
|
|
4
4
|
walletClient: WalletClient;
|
|
5
|
-
alchemyApiKey
|
|
6
|
-
paymasterPolicyId
|
|
5
|
+
alchemyApiKey?: string;
|
|
6
|
+
paymasterPolicyId?: string;
|
|
7
7
|
chain: Chain;
|
|
8
8
|
rpcUrl?: string;
|
|
9
9
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rainprotocolsdk/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Rain SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"@account-kit/infra": "^4.48.0",
|
|
30
30
|
"@account-kit/wallet-client": "^0.1.0-alpha.10",
|
|
31
31
|
"@alchemy/aa-alchemy": "^3.0.0",
|
|
32
|
-
"@alchemy/aa-core": "^3.0.0"
|
|
32
|
+
"@alchemy/aa-core": "^3.0.0",
|
|
33
|
+
"ethers": "^6.16.0"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"typescript": "^5.9.3"
|