rain-sdk-v2 2.5.0 → 2.5.2

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/CHANGELOG.md CHANGED
@@ -9,6 +9,26 @@ APIs slated for removal are marked `@deprecated` in the type declarations for at
9
9
  least one minor release before they are removed, with the replacement named in
10
10
  the deprecation notice. Breaking removals land only in a major version.
11
11
 
12
+ ## Security
13
+
14
+ Versions `< 2.5.0` are **deprecated on npm** — they build sell transactions with no
15
+ slippage protection by default (fixed in 2.5.0). See the Security notice in the
16
+ README and the 2.5.0 entry below. Upgrade to `>= 2.5.0`.
17
+
18
+ ## [2.5.2] - Remove ngrok dev header
19
+
20
+ ### Removed
21
+ - Dropped the `ngrok-skip-browser-warning` header handling from all request paths
22
+ (`buildHeaders`, dispute upload, login, IPFS metadata upload). It was a dev-tunnel
23
+ convenience gated behind `apiUrl.includes('ngrok')` and never fired against real
24
+ environments. No behavior change for non-ngrok usage.
25
+
26
+ ## [2.5.1] - Add LICENSE
27
+
28
+ ### Added
29
+ - MIT `LICENSE` file at the repo root so GitHub detects the license (npm already
30
+ declared MIT). No code changes.
31
+
12
32
  ## [2.5.0] - Sell slippage + create-market validation
13
33
 
14
34
  ### Fixed
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rain Protocol
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  TypeScript SDK for the Rain prediction markets protocol on Arbitrum One. Provides transaction builders for market creation, trading, liquidity management, order book operations, dispute resolution, and smart account (Account Abstraction) support.
4
4
 
5
+ ## ⚠️ Security notice — upgrade to >= 2.5.0
6
+
7
+ Versions **below 2.5.0** build **sell** transactions with no slippage protection by
8
+ default: `buildSellOptionTx` defaulted `minAmountOut` to `0` and the documented
9
+ `slippageTolerance` option was ignored, exposing sells to MEV/sandwich loss.
10
+ **Fixed in 2.5.0** — sells now quote `getSellProceeds` on-chain and apply
11
+ `slippageTolerance` (default 5%). Versions `<2.5.0` are deprecated on npm.
12
+
13
+ Migration is one line: **`buildSellOptionTx` is now async** — add `await`.
14
+
15
+ ```typescript
16
+ // before (< 2.5.0)
17
+ const tx = rain.buildSellOptionTx({ /* ... */ });
18
+ // after (>= 2.5.0)
19
+ const tx = await rain.buildSellOptionTx({ /* ... */ });
20
+ ```
21
+
5
22
  ## Installation
6
23
 
7
24
  ```bash
@@ -15,9 +15,6 @@ export async function createDisputeMessage(params, config) {
15
15
  if (config.accessToken) {
16
16
  headers['Authorization'] = `Bearer ${config.accessToken}`;
17
17
  }
18
- if (config.apiUrl?.includes('ngrok')) {
19
- headers['ngrok-skip-browser-warning'] = 'true';
20
- }
21
18
  // Do not set Content-Type for FormData; the browser sets the boundary automatically.
22
19
  const res = await fetch(`${config.apiUrl}/dispute/create-dispute-message`, {
23
20
  method: 'POST',
@@ -1,8 +1,5 @@
1
1
  export function buildHeaders(config, contentType) {
2
2
  const headers = {};
3
- if (config.apiUrl?.includes('ngrok')) {
4
- headers['ngrok-skip-browser-warning'] = 'true';
5
- }
6
3
  if (contentType) {
7
4
  headers['Content-Type'] = contentType;
8
5
  }
@@ -21,7 +21,6 @@ export async function loginUser(params) {
21
21
  method: 'POST',
22
22
  headers: {
23
23
  'Content-Type': 'application/json',
24
- ...(apiUrl.includes('ngrok') ? { 'ngrok-skip-browser-warning': 'true' } : {}),
25
24
  },
26
25
  body: JSON.stringify({
27
26
  sign: signature,
@@ -29,7 +29,6 @@ export async function uploadMetaData(params) {
29
29
  method: "POST",
30
30
  headers: {
31
31
  "Content-Type": "application/json",
32
- ...(apiUrl?.includes('ngrok') ? { "ngrok-skip-browser-warning": "true" } : {}),
33
32
  },
34
33
  body: JSON.stringify(metadata),
35
34
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rain-sdk-v2",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
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",
@@ -22,7 +22,8 @@
22
22
  "test": "vitest run",
23
23
  "test:watch": "vitest",
24
24
  "test:integration": "RUN_INTEGRATION=1 vitest run test/integration.test.ts",
25
- "prepublishOnly": "npm run build"
25
+ "test:coverage": "vitest run --coverage",
26
+ "prepublishOnly": "npm run build && npm test"
26
27
  },
27
28
  "repository": {
28
29
  "type": "git",
@@ -63,6 +64,7 @@
63
64
  "socket.io-client": "^4.8.3"
64
65
  },
65
66
  "devDependencies": {
67
+ "@vitest/coverage-v8": "^5.0.1",
66
68
  "typescript": "^5.9.3",
67
69
  "viem": "^2.48.8",
68
70
  "vitest": "^5.0.1"