@varla/polymarket 2.2.5 → 2.3.0
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 +16 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/resolver.d.ts +10 -0
- package/dist/resolver.d.ts.map +1 -1
- package/dist/utils/url.d.ts +11 -0
- package/dist/utils/url.d.ts.map +1 -0
- package/package.json +2 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @varla/polymarket
|
|
2
2
|
|
|
3
|
+
## 2.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 70422c9: Added Polymarket event URL utilities and enriched resolved market data with event slug and URL fields.
|
|
8
|
+
|
|
9
|
+
- export polymarketEventUrl for constructing Polymarket event links,- include eventSlug and url on ResolvedBinaryMarket results using event slug when available
|
|
10
|
+
|
|
11
|
+
## 2.2.6
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- f149b83: Apply minor package metadata formatting cleanup without functional changes.
|
|
16
|
+
|
|
17
|
+
- Reformat the package files list for consistency
|
|
18
|
+
|
|
3
19
|
## 2.2.5
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -19,5 +19,6 @@ export * from "./rate-limits.js";
|
|
|
19
19
|
export { parseDecimalToBigint } from "./utils/decimal.js";
|
|
20
20
|
export { twapFromHistory } from "./utils/twap.js";
|
|
21
21
|
export { probToE8, collateralPriceFromMarkets } from "./utils/pricing.js";
|
|
22
|
+
export { polymarketEventUrl } from "./utils/url.js";
|
|
22
23
|
export * from "./bridge-client.js";
|
|
23
24
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceR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;AAMjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAMpD,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1584,6 +1584,12 @@ function chunk(xs, size) {
|
|
|
1584
1584
|
out.push(xs.slice(i, i + size));
|
|
1585
1585
|
return out;
|
|
1586
1586
|
}
|
|
1587
|
+
// src/utils/url.ts
|
|
1588
|
+
var POLYMARKET_BASE = "https://polymarket.com/event";
|
|
1589
|
+
function polymarketEventUrl(slug) {
|
|
1590
|
+
return `${POLYMARKET_BASE}/${encodeURIComponent(slug)}`;
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1587
1593
|
// src/resolver.ts
|
|
1588
1594
|
function parseJsonStringArray(field, value) {
|
|
1589
1595
|
const parsed = JSON.parse(value);
|
|
@@ -1606,10 +1612,13 @@ function resolveBinaryMarketFromGammaMarket(m) {
|
|
|
1606
1612
|
if (yesIdx === -1 || noIdx === -1) {
|
|
1607
1613
|
throw new Error(`Gamma market ${m.id} outcomes are not Yes/No: ${outcomes.join(",")}`);
|
|
1608
1614
|
}
|
|
1615
|
+
const eventSlug = m.events?.[0]?.slug;
|
|
1609
1616
|
return {
|
|
1610
1617
|
conditionId: m.conditionId,
|
|
1611
1618
|
gammaMarketId: m.id,
|
|
1612
1619
|
slug: m.slug,
|
|
1620
|
+
eventSlug,
|
|
1621
|
+
url: polymarketEventUrl(eventSlug ?? m.slug),
|
|
1613
1622
|
yesTokenId: tokenIds[yesIdx] ?? (() => {
|
|
1614
1623
|
throw new Error(`Missing YES tokenId for market ${m.id}`);
|
|
1615
1624
|
})(),
|
|
@@ -3283,6 +3292,7 @@ export {
|
|
|
3283
3292
|
resetClobClient,
|
|
3284
3293
|
probToE8,
|
|
3285
3294
|
priceValid,
|
|
3295
|
+
polymarketEventUrl,
|
|
3286
3296
|
parseRetryAfter,
|
|
3287
3297
|
parseDecimalToBigint,
|
|
3288
3298
|
isValidPrice,
|
package/dist/resolver.d.ts
CHANGED
|
@@ -3,7 +3,17 @@ import type { GammaMarket } from "./types.js";
|
|
|
3
3
|
export type ResolvedBinaryMarket = {
|
|
4
4
|
conditionId: `0x${string}`;
|
|
5
5
|
gammaMarketId: string;
|
|
6
|
+
/** Market-level slug from Gamma API. */
|
|
6
7
|
slug: string;
|
|
8
|
+
/** Parent event slug (when the Gamma response includes nested events). */
|
|
9
|
+
eventSlug?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Best-effort Polymarket UI link.
|
|
12
|
+
* Constructed as `https://polymarket.com/event/<eventSlug ?? slug>`.
|
|
13
|
+
* Uses the event slug when available (correct for Polymarket routing),
|
|
14
|
+
* falls back to the market slug otherwise.
|
|
15
|
+
*/
|
|
16
|
+
url: string;
|
|
7
17
|
yesTokenId: string;
|
|
8
18
|
noTokenId: string;
|
|
9
19
|
endDateIso?: string;
|
package/dist/resolver.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAS,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAS,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG9C,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAUF,wBAAgB,kCAAkC,CAAC,CAAC,EAAE,WAAW,GAAG,oBAAoB,CAsCvF;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,CACJ,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,EAC1C,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC7B,IAAI,CAAC;CACX,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,iCAAiC,CACrD,YAAY,EAAE,KAAK,MAAM,EAAE,EAAE,EAC7B,IAAI,GAAE,qBAA0B,GAC/B,OAAO,CAAC,GAAG,CAAC,KAAK,MAAM,EAAE,EAAE,oBAAoB,CAAC,CAAC,CA4BnD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Construct a full Polymarket event URL from a Gamma slug.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* polymarketEventUrl("will-bitcoin-hit-1m-before-gta-vi")
|
|
7
|
+
* // => "https://polymarket.com/event/will-bitcoin-hit-1m-before-gta-vi"
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
10
|
+
export declare function polymarketEventUrl(slug: string): string;
|
|
11
|
+
//# sourceMappingURL=url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varla/polymarket",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "High-performance Polymarket SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -11,13 +11,7 @@
|
|
|
11
11
|
"import": "./dist/index.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
-
"files": [
|
|
15
|
-
"dist",
|
|
16
|
-
"README.md",
|
|
17
|
-
"AGENTS.md",
|
|
18
|
-
"CHANGELOG.md",
|
|
19
|
-
"LICENSE"
|
|
20
|
-
],
|
|
14
|
+
"files": ["dist", "README.md", "AGENTS.md", "CHANGELOG.md", "LICENSE"],
|
|
21
15
|
"scripts": {
|
|
22
16
|
"build": "bun build ./src/index.ts --outdir ./dist --target node --format esm",
|
|
23
17
|
"build:types": "bun x tsc --emitDeclarationOnly --declaration --outDir dist || true",
|