@polymarket/clob-client-v2 1.1.0 → 1.2.0-canary.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/README.md +16 -0
- package/dist/client.cjs +17 -14
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +17 -14
- package/dist/client.js.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/order-builder/helpers/buildMarketOrderCreationArgs.cjs +3 -2
- package/dist/order-builder/helpers/buildMarketOrderCreationArgs.cjs.map +1 -1
- package/dist/order-builder/helpers/buildMarketOrderCreationArgs.js +3 -2
- package/dist/order-builder/helpers/buildMarketOrderCreationArgs.js.map +1 -1
- package/dist/order-builder/helpers/buildOrderCreationArgs.cjs +3 -2
- package/dist/order-builder/helpers/buildOrderCreationArgs.cjs.map +1 -1
- package/dist/order-builder/helpers/buildOrderCreationArgs.js +3 -2
- package/dist/order-builder/helpers/buildOrderCreationArgs.js.map +1 -1
- package/dist/order-builder/helpers/createMarketOrder.cjs +6 -4
- package/dist/order-builder/helpers/createMarketOrder.cjs.map +1 -1
- package/dist/order-builder/helpers/createMarketOrder.js +6 -4
- package/dist/order-builder/helpers/createMarketOrder.js.map +1 -1
- package/dist/order-builder/helpers/createOrder.cjs +6 -4
- package/dist/order-builder/helpers/createOrder.cjs.map +1 -1
- package/dist/order-builder/helpers/createOrder.js +6 -4
- package/dist/order-builder/helpers/createOrder.js.map +1 -1
- package/dist/order-builder/helpers/orderAsset.cjs +16 -0
- package/dist/order-builder/helpers/orderAsset.cjs.map +1 -0
- package/dist/order-builder/helpers/orderAsset.js +14 -0
- package/dist/order-builder/helpers/orderAsset.js.map +1 -0
- package/dist/order-builder/orderBuilder.cjs +2 -2
- package/dist/order-builder/orderBuilder.cjs.map +1 -1
- package/dist/order-builder/orderBuilder.d.cts +2 -2
- package/dist/order-builder/orderBuilder.d.ts +2 -2
- package/dist/order-builder/orderBuilder.js +2 -2
- package/dist/order-builder/orderBuilder.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/ordersV1.cjs.map +1 -1
- package/dist/types/ordersV1.d.cts +2 -0
- package/dist/types/ordersV1.d.ts +2 -0
- package/dist/types/ordersV1.js.map +1 -1
- package/dist/types/ordersV2.cjs.map +1 -1
- package/dist/types/ordersV2.d.cts +17 -13
- package/dist/types/ordersV2.d.ts +17 -13
- package/dist/types/ordersV2.js.map +1 -1
- package/package.json +1 -1
package/dist/types/ordersV2.d.ts
CHANGED
|
@@ -32,17 +32,23 @@ interface NewOrderV2<T extends OrderType> {
|
|
|
32
32
|
readonly deferExec: boolean;
|
|
33
33
|
readonly postOnly: boolean;
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*/
|
|
35
|
+
/** Identifies the outcome to trade. Provide exactly one identifier. */
|
|
36
|
+
type OrderAsset = {
|
|
37
|
+
/** Token identifier for a CTF outcome. */
|
|
39
38
|
tokenID: string;
|
|
39
|
+
positionID?: never;
|
|
40
|
+
} | {
|
|
41
|
+
/** Position identifier for a Polymarket V2 outcome. */
|
|
42
|
+
positionID: string;
|
|
43
|
+
tokenID?: never;
|
|
44
|
+
};
|
|
45
|
+
type BaseUserOrderV2 = {
|
|
40
46
|
/**
|
|
41
47
|
* Price used to create the order
|
|
42
48
|
*/
|
|
43
49
|
price: number;
|
|
44
50
|
/**
|
|
45
|
-
* Size in
|
|
51
|
+
* Size in outcome shares.
|
|
46
52
|
*/
|
|
47
53
|
size: number;
|
|
48
54
|
/**
|
|
@@ -68,12 +74,9 @@ interface UserOrderV2 {
|
|
|
68
74
|
* This is used for marketable limit orders
|
|
69
75
|
*/
|
|
70
76
|
userUSDCBalance?: number;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
* TokenID of the Conditional token asset being traded
|
|
75
|
-
*/
|
|
76
|
-
tokenID: string;
|
|
77
|
+
};
|
|
78
|
+
type UserOrderV2 = OrderAsset & BaseUserOrderV2;
|
|
79
|
+
type BaseUserMarketOrderV2 = {
|
|
77
80
|
/**
|
|
78
81
|
* Price used to create the order
|
|
79
82
|
* If it is not present the market price will be used.
|
|
@@ -108,7 +111,8 @@ interface UserMarketOrderV2 {
|
|
|
108
111
|
* Builder code (bytes32)
|
|
109
112
|
*/
|
|
110
113
|
builderCode?: string;
|
|
111
|
-
}
|
|
114
|
+
};
|
|
115
|
+
type UserMarketOrderV2 = OrderAsset & BaseUserMarketOrderV2;
|
|
112
116
|
//#endregion
|
|
113
|
-
export { NewOrderV2, PostOrdersV2Args, UserMarketOrderV2, UserOrderV2, orderToJsonV2 };
|
|
117
|
+
export { NewOrderV2, OrderAsset, PostOrdersV2Args, UserMarketOrderV2, UserOrderV2, orderToJsonV2 };
|
|
114
118
|
//# sourceMappingURL=ordersV2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ordersV2.js","names":[],"sources":["../../src/types/ordersV2.ts"],"sourcesContent":["import type { SignatureTypeV2, SignedOrderV2 } from \"../order-utils/index.js\";\n\nimport type { OrderType, Side } from \"./clob.js\";\n\nexport function orderToJsonV2<T extends OrderType>(\n\torder: SignedOrderV2,\n\towner: string,\n\torderType: T,\n\tpostOnly = false,\n\tdeferExec = false,\n): NewOrderV2<T> {\n\treturn {\n\t\tdeferExec,\n\t\tpostOnly,\n\t\torder: {\n\t\t\tsalt: parseInt(order.salt, 10),\n\t\t\tmaker: order.maker,\n\t\t\tsigner: order.signer,\n\t\t\ttaker: order.taker,\n\t\t\ttokenId: order.tokenId,\n\t\t\tmakerAmount: order.makerAmount,\n\t\t\ttakerAmount: order.takerAmount,\n\t\t\tside: order.side,\n\t\t\tsignatureType: order.signatureType,\n\t\t\ttimestamp: order.timestamp,\n\t\t\texpiration: order.expiration,\n\t\t\tmetadata: order.metadata,\n\t\t\tbuilder: order.builder,\n\t\t\tsignature: order.signature,\n\t\t},\n\t\towner,\n\t\torderType,\n\t} as NewOrderV2<T>;\n}\n\nexport interface PostOrdersV2Args {\n\torder: SignedOrderV2;\n\torderType: OrderType;\n}\n\nexport interface NewOrderV2<T extends OrderType> {\n\treadonly order: {\n\t\treadonly salt: number;\n\t\treadonly maker: string;\n\t\treadonly signer: string;\n\t\treadonly taker: string;\n\t\treadonly tokenId: string;\n\t\treadonly makerAmount: string;\n\t\treadonly takerAmount: string;\n\t\treadonly side: string;\n\t\treadonly signatureType: SignatureTypeV2;\n\t\treadonly timestamp: string;\n\t\treadonly expiration: string;\n\t\treadonly metadata: string;\n\t\treadonly builder: string;\n\t\treadonly signature: string;\n\t};\n\treadonly owner: string;\n\treadonly orderType: T;\n\treadonly deferExec: boolean;\n\treadonly postOnly: boolean;\n}\n\n
|
|
1
|
+
{"version":3,"file":"ordersV2.js","names":[],"sources":["../../src/types/ordersV2.ts"],"sourcesContent":["import type { SignatureTypeV2, SignedOrderV2 } from \"../order-utils/index.js\";\n\nimport type { OrderType, Side } from \"./clob.js\";\n\nexport function orderToJsonV2<T extends OrderType>(\n\torder: SignedOrderV2,\n\towner: string,\n\torderType: T,\n\tpostOnly = false,\n\tdeferExec = false,\n): NewOrderV2<T> {\n\treturn {\n\t\tdeferExec,\n\t\tpostOnly,\n\t\torder: {\n\t\t\tsalt: parseInt(order.salt, 10),\n\t\t\tmaker: order.maker,\n\t\t\tsigner: order.signer,\n\t\t\ttaker: order.taker,\n\t\t\ttokenId: order.tokenId,\n\t\t\tmakerAmount: order.makerAmount,\n\t\t\ttakerAmount: order.takerAmount,\n\t\t\tside: order.side,\n\t\t\tsignatureType: order.signatureType,\n\t\t\ttimestamp: order.timestamp,\n\t\t\texpiration: order.expiration,\n\t\t\tmetadata: order.metadata,\n\t\t\tbuilder: order.builder,\n\t\t\tsignature: order.signature,\n\t\t},\n\t\towner,\n\t\torderType,\n\t} as NewOrderV2<T>;\n}\n\nexport interface PostOrdersV2Args {\n\torder: SignedOrderV2;\n\torderType: OrderType;\n}\n\nexport interface NewOrderV2<T extends OrderType> {\n\treadonly order: {\n\t\treadonly salt: number;\n\t\treadonly maker: string;\n\t\treadonly signer: string;\n\t\treadonly taker: string;\n\t\treadonly tokenId: string;\n\t\treadonly makerAmount: string;\n\t\treadonly takerAmount: string;\n\t\treadonly side: string;\n\t\treadonly signatureType: SignatureTypeV2;\n\t\treadonly timestamp: string;\n\t\treadonly expiration: string;\n\t\treadonly metadata: string;\n\t\treadonly builder: string;\n\t\treadonly signature: string;\n\t};\n\treadonly owner: string;\n\treadonly orderType: T;\n\treadonly deferExec: boolean;\n\treadonly postOnly: boolean;\n}\n\n/** Identifies the outcome to trade. Provide exactly one identifier. */\nexport type OrderAsset =\n\t| {\n\t\t\t/** Token identifier for a CTF outcome. */\n\t\t\ttokenID: string;\n\t\t\tpositionID?: never;\n\t }\n\t| {\n\t\t\t/** Position identifier for a Polymarket V2 outcome. */\n\t\t\tpositionID: string;\n\t\t\ttokenID?: never;\n\t };\n\n// Simplified order for users\ntype BaseUserOrderV2 = {\n\t/**\n\t * Price used to create the order\n\t */\n\tprice: number;\n\n\t/**\n\t * Size in outcome shares.\n\t */\n\tsize: number;\n\n\t/**\n\t * Side of the order\n\t */\n\tside: Side;\n\n\t/**\n\t * Metadata (bytes32)\n\t */\n\tmetadata?: string;\n\n\t/**\n\t * Builder code (bytes32)\n\t */\n\tbuilderCode?: string;\n\n\t/**\n\t * Expiration timestamp (unix seconds). Defaults to 0 (no expiration).\n\t */\n\texpiration?: number;\n\n\t/**\n\t * User's USDC balance. If provided and sufficient to cover amount + fees, the order\n\t * size is used as-is. Otherwise fees are deducted from the order notional and size is reduced.\n\t * If this field is left empty, the default flow is to use the order size as-is.\n\t * This is used for marketable limit orders\n\t */\n\tuserUSDCBalance?: number;\n};\n\nexport type UserOrderV2 = OrderAsset & BaseUserOrderV2;\n\n// Simplified market order for users\ntype BaseUserMarketOrderV2 = {\n\t/**\n\t * Price used to create the order\n\t * If it is not present the market price will be used.\n\t */\n\tprice?: number;\n\n\t/**\n\t * BUY orders: $$$ Amount to buy\n\t * SELL orders: Shares to sell\n\t */\n\tamount: number;\n\n\t/**\n\t * Side of the order\n\t */\n\tside: Side;\n\n\t/**\n\t * Specifies the type of order execution:\n\t * - FOK (Fill or Kill): The order must be filled entirely or not at all.\n\t * - FAK (Fill and Kill): The order can be partially filled, and any unfilled portion is canceled.\n\t */\n\torderType?: OrderType.FOK | OrderType.FAK;\n\n\t/**\n\t * User's USDC balance. If provided and sufficient to cover amount + fees, the order\n\t * amount is used as-is. Otherwise fees are deducted from the amount.\n\t * If this field is left empty, the default flow is to use the order amount as-is\n\t */\n\tuserUSDCBalance?: number;\n\n\t/**\n\t * Metadata (bytes32)\n\t */\n\tmetadata?: string;\n\n\t/**\n\t * Builder code (bytes32)\n\t */\n\tbuilderCode?: string;\n};\n\nexport type UserMarketOrderV2 = OrderAsset & BaseUserMarketOrderV2;\n"],"mappings":";AAIA,SAAgB,cACf,OACA,OACA,WACA,WAAW,OACX,YAAY,OACI;AAChB,QAAO;EACN;EACA;EACA,OAAO;GACN,MAAM,SAAS,MAAM,MAAM,GAAG;GAC9B,OAAO,MAAM;GACb,QAAQ,MAAM;GACd,OAAO,MAAM;GACb,SAAS,MAAM;GACf,aAAa,MAAM;GACnB,aAAa,MAAM;GACnB,MAAM,MAAM;GACZ,eAAe,MAAM;GACrB,WAAW,MAAM;GACjB,YAAY,MAAM;GAClB,UAAU,MAAM;GAChB,SAAS,MAAM;GACf,WAAW,MAAM;GACjB;EACD;EACA;EACA"}
|