rain-sdk-v2 2.5.1 → 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 +14 -0
- package/README.md +17 -0
- package/dist/api/dispute.js +0 -3
- package/dist/api/helpers.js +0 -3
- package/dist/auth/login.js +0 -1
- package/dist/tx/CreateMarket/helpers.js +0 -1
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,20 @@ 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
|
+
|
|
12
26
|
## [2.5.1] - Add LICENSE
|
|
13
27
|
|
|
14
28
|
### Added
|
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
|
package/dist/api/dispute.js
CHANGED
|
@@ -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',
|
package/dist/api/helpers.js
CHANGED
package/dist/auth/login.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rain-sdk-v2",
|
|
3
|
-
"version": "2.5.
|
|
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
|
-
"
|
|
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"
|