@polymarket/clob-client-v2 1.0.6 → 1.0.8

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.
Files changed (67) hide show
  1. package/README.md +3 -0
  2. package/dist/client.cjs +9 -3
  3. package/dist/client.cjs.map +1 -1
  4. package/dist/client.d.cts +2 -0
  5. package/dist/client.d.ts +2 -0
  6. package/dist/client.js +9 -3
  7. package/dist/client.js.map +1 -1
  8. package/dist/config.cjs +4 -2
  9. package/dist/config.cjs.map +1 -1
  10. package/dist/config.d.cts +1 -0
  11. package/dist/config.d.ts +1 -0
  12. package/dist/config.js +4 -2
  13. package/dist/config.js.map +1 -1
  14. package/dist/index.d.cts +3 -2
  15. package/dist/index.d.ts +3 -2
  16. package/dist/order-builder/helpers/buildMarketOrderCreationArgs.cjs.map +1 -1
  17. package/dist/order-builder/helpers/buildMarketOrderCreationArgs.js.map +1 -1
  18. package/dist/order-builder/helpers/buildOrder.cjs +4 -0
  19. package/dist/order-builder/helpers/buildOrder.cjs.map +1 -1
  20. package/dist/order-builder/helpers/buildOrder.js +5 -1
  21. package/dist/order-builder/helpers/buildOrder.js.map +1 -1
  22. package/dist/order-builder/helpers/buildOrderCreationArgs.cjs.map +1 -1
  23. package/dist/order-builder/helpers/buildOrderCreationArgs.js.map +1 -1
  24. package/dist/order-builder/helpers/createExchangeV3OrderFromAmounts.cjs +31 -0
  25. package/dist/order-builder/helpers/createExchangeV3OrderFromAmounts.cjs.map +1 -0
  26. package/dist/order-builder/helpers/createExchangeV3OrderFromAmounts.js +31 -0
  27. package/dist/order-builder/helpers/createExchangeV3OrderFromAmounts.js.map +1 -0
  28. package/dist/order-builder/helpers/createMarketOrder.cjs +3 -0
  29. package/dist/order-builder/helpers/createMarketOrder.cjs.map +1 -1
  30. package/dist/order-builder/helpers/createMarketOrder.js +3 -0
  31. package/dist/order-builder/helpers/createMarketOrder.js.map +1 -1
  32. package/dist/order-builder/helpers/createOrder.cjs +3 -0
  33. package/dist/order-builder/helpers/createOrder.cjs.map +1 -1
  34. package/dist/order-builder/helpers/createOrder.js +3 -0
  35. package/dist/order-builder/helpers/createOrder.js.map +1 -1
  36. package/dist/order-builder/helpers/roundingConfig.cjs +10 -0
  37. package/dist/order-builder/helpers/roundingConfig.cjs.map +1 -1
  38. package/dist/order-builder/helpers/roundingConfig.js +10 -0
  39. package/dist/order-builder/helpers/roundingConfig.js.map +1 -1
  40. package/dist/order-builder/orderBuilder.cjs +7 -0
  41. package/dist/order-builder/orderBuilder.cjs.map +1 -1
  42. package/dist/order-builder/orderBuilder.d.cts +5 -0
  43. package/dist/order-builder/orderBuilder.d.ts +5 -0
  44. package/dist/order-builder/orderBuilder.js +7 -0
  45. package/dist/order-builder/orderBuilder.js.map +1 -1
  46. package/dist/order-utils/exchangeOrderBuilderV2.cjs +11 -5
  47. package/dist/order-utils/exchangeOrderBuilderV2.cjs.map +1 -1
  48. package/dist/order-utils/exchangeOrderBuilderV2.js +12 -7
  49. package/dist/order-utils/exchangeOrderBuilderV2.js.map +1 -1
  50. package/dist/order-utils/model/ctfExchangeV2TypedData.cjs +2 -0
  51. package/dist/order-utils/model/ctfExchangeV2TypedData.cjs.map +1 -1
  52. package/dist/order-utils/model/ctfExchangeV2TypedData.js +2 -1
  53. package/dist/order-utils/model/ctfExchangeV2TypedData.js.map +1 -1
  54. package/dist/types/clob.cjs.map +1 -1
  55. package/dist/types/clob.d.cts +4 -2
  56. package/dist/types/clob.d.ts +4 -2
  57. package/dist/types/clob.js.map +1 -1
  58. package/dist/types/index.d.ts +2 -1
  59. package/dist/types/ordersV3.d.cts +43 -0
  60. package/dist/types/ordersV3.d.ts +43 -0
  61. package/dist/types/unifiedOrder.cjs +1 -1
  62. package/dist/types/unifiedOrder.cjs.map +1 -1
  63. package/dist/types/unifiedOrder.d.cts +12 -0
  64. package/dist/types/unifiedOrder.d.ts +12 -0
  65. package/dist/types/unifiedOrder.js +1 -1
  66. package/dist/types/unifiedOrder.js.map +1 -1
  67. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"exchangeOrderBuilderV2.js","names":["contractAddress: string","chainId: number","signer: ClobSigner"],"sources":["../../src/order-utils/exchangeOrderBuilderV2.ts"],"sourcesContent":["import { type Address, encodeAbiParameters, hashTypedData, keccak256, toHex } from \"viem\";\n\nimport { bytes32Zero } from \"../constants.js\";\nimport { type ClobSigner, getSignerAddress, signTypedDataWithSigner } from \"../signing/signer.js\";\nimport {\n\tCTF_EXCHANGE_V2_DOMAIN_NAME,\n\tCTF_EXCHANGE_V2_DOMAIN_VERSION,\n\tCTF_EXCHANGE_V2_ORDER_STRUCT,\n} from \"./model/ctfExchangeV2TypedData.js\";\nimport { EIP712_DOMAIN, type EIP712TypedData } from \"./model/eip712.js\";\nimport type { OrderHash, OrderSignature } from \"./model/order.js\";\nimport type { OrderDataV2, OrderV2, SignedOrderV2 } from \"./model/orderDataV2.js\";\nimport { SignatureTypeV2 } from \"./model/signatureTypeV2.js\";\nimport { generateOrderSalt } from \"./utils.js\";\n\nconst ORDER_TYPE_STRING =\n\t\"Order(uint256 salt,address maker,address signer,uint256 tokenId,uint256 makerAmount,uint256 takerAmount,uint8 side,uint8 signatureType,uint256 timestamp,bytes32 metadata,bytes32 builder)\";\n\nconst ORDER_TYPE_HASH = keccak256(toHex(ORDER_TYPE_STRING));\n\nconst DOMAIN_TYPE_HASH = keccak256(\n\ttoHex(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\n);\n\nconst TYPED_DATA_SIGN_STRUCT = [\n\t{ name: \"contents\", type: \"Order\" },\n\t{ name: \"name\", type: \"string\" },\n\t{ name: \"version\", type: \"string\" },\n\t{ name: \"chainId\", type: \"uint256\" },\n\t{ name: \"verifyingContract\", type: \"address\" },\n\t{ name: \"salt\", type: \"bytes32\" },\n];\n\nconst CTF_EXCHANGE_NAME_HASH = keccak256(toHex(CTF_EXCHANGE_V2_DOMAIN_NAME));\nconst CTF_EXCHANGE_VERSION_HASH = keccak256(toHex(CTF_EXCHANGE_V2_DOMAIN_VERSION));\n\nexport class ExchangeOrderBuilderV2 {\n\tprivate readonly appDomainSep: `0x${string}`;\n\n\tconstructor(\n\t\tprivate readonly contractAddress: string,\n\t\tprivate readonly chainId: number,\n\t\tprivate readonly signer: ClobSigner,\n\t\tprivate readonly generateSalt = generateOrderSalt,\n\t) {\n\t\tthis.appDomainSep = keccak256(\n\t\t\tencodeAbiParameters(\n\t\t\t\t[\n\t\t\t\t\t{ type: \"bytes32\" },\n\t\t\t\t\t{ type: \"bytes32\" },\n\t\t\t\t\t{ type: \"bytes32\" },\n\t\t\t\t\t{ type: \"uint256\" },\n\t\t\t\t\t{ type: \"address\" },\n\t\t\t\t],\n\t\t\t\t[\n\t\t\t\t\tDOMAIN_TYPE_HASH,\n\t\t\t\t\tCTF_EXCHANGE_NAME_HASH,\n\t\t\t\t\tCTF_EXCHANGE_VERSION_HASH,\n\t\t\t\t\tBigInt(chainId),\n\t\t\t\t\tcontractAddress as Address,\n\t\t\t\t],\n\t\t\t),\n\t\t);\n\t}\n\n\tasync buildSignedOrder(orderData: OrderDataV2): Promise<SignedOrderV2> {\n\t\tconst order = await this.buildOrder(orderData);\n\t\tconst orderTypedData = this.buildOrderTypedData(order);\n\t\tconst orderSignature = await this.buildOrderSignature(orderTypedData);\n\n\t\treturn {\n\t\t\t...order,\n\t\t\tsignature: orderSignature,\n\t\t} as SignedOrderV2;\n\t}\n\n\tasync buildOrder({\n\t\tmaker,\n\t\ttokenId,\n\t\tmakerAmount,\n\t\ttakerAmount,\n\t\tside,\n\t\tsigner,\n\t\tsignatureType,\n\t\ttimestamp,\n\t\tmetadata,\n\t\tbuilder,\n\t\texpiration,\n\t}: OrderDataV2): Promise<OrderV2> {\n\t\tif (!signer) {\n\t\t\tsigner = maker;\n\t\t}\n\n\t\t// For POLY_1271 (deposit wallets), signer is the wallet contract — skip EOA address check\n\t\tif (signatureType !== SignatureTypeV2.POLY_1271) {\n\t\t\tconst signerAddress = await getSignerAddress(this.signer);\n\t\t\tif (signer !== signerAddress) {\n\t\t\t\tthrow new Error(\"signer does not match\");\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tsalt: this.generateSalt(),\n\t\t\tmaker,\n\t\t\tsigner,\n\t\t\ttokenId,\n\t\t\tmakerAmount,\n\t\t\ttakerAmount,\n\t\t\tside,\n\t\t\tsignatureType: signatureType ?? SignatureTypeV2.EOA,\n\t\t\tmetadata: metadata ?? bytes32Zero,\n\t\t\tbuilder: builder ?? bytes32Zero,\n\t\t\ttimestamp: timestamp ?? Date.now().toString(),\n\t\t\texpiration: expiration ?? \"0\",\n\t\t};\n\t}\n\n\tbuildOrderTypedData(order: OrderV2): EIP712TypedData {\n\t\treturn {\n\t\t\tprimaryType: \"Order\",\n\t\t\ttypes: {\n\t\t\t\tEIP712Domain: EIP712_DOMAIN,\n\t\t\t\tOrder: CTF_EXCHANGE_V2_ORDER_STRUCT,\n\t\t\t},\n\t\t\tdomain: {\n\t\t\t\tname: CTF_EXCHANGE_V2_DOMAIN_NAME,\n\t\t\t\tversion: CTF_EXCHANGE_V2_DOMAIN_VERSION,\n\t\t\t\tchainId: this.chainId,\n\t\t\t\tverifyingContract: this.contractAddress,\n\t\t\t},\n\t\t\tmessage: {\n\t\t\t\tsalt: order.salt,\n\t\t\t\tmaker: order.maker,\n\t\t\t\tsigner: order.signer,\n\t\t\t\ttokenId: order.tokenId,\n\t\t\t\tmakerAmount: order.makerAmount,\n\t\t\t\ttakerAmount: order.takerAmount,\n\t\t\t\ttimestamp: order.timestamp,\n\t\t\t\tside: order.side === \"BUY\" ? 0 : 1,\n\t\t\t\tsignatureType: order.signatureType,\n\t\t\t\tmetadata: order.metadata,\n\t\t\t\tbuilder: order.builder,\n\t\t\t},\n\t\t};\n\t}\n\n\tasync buildOrderSignature(typedData: EIP712TypedData): Promise<OrderSignature> {\n\t\tdelete typedData.types.EIP712Domain;\n\n\t\tconst msg = typedData.message;\n\n\t\tif ((msg.signatureType as number) !== SignatureTypeV2.POLY_1271) {\n\t\t\treturn signTypedDataWithSigner({\n\t\t\t\tsigner: this.signer,\n\t\t\t\tdomain: typedData.domain,\n\t\t\t\ttypes: typedData.types,\n\t\t\t\tvalue: typedData.message,\n\t\t\t\tprimaryType: typedData.primaryType,\n\t\t\t});\n\t\t}\n\n\t\tconst contentsHash = keccak256(\n\t\t\tencodeAbiParameters(\n\t\t\t\t[\n\t\t\t\t\t{ type: \"bytes32\" },\n\t\t\t\t\t{ type: \"uint256\" },\n\t\t\t\t\t{ type: \"address\" },\n\t\t\t\t\t{ type: \"address\" },\n\t\t\t\t\t{ type: \"uint256\" },\n\t\t\t\t\t{ type: \"uint256\" },\n\t\t\t\t\t{ type: \"uint256\" },\n\t\t\t\t\t{ type: \"uint8\" },\n\t\t\t\t\t{ type: \"uint8\" },\n\t\t\t\t\t{ type: \"uint256\" },\n\t\t\t\t\t{ type: \"bytes32\" },\n\t\t\t\t\t{ type: \"bytes32\" },\n\t\t\t\t],\n\t\t\t\t[\n\t\t\t\t\tORDER_TYPE_HASH,\n\t\t\t\t\tBigInt(msg.salt as string),\n\t\t\t\t\tmsg.maker as Address,\n\t\t\t\t\tmsg.signer as Address,\n\t\t\t\t\tBigInt(msg.tokenId as string),\n\t\t\t\t\tBigInt(msg.makerAmount as string),\n\t\t\t\t\tBigInt(msg.takerAmount as string),\n\t\t\t\t\tmsg.side as number,\n\t\t\t\t\tmsg.signatureType as number,\n\t\t\t\t\tBigInt(msg.timestamp as string),\n\t\t\t\t\tmsg.metadata as `0x${string}`,\n\t\t\t\t\tmsg.builder as `0x${string}`,\n\t\t\t\t],\n\t\t\t),\n\t\t);\n\n\t\tconst innerSig = await signTypedDataWithSigner({\n\t\t\tsigner: this.signer,\n\t\t\tdomain: {\n\t\t\t\tname: CTF_EXCHANGE_V2_DOMAIN_NAME,\n\t\t\t\tversion: CTF_EXCHANGE_V2_DOMAIN_VERSION,\n\t\t\t\tchainId: this.chainId,\n\t\t\t\tverifyingContract: this.contractAddress,\n\t\t\t},\n\t\t\ttypes: {\n\t\t\t\tTypedDataSign: TYPED_DATA_SIGN_STRUCT,\n\t\t\t\tOrder: CTF_EXCHANGE_V2_ORDER_STRUCT,\n\t\t\t},\n\t\t\tprimaryType: \"TypedDataSign\",\n\t\t\tvalue: {\n\t\t\t\tcontents: typedData.message,\n\t\t\t\tname: \"DepositWallet\",\n\t\t\t\tversion: \"1\",\n\t\t\t\tchainId: this.chainId,\n\t\t\t\tverifyingContract: msg.signer,\n\t\t\t\tsalt: bytes32Zero,\n\t\t\t},\n\t\t});\n\n\t\t// innerSig (65) || appDomainSep (32) || contentsHash (32) || contentsType || uint16_BE(len)\n\t\tconst ctLen = ORDER_TYPE_STRING.length;\n\t\tconst lenHex = ctLen.toString(16).padStart(4, \"0\");\n\t\treturn `0x${innerSig.slice(2)}${this.appDomainSep.slice(2)}${contentsHash.slice(2)}${toHex(ORDER_TYPE_STRING).slice(2)}${lenHex}`;\n\t}\n\n\tbuildOrderHash(orderTypedData: EIP712TypedData): OrderHash {\n\t\treturn hashTypedData(orderTypedData);\n\t}\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"exchangeOrderBuilderV2.js","names":["contractAddress: string","chainId: number","signer: ClobSigner"],"sources":["../../src/order-utils/exchangeOrderBuilderV2.ts"],"sourcesContent":["import { type Address, encodeAbiParameters, hashTypedData, keccak256, toHex } from \"viem\";\n\nimport { bytes32Zero } from \"../constants.js\";\nimport { type ClobSigner, getSignerAddress, signTypedDataWithSigner } from \"../signing/signer.js\";\nimport {\n\tCTF_EXCHANGE_V2_DOMAIN_NAME,\n\tCTF_EXCHANGE_V2_DOMAIN_VERSION,\n\tCTF_EXCHANGE_V2_ORDER_STRUCT,\n\tCTF_EXCHANGE_V3_DOMAIN_VERSION,\n} from \"./model/ctfExchangeV2TypedData.js\";\nimport { EIP712_DOMAIN, type EIP712TypedData } from \"./model/eip712.js\";\nimport type { OrderHash, OrderSignature } from \"./model/order.js\";\nimport type { OrderDataV2, OrderV2, SignedOrderV2 } from \"./model/orderDataV2.js\";\nimport { SignatureTypeV2 } from \"./model/signatureTypeV2.js\";\nimport { generateOrderSalt } from \"./utils.js\";\n\nconst ORDER_TYPE_STRING =\n\t\"Order(uint256 salt,address maker,address signer,uint256 tokenId,uint256 makerAmount,uint256 takerAmount,uint8 side,uint8 signatureType,uint256 timestamp,bytes32 metadata,bytes32 builder)\";\n\nconst ORDER_TYPE_HASH = keccak256(toHex(ORDER_TYPE_STRING));\n\nconst DOMAIN_TYPE_HASH = keccak256(\n\ttoHex(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\n);\n\nconst TYPED_DATA_SIGN_STRUCT = [\n\t{ name: \"contents\", type: \"Order\" },\n\t{ name: \"name\", type: \"string\" },\n\t{ name: \"version\", type: \"string\" },\n\t{ name: \"chainId\", type: \"uint256\" },\n\t{ name: \"verifyingContract\", type: \"address\" },\n\t{ name: \"salt\", type: \"bytes32\" },\n];\n\nconst CTF_EXCHANGE_NAME_HASH = keccak256(toHex(CTF_EXCHANGE_V2_DOMAIN_NAME));\n\nexport class ExchangeOrderBuilderV2 {\n\tprivate readonly appDomainSep: `0x${string}`;\n\n\tconstructor(\n\t\tprivate readonly contractAddress: string,\n\t\tprivate readonly chainId: number,\n\t\tprivate readonly signer: ClobSigner,\n\t\tprivate readonly generateSalt = generateOrderSalt,\n\t\tprivate readonly domainVersion = CTF_EXCHANGE_V2_DOMAIN_VERSION,\n\t) {\n\t\tconst exchangeVersionHash = keccak256(toHex(domainVersion));\n\t\tthis.appDomainSep = keccak256(\n\t\t\tencodeAbiParameters(\n\t\t\t\t[\n\t\t\t\t\t{ type: \"bytes32\" },\n\t\t\t\t\t{ type: \"bytes32\" },\n\t\t\t\t\t{ type: \"bytes32\" },\n\t\t\t\t\t{ type: \"uint256\" },\n\t\t\t\t\t{ type: \"address\" },\n\t\t\t\t],\n\t\t\t\t[\n\t\t\t\t\tDOMAIN_TYPE_HASH,\n\t\t\t\t\tCTF_EXCHANGE_NAME_HASH,\n\t\t\t\t\texchangeVersionHash,\n\t\t\t\t\tBigInt(chainId),\n\t\t\t\t\tcontractAddress as Address,\n\t\t\t\t],\n\t\t\t),\n\t\t);\n\t}\n\n\tasync buildSignedOrder(orderData: OrderDataV2): Promise<SignedOrderV2> {\n\t\tconst order = await this.buildOrder(orderData);\n\t\tconst orderTypedData = this.buildOrderTypedData(order);\n\t\tconst orderSignature = await this.buildOrderSignature(orderTypedData);\n\n\t\treturn {\n\t\t\t...order,\n\t\t\tsignature: orderSignature,\n\t\t} as SignedOrderV2;\n\t}\n\n\tasync buildOrder({\n\t\tmaker,\n\t\ttokenId,\n\t\tmakerAmount,\n\t\ttakerAmount,\n\t\tside,\n\t\tsigner,\n\t\tsignatureType,\n\t\ttimestamp,\n\t\tmetadata,\n\t\tbuilder,\n\t\texpiration,\n\t}: OrderDataV2): Promise<OrderV2> {\n\t\tif (!signer) {\n\t\t\tsigner = maker;\n\t\t}\n\n\t\t// For POLY_1271 (deposit wallets), signer is the wallet contract — skip EOA address check\n\t\tif (signatureType !== SignatureTypeV2.POLY_1271) {\n\t\t\tconst signerAddress = await getSignerAddress(this.signer);\n\t\t\tif (signer !== signerAddress) {\n\t\t\t\tthrow new Error(\"signer does not match\");\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tsalt: this.generateSalt(),\n\t\t\tmaker,\n\t\t\tsigner,\n\t\t\ttokenId,\n\t\t\tmakerAmount,\n\t\t\ttakerAmount,\n\t\t\tside,\n\t\t\tsignatureType: signatureType ?? SignatureTypeV2.EOA,\n\t\t\tmetadata: metadata ?? bytes32Zero,\n\t\t\tbuilder: builder ?? bytes32Zero,\n\t\t\ttimestamp: timestamp ?? Date.now().toString(),\n\t\t\texpiration: expiration ?? \"0\",\n\t\t};\n\t}\n\n\tbuildOrderTypedData(order: OrderV2): EIP712TypedData {\n\t\treturn {\n\t\t\tprimaryType: \"Order\",\n\t\t\ttypes: {\n\t\t\t\tEIP712Domain: EIP712_DOMAIN,\n\t\t\t\tOrder: CTF_EXCHANGE_V2_ORDER_STRUCT,\n\t\t\t},\n\t\t\tdomain: {\n\t\t\t\tname: CTF_EXCHANGE_V2_DOMAIN_NAME,\n\t\t\t\tversion: this.domainVersion,\n\t\t\t\tchainId: this.chainId,\n\t\t\t\tverifyingContract: this.contractAddress,\n\t\t\t},\n\t\t\tmessage: {\n\t\t\t\tsalt: order.salt,\n\t\t\t\tmaker: order.maker,\n\t\t\t\tsigner: order.signer,\n\t\t\t\ttokenId: order.tokenId,\n\t\t\t\tmakerAmount: order.makerAmount,\n\t\t\t\ttakerAmount: order.takerAmount,\n\t\t\t\ttimestamp: order.timestamp,\n\t\t\t\tside: order.side === \"BUY\" ? 0 : 1,\n\t\t\t\tsignatureType: order.signatureType,\n\t\t\t\tmetadata: order.metadata,\n\t\t\t\tbuilder: order.builder,\n\t\t\t},\n\t\t};\n\t}\n\n\tasync buildOrderSignature(typedData: EIP712TypedData): Promise<OrderSignature> {\n\t\tdelete typedData.types.EIP712Domain;\n\n\t\tconst msg = typedData.message;\n\n\t\tif ((msg.signatureType as number) !== SignatureTypeV2.POLY_1271) {\n\t\t\treturn signTypedDataWithSigner({\n\t\t\t\tsigner: this.signer,\n\t\t\t\tdomain: typedData.domain,\n\t\t\t\ttypes: typedData.types,\n\t\t\t\tvalue: typedData.message,\n\t\t\t\tprimaryType: typedData.primaryType,\n\t\t\t});\n\t\t}\n\n\t\tconst contentsHash = keccak256(\n\t\t\tencodeAbiParameters(\n\t\t\t\t[\n\t\t\t\t\t{ type: \"bytes32\" },\n\t\t\t\t\t{ type: \"uint256\" },\n\t\t\t\t\t{ type: \"address\" },\n\t\t\t\t\t{ type: \"address\" },\n\t\t\t\t\t{ type: \"uint256\" },\n\t\t\t\t\t{ type: \"uint256\" },\n\t\t\t\t\t{ type: \"uint256\" },\n\t\t\t\t\t{ type: \"uint8\" },\n\t\t\t\t\t{ type: \"uint8\" },\n\t\t\t\t\t{ type: \"uint256\" },\n\t\t\t\t\t{ type: \"bytes32\" },\n\t\t\t\t\t{ type: \"bytes32\" },\n\t\t\t\t],\n\t\t\t\t[\n\t\t\t\t\tORDER_TYPE_HASH,\n\t\t\t\t\tBigInt(msg.salt as string),\n\t\t\t\t\tmsg.maker as Address,\n\t\t\t\t\tmsg.signer as Address,\n\t\t\t\t\tBigInt(msg.tokenId as string),\n\t\t\t\t\tBigInt(msg.makerAmount as string),\n\t\t\t\t\tBigInt(msg.takerAmount as string),\n\t\t\t\t\tmsg.side as number,\n\t\t\t\t\tmsg.signatureType as number,\n\t\t\t\t\tBigInt(msg.timestamp as string),\n\t\t\t\t\tmsg.metadata as `0x${string}`,\n\t\t\t\t\tmsg.builder as `0x${string}`,\n\t\t\t\t],\n\t\t\t),\n\t\t);\n\n\t\tconst innerSig = await signTypedDataWithSigner({\n\t\t\tsigner: this.signer,\n\t\t\tdomain: {\n\t\t\t\tname: CTF_EXCHANGE_V2_DOMAIN_NAME,\n\t\t\t\tversion: this.domainVersion,\n\t\t\t\tchainId: this.chainId,\n\t\t\t\tverifyingContract: this.contractAddress,\n\t\t\t},\n\t\t\ttypes: {\n\t\t\t\tTypedDataSign: TYPED_DATA_SIGN_STRUCT,\n\t\t\t\tOrder: CTF_EXCHANGE_V2_ORDER_STRUCT,\n\t\t\t},\n\t\t\tprimaryType: \"TypedDataSign\",\n\t\t\tvalue: {\n\t\t\t\tcontents: typedData.message,\n\t\t\t\tname: \"DepositWallet\",\n\t\t\t\tversion: \"1\",\n\t\t\t\tchainId: this.chainId,\n\t\t\t\tverifyingContract: msg.signer,\n\t\t\t\tsalt: bytes32Zero,\n\t\t\t},\n\t\t});\n\n\t\t// innerSig (65) || appDomainSep (32) || contentsHash (32) || contentsType || uint16_BE(len)\n\t\tconst ctLen = ORDER_TYPE_STRING.length;\n\t\tconst lenHex = ctLen.toString(16).padStart(4, \"0\");\n\t\treturn `0x${innerSig.slice(2)}${this.appDomainSep.slice(2)}${contentsHash.slice(2)}${toHex(ORDER_TYPE_STRING).slice(2)}${lenHex}`;\n\t}\n\n\tbuildOrderHash(orderTypedData: EIP712TypedData): OrderHash {\n\t\treturn hashTypedData(orderTypedData);\n\t}\n}\n\nexport class ExchangeOrderBuilderV3 extends ExchangeOrderBuilderV2 {\n\tconstructor(\n\t\tcontractAddress: string,\n\t\tchainId: number,\n\t\tsigner: ClobSigner,\n\t\tgenerateSalt = generateOrderSalt,\n\t) {\n\t\tsuper(contractAddress, chainId, signer, generateSalt, CTF_EXCHANGE_V3_DOMAIN_VERSION);\n\t}\n}\n"],"mappings":"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"}
@@ -2,6 +2,7 @@
2
2
  //#region src/order-utils/model/ctfExchangeV2TypedData.ts
3
3
  const CTF_EXCHANGE_V2_DOMAIN_NAME = "Polymarket CTF Exchange";
4
4
  const CTF_EXCHANGE_V2_DOMAIN_VERSION = "2";
5
+ const CTF_EXCHANGE_V3_DOMAIN_VERSION = "3";
5
6
  const CTF_EXCHANGE_V2_ORDER_STRUCT = [
6
7
  {
7
8
  name: "salt",
@@ -53,4 +54,5 @@ const CTF_EXCHANGE_V2_ORDER_STRUCT = [
53
54
  exports.CTF_EXCHANGE_V2_DOMAIN_NAME = CTF_EXCHANGE_V2_DOMAIN_NAME;
54
55
  exports.CTF_EXCHANGE_V2_DOMAIN_VERSION = CTF_EXCHANGE_V2_DOMAIN_VERSION;
55
56
  exports.CTF_EXCHANGE_V2_ORDER_STRUCT = CTF_EXCHANGE_V2_ORDER_STRUCT;
57
+ exports.CTF_EXCHANGE_V3_DOMAIN_VERSION = CTF_EXCHANGE_V3_DOMAIN_VERSION;
56
58
  //# sourceMappingURL=ctfExchangeV2TypedData.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ctfExchangeV2TypedData.cjs","names":[],"sources":["../../../src/order-utils/model/ctfExchangeV2TypedData.ts"],"sourcesContent":["export const CTF_EXCHANGE_V2_DOMAIN_NAME = \"Polymarket CTF Exchange\";\n\nexport const CTF_EXCHANGE_V2_DOMAIN_VERSION = \"2\";\n\nexport const CTF_EXCHANGE_V2_ORDER_STRUCT = [\n\t{ name: \"salt\", type: \"uint256\" },\n\t{ name: \"maker\", type: \"address\" },\n\t{ name: \"signer\", type: \"address\" },\n\t{ name: \"tokenId\", type: \"uint256\" },\n\t{ name: \"makerAmount\", type: \"uint256\" },\n\t{ name: \"takerAmount\", type: \"uint256\" },\n\t{ name: \"side\", type: \"uint8\" },\n\t{ name: \"signatureType\", type: \"uint8\" },\n\t{ name: \"timestamp\", type: \"uint256\" },\n\t{ name: \"metadata\", type: \"bytes32\" },\n\t{ name: \"builder\", type: \"bytes32\" },\n];\n"],"mappings":";;AAAA,MAAa,8BAA8B;AAE3C,MAAa,iCAAiC;AAE9C,MAAa,+BAA+B;CAC3C;EAAE,MAAM;EAAQ,MAAM;EAAW;CACjC;EAAE,MAAM;EAAS,MAAM;EAAW;CAClC;EAAE,MAAM;EAAU,MAAM;EAAW;CACnC;EAAE,MAAM;EAAW,MAAM;EAAW;CACpC;EAAE,MAAM;EAAe,MAAM;EAAW;CACxC;EAAE,MAAM;EAAe,MAAM;EAAW;CACxC;EAAE,MAAM;EAAQ,MAAM;EAAS;CAC/B;EAAE,MAAM;EAAiB,MAAM;EAAS;CACxC;EAAE,MAAM;EAAa,MAAM;EAAW;CACtC;EAAE,MAAM;EAAY,MAAM;EAAW;CACrC;EAAE,MAAM;EAAW,MAAM;EAAW;CACpC"}
1
+ {"version":3,"file":"ctfExchangeV2TypedData.cjs","names":[],"sources":["../../../src/order-utils/model/ctfExchangeV2TypedData.ts"],"sourcesContent":["export const CTF_EXCHANGE_V2_DOMAIN_NAME = \"Polymarket CTF Exchange\";\n\nexport const CTF_EXCHANGE_V2_DOMAIN_VERSION = \"2\";\n\nexport const CTF_EXCHANGE_V3_DOMAIN_VERSION = \"3\";\n\nexport const CTF_EXCHANGE_V2_ORDER_STRUCT = [\n\t{ name: \"salt\", type: \"uint256\" },\n\t{ name: \"maker\", type: \"address\" },\n\t{ name: \"signer\", type: \"address\" },\n\t{ name: \"tokenId\", type: \"uint256\" },\n\t{ name: \"makerAmount\", type: \"uint256\" },\n\t{ name: \"takerAmount\", type: \"uint256\" },\n\t{ name: \"side\", type: \"uint8\" },\n\t{ name: \"signatureType\", type: \"uint8\" },\n\t{ name: \"timestamp\", type: \"uint256\" },\n\t{ name: \"metadata\", type: \"bytes32\" },\n\t{ name: \"builder\", type: \"bytes32\" },\n];\n"],"mappings":";;AAAA,MAAa,8BAA8B;AAE3C,MAAa,iCAAiC;AAE9C,MAAa,iCAAiC;AAE9C,MAAa,+BAA+B;CAC3C;EAAE,MAAM;EAAQ,MAAM;EAAW;CACjC;EAAE,MAAM;EAAS,MAAM;EAAW;CAClC;EAAE,MAAM;EAAU,MAAM;EAAW;CACnC;EAAE,MAAM;EAAW,MAAM;EAAW;CACpC;EAAE,MAAM;EAAe,MAAM;EAAW;CACxC;EAAE,MAAM;EAAe,MAAM;EAAW;CACxC;EAAE,MAAM;EAAQ,MAAM;EAAS;CAC/B;EAAE,MAAM;EAAiB,MAAM;EAAS;CACxC;EAAE,MAAM;EAAa,MAAM;EAAW;CACtC;EAAE,MAAM;EAAY,MAAM;EAAW;CACrC;EAAE,MAAM;EAAW,MAAM;EAAW;CACpC"}
@@ -1,6 +1,7 @@
1
1
  //#region src/order-utils/model/ctfExchangeV2TypedData.ts
2
2
  const CTF_EXCHANGE_V2_DOMAIN_NAME = "Polymarket CTF Exchange";
3
3
  const CTF_EXCHANGE_V2_DOMAIN_VERSION = "2";
4
+ const CTF_EXCHANGE_V3_DOMAIN_VERSION = "3";
4
5
  const CTF_EXCHANGE_V2_ORDER_STRUCT = [
5
6
  {
6
7
  name: "salt",
@@ -49,5 +50,5 @@ const CTF_EXCHANGE_V2_ORDER_STRUCT = [
49
50
  ];
50
51
 
51
52
  //#endregion
52
- export { CTF_EXCHANGE_V2_DOMAIN_NAME, CTF_EXCHANGE_V2_DOMAIN_VERSION, CTF_EXCHANGE_V2_ORDER_STRUCT };
53
+ export { CTF_EXCHANGE_V2_DOMAIN_NAME, CTF_EXCHANGE_V2_DOMAIN_VERSION, CTF_EXCHANGE_V2_ORDER_STRUCT, CTF_EXCHANGE_V3_DOMAIN_VERSION };
53
54
  //# sourceMappingURL=ctfExchangeV2TypedData.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ctfExchangeV2TypedData.js","names":[],"sources":["../../../src/order-utils/model/ctfExchangeV2TypedData.ts"],"sourcesContent":["export const CTF_EXCHANGE_V2_DOMAIN_NAME = \"Polymarket CTF Exchange\";\n\nexport const CTF_EXCHANGE_V2_DOMAIN_VERSION = \"2\";\n\nexport const CTF_EXCHANGE_V2_ORDER_STRUCT = [\n\t{ name: \"salt\", type: \"uint256\" },\n\t{ name: \"maker\", type: \"address\" },\n\t{ name: \"signer\", type: \"address\" },\n\t{ name: \"tokenId\", type: \"uint256\" },\n\t{ name: \"makerAmount\", type: \"uint256\" },\n\t{ name: \"takerAmount\", type: \"uint256\" },\n\t{ name: \"side\", type: \"uint8\" },\n\t{ name: \"signatureType\", type: \"uint8\" },\n\t{ name: \"timestamp\", type: \"uint256\" },\n\t{ name: \"metadata\", type: \"bytes32\" },\n\t{ name: \"builder\", type: \"bytes32\" },\n];\n"],"mappings":";AAAA,MAAa,8BAA8B;AAE3C,MAAa,iCAAiC;AAE9C,MAAa,+BAA+B;CAC3C;EAAE,MAAM;EAAQ,MAAM;EAAW;CACjC;EAAE,MAAM;EAAS,MAAM;EAAW;CAClC;EAAE,MAAM;EAAU,MAAM;EAAW;CACnC;EAAE,MAAM;EAAW,MAAM;EAAW;CACpC;EAAE,MAAM;EAAe,MAAM;EAAW;CACxC;EAAE,MAAM;EAAe,MAAM;EAAW;CACxC;EAAE,MAAM;EAAQ,MAAM;EAAS;CAC/B;EAAE,MAAM;EAAiB,MAAM;EAAS;CACxC;EAAE,MAAM;EAAa,MAAM;EAAW;CACtC;EAAE,MAAM;EAAY,MAAM;EAAW;CACrC;EAAE,MAAM;EAAW,MAAM;EAAW;CACpC"}
1
+ {"version":3,"file":"ctfExchangeV2TypedData.js","names":[],"sources":["../../../src/order-utils/model/ctfExchangeV2TypedData.ts"],"sourcesContent":["export const CTF_EXCHANGE_V2_DOMAIN_NAME = \"Polymarket CTF Exchange\";\n\nexport const CTF_EXCHANGE_V2_DOMAIN_VERSION = \"2\";\n\nexport const CTF_EXCHANGE_V3_DOMAIN_VERSION = \"3\";\n\nexport const CTF_EXCHANGE_V2_ORDER_STRUCT = [\n\t{ name: \"salt\", type: \"uint256\" },\n\t{ name: \"maker\", type: \"address\" },\n\t{ name: \"signer\", type: \"address\" },\n\t{ name: \"tokenId\", type: \"uint256\" },\n\t{ name: \"makerAmount\", type: \"uint256\" },\n\t{ name: \"takerAmount\", type: \"uint256\" },\n\t{ name: \"side\", type: \"uint8\" },\n\t{ name: \"signatureType\", type: \"uint8\" },\n\t{ name: \"timestamp\", type: \"uint256\" },\n\t{ name: \"metadata\", type: \"bytes32\" },\n\t{ name: \"builder\", type: \"bytes32\" },\n];\n"],"mappings":";AAAA,MAAa,8BAA8B;AAE3C,MAAa,iCAAiC;AAE9C,MAAa,iCAAiC;AAE9C,MAAa,+BAA+B;CAC3C;EAAE,MAAM;EAAQ,MAAM;EAAW;CACjC;EAAE,MAAM;EAAS,MAAM;EAAW;CAClC;EAAE,MAAM;EAAU,MAAM;EAAW;CACnC;EAAE,MAAM;EAAW,MAAM;EAAW;CACpC;EAAE,MAAM;EAAe,MAAM;EAAW;CACxC;EAAE,MAAM;EAAe,MAAM;EAAW;CACxC;EAAE,MAAM;EAAQ,MAAM;EAAS;CAC/B;EAAE,MAAM;EAAiB,MAAM;EAAS;CACxC;EAAE,MAAM;EAAa,MAAM;EAAW;CACtC;EAAE,MAAM;EAAY,MAAM;EAAW;CACrC;EAAE,MAAM;EAAW,MAAM;EAAW;CACpC"}
@@ -1 +1 @@
1
- {"version":3,"file":"clob.cjs","names":[],"sources":["../../src/types/clob.ts"],"sourcesContent":["import { Side } from \"../order-utils/model/side.js\";\n\nexport { Side };\n\nexport interface ApiKeyCreds {\n\tkey: string;\n\tsecret: string;\n\tpassphrase: string;\n}\n\nexport interface BuilderConfig {\n\tbuilderCode: string;\n}\n\nexport interface ApiKeyRaw {\n\tapiKey: string;\n\tsecret: string;\n\tpassphrase: string;\n}\n\nexport interface L2HeaderArgs {\n\tmethod: string;\n\trequestPath: string;\n\tbody?: string;\n}\n\nexport type SimpleHeaders = Record<string, string | number | boolean>;\n\n// EIP712 sig verification\nexport interface L1PolyHeader extends SimpleHeaders {\n\tPOLY_ADDRESS: string;\n\tPOLY_SIGNATURE: string;\n\tPOLY_TIMESTAMP: string;\n\tPOLY_NONCE: string;\n}\n\n// API key verification\nexport interface L2PolyHeader extends SimpleHeaders {\n\tPOLY_ADDRESS: string;\n\tPOLY_SIGNATURE: string;\n\tPOLY_TIMESTAMP: string;\n\tPOLY_API_KEY: string;\n\tPOLY_PASSPHRASE: string;\n}\n\nexport enum OrderType {\n\tGTC = \"GTC\",\n\tFOK = \"FOK\",\n\tGTD = \"GTD\",\n\tFAK = \"FAK\",\n}\n\nexport interface OrderPayload {\n\torderID: string;\n}\n\nexport interface OrderResponse {\n\tsuccess: boolean;\n\terrorMsg: string;\n\torderID: string;\n\ttransactionsHashes?: string[];\n\ttradeIDs?: string[];\n\tstatus: string;\n\ttakingAmount: string;\n\tmakingAmount: string;\n}\n\nexport interface OpenOrder {\n\tid: string;\n\tstatus: string;\n\towner: string;\n\tmaker_address: string;\n\tmarket: string;\n\tasset_id: string;\n\tside: string;\n\toriginal_size: string;\n\tsize_matched: string;\n\tprice: string;\n\tassociate_trades: string[];\n\toutcome: string;\n\tcreated_at: number;\n\texpiration: string;\n\torder_type: string;\n}\n\nexport type OpenOrdersResponse = OpenOrder[];\n\nexport type PreMigrationOrder = OpenOrder;\n\nexport type PreMigrationOrdersResponse = PreMigrationOrder[];\n\nexport interface MakerOrder {\n\torder_id: string;\n\towner: string;\n\tmaker_address: string;\n\tmatched_amount: string;\n\tprice: string;\n\tfee_rate_bps: string;\n\tasset_id: string;\n\toutcome: string;\n\tside?: Side;\n\tbuilder_fee?: string;\n\tbuilder_code?: string;\n}\n\nexport interface Trade {\n\tid: string;\n\ttaker_order_id: string;\n\tmarket: string;\n\tasset_id: string;\n\tside: Side;\n\tsize: string;\n\tfee_rate_bps: string;\n\tprice: string;\n\tstatus: string;\n\tmatch_time: string;\n\tmatch_time_nano?: string;\n\tlast_update: string;\n\toutcome: string;\n\tbucket_index: number;\n\towner: string;\n\tmaker_address: string;\n\tmaker_orders: MakerOrder[];\n\ttransaction_hash?: string;\n\terr_msg?: string | null;\n\ttrader_side: \"TAKER\" | \"MAKER\";\n}\n\nexport interface ApiKeysResponse {\n\tapiKeys: ApiKeyCreds[];\n}\n\nexport interface BanStatus {\n\tclosed_only: boolean;\n}\n\nexport interface TradeParams {\n\tid?: string;\n\tmaker_address?: string;\n\tmarket?: string;\n\tasset_id?: string;\n\tbefore?: string;\n\tafter?: string;\n}\n\nexport interface BuilderTradeParams extends TradeParams {\n\tbuilder_code: string;\n}\n\nexport interface OpenOrderParams {\n\tid?: string;\n\tmarket?: string;\n\tasset_id?: string;\n}\n\nexport enum Chain {\n\tPOLYGON = 137,\n\tAMOY = 80002,\n}\n\nexport interface MarketPrice {\n\tt: number; // timestamp\n\tp: number; // price\n}\n\nexport interface PriceHistoryFilterParams {\n\tmarket?: string;\n\tstartTs?: number;\n\tendTs?: number;\n\tfidelity?: number;\n\tinterval?: PriceHistoryInterval;\n}\n\nexport enum PriceHistoryInterval {\n\tMAX = \"max\",\n\tONE_WEEK = \"1w\",\n\tONE_DAY = \"1d\",\n\tSIX_HOURS = \"6h\",\n\tONE_HOUR = \"1h\",\n}\n\nexport interface DropNotificationParams {\n\tids: string[];\n}\n\nexport interface Notification {\n\ttype: number;\n\towner: string;\n\n\tpayload: any;\n}\n\nexport interface OrderMarketCancelParams {\n\tmarket?: string;\n\tasset_id?: string;\n}\n\nexport interface OrderBookSummary {\n\tmarket: string;\n\tasset_id: string;\n\ttimestamp: string;\n\tbids: OrderSummary[];\n\tasks: OrderSummary[];\n\tmin_order_size: string;\n\ttick_size: string;\n\tneg_risk: boolean;\n\thash: string;\n\tlast_trade_price: string;\n}\n\nexport interface OrderSummary {\n\tprice: string;\n\tsize: string;\n}\n\nexport enum AssetType {\n\tCOLLATERAL = \"COLLATERAL\",\n\tCONDITIONAL = \"CONDITIONAL\",\n}\n\nexport interface BalanceAllowanceParams {\n\tasset_type: AssetType;\n\ttoken_id?: string;\n}\n\nexport interface BalanceAllowanceResponse {\n\tbalance: string;\n\tallowances: Record<string, string>;\n}\n\nexport interface OrderScoringParams {\n\torder_id: string;\n}\n\nexport interface OrderScoring {\n\tscoring: boolean;\n}\n\nexport interface OrdersScoringParams {\n\torderIds: string[];\n}\n\nexport type OrdersScoring = { [orderId in string]: boolean };\n\nexport type CreateOrderOptions = {\n\ttickSize: TickSize;\n\tnegRisk?: boolean;\n};\n\nexport type TickSize = \"0.1\" | \"0.01\" | \"0.001\" | \"0.0001\";\n\nexport interface RoundConfig {\n\treadonly price: number;\n\treadonly size: number;\n\treadonly amount: number;\n}\n\nexport interface TickSizes {\n\t[tokenId: string]: TickSize;\n}\n\nexport interface FeeRates {\n\t[tokenId: string]: number;\n}\n\nexport interface NegRisk {\n\t[tokenId: string]: boolean;\n}\n\nexport interface FeeInfo {\n\trate: number;\n\texponent: number;\n}\n\nexport interface FeeInfos {\n\t[tokenId: string]: FeeInfo;\n}\n\nexport interface BuilderFeeRates {\n\t[builderCode: string]: { maker: number; taker: number };\n}\n\nexport type TokenConditionMap = Record<string, string>;\n\nexport interface FeeDetails {\n\tr?: number; // fee rate\n\te?: number; // fee exponent\n\tto?: boolean; // taker only (omitted when false)\n}\n\nexport interface ClobRewards {\n\tmi?: number; // min size\n\tma?: number; // max spread\n\te?: boolean; // enabled\n\tsmoa?: boolean; // skip min order age\n\tmoas?: number; // min order age seconds\n}\n\nexport interface ClobToken {\n\tt: string; // token ID\n\to: string; // outcome\n}\n\nexport interface MarketDetails {\n\tc: string; // condition ID\n\tt: [ClobToken, ClobToken]; // YES and NO tokens\n\tmts: number; // min tick size\n\tnr?: boolean; // neg risk (omitted when false)\n\tfd?: FeeDetails; // platform fee details\n\tmbf?: number; // maker base fee\n\ttbf?: number; // taker base fee\n\tr: ClobRewards | null; // rewards config (always present, null if unset)\n\tao?: boolean; // accepting orders\n\tmos?: number; // min order size\n\tsd?: number; // seconds delay\n\tgst?: string; // game start time (ISO 8601)\n\tcbos?: boolean; // clear book on start\n\taot?: string; // accepting orders timestamp (ISO 8601)\n\trfqe?: boolean; // RFQ enabled\n\titode?: boolean; // taker order delay enabled\n\tibce?: boolean; // blockaid check enabled\n}\n\nexport interface PaginationPayload {\n\treadonly limit: number;\n\treadonly count: number;\n\treadonly next_cursor: string;\n\treadonly data: any[];\n}\n\nexport interface BookParams {\n\ttoken_id: string;\n\tside: Side;\n}\n\nexport interface UserEarning {\n\tdate: string;\n\tcondition_id: string;\n\tasset_address: string;\n\tmaker_address: string;\n\tearnings: number;\n\tasset_rate: number;\n}\n\nexport interface TotalUserEarning {\n\tdate: string;\n\tasset_address: string;\n\tmaker_address: string;\n\tearnings: number;\n\tasset_rate: number;\n}\n\nexport interface RewardsPercentages {\n\t[market: string]: number;\n}\n\nexport interface Token {\n\ttoken_id: string;\n\toutcome: string;\n\tprice: number;\n}\n\nexport interface RewardsConfig {\n\tasset_address: string;\n\tstart_date: string;\n\tend_date: string;\n\trate_per_day: number;\n\ttotal_rewards: number;\n}\n\nexport interface MarketReward {\n\tcondition_id: string;\n\tquestion: string;\n\tmarket_slug: string;\n\tevent_slug: string;\n\timage: string;\n\trewards_max_spread: number;\n\trewards_min_size: number;\n\ttokens: Token[];\n\trewards_config: RewardsConfig[];\n}\n\nexport interface Earning {\n\tasset_address: string;\n\tearnings: number;\n\tasset_rate: number;\n}\n\nexport interface UserRewardsEarning {\n\tcondition_id: string;\n\tquestion: string;\n\tmarket_slug: string;\n\tevent_slug: string;\n\timage: string;\n\trewards_max_spread: number;\n\trewards_min_size: number;\n\tmarket_competitiveness: number;\n\ttokens: Token[];\n\trewards_config: RewardsConfig[];\n\tmaker_address: string;\n\tearning_percentage: number;\n\tearnings: Earning[];\n}\n\nexport interface BuilderTrade {\n\tid: string;\n\ttradeType: string;\n\ttakerOrderHash: string;\n\tbuilder: string;\n\tmarket: string;\n\tassetId: string;\n\tside: string;\n\tsize: string;\n\tsizeUsdc: string;\n\tprice: string;\n\tstatus: string;\n\toutcome: string;\n\toutcomeIndex: number;\n\towner: string;\n\tmaker: string;\n\ttransactionHash: string;\n\tmatchTime: string;\n\tbucketIndex: number;\n\tfee: string;\n\tfeeUsdc: string;\n\tbuilderFee: string;\n\tbuilderCode: string;\n\terr_msg?: string | null;\n\tcreatedAt: string | null;\n\tupdatedAt: string | null;\n}\n\nexport interface ReadonlyApiKeyResponse {\n\tapiKey: string;\n}\n\nexport interface MarketTradeEvent {\n\tevent_type: string;\n\tmarket: {\n\t\tcondition_id: string;\n\t\tasset_id: string;\n\t\tquestion: string;\n\t\ticon: string;\n\t\tslug: string;\n\t};\n\tuser: {\n\t\taddress: string;\n\t\tusername: string;\n\t\tprofile_picture: string;\n\t\toptimized_profile_picture: string;\n\t\tpseudonym: string;\n\t};\n\tside: Side;\n\tsize: string;\n\tfee_rate_bps: string;\n\tprice: string;\n\toutcome: string;\n\toutcome_index: number;\n\ttransaction_hash: string;\n\ttimestamp: string;\n}\n\nexport interface BuilderApiKey {\n\tkey: string;\n\tsecret: string;\n\tpassphrase: string;\n}\n\nexport interface BuilderApiKeyResponse {\n\tkey: string;\n\tcreatedAt?: string;\n\trevokedAt?: string;\n}\n\nexport type ClobErrorResponseBody = {\n\terror: string;\n};\n\nexport interface TradesPaginatedResponse {\n\ttrades: Trade[];\n\tnext_cursor: string;\n\tlimit: number;\n\tcount: number;\n}\n\nexport interface BuilderTradesResponse {\n\ttrades: BuilderTrade[];\n\tnext_cursor: string;\n\tlimit: number;\n\tcount: number;\n}\n"],"mappings":";;;AA6CA,IAAY,kDAAL;AACN;AACA;AACA;AACA;;;AA0GD,IAAY,0CAAL;AACN;AACA;;;AAgBD,IAAY,wEAAL;AACN;AACA;AACA;AACA;AACA;;;AAqCD,IAAY,kDAAL;AACN;AACA"}
1
+ {"version":3,"file":"clob.cjs","names":[],"sources":["../../src/types/clob.ts"],"sourcesContent":["import { Side } from \"../order-utils/model/side.js\";\n\nexport { Side };\n\nexport interface ApiKeyCreds {\n\tkey: string;\n\tsecret: string;\n\tpassphrase: string;\n}\n\nexport interface BuilderConfig {\n\tbuilderCode: string;\n}\n\nexport interface ApiKeyRaw {\n\tapiKey: string;\n\tsecret: string;\n\tpassphrase: string;\n}\n\nexport interface L2HeaderArgs {\n\tmethod: string;\n\trequestPath: string;\n\tbody?: string;\n}\n\nexport type SimpleHeaders = Record<string, string | number | boolean>;\n\n// EIP712 sig verification\nexport interface L1PolyHeader extends SimpleHeaders {\n\tPOLY_ADDRESS: string;\n\tPOLY_SIGNATURE: string;\n\tPOLY_TIMESTAMP: string;\n\tPOLY_NONCE: string;\n}\n\n// API key verification\nexport interface L2PolyHeader extends SimpleHeaders {\n\tPOLY_ADDRESS: string;\n\tPOLY_SIGNATURE: string;\n\tPOLY_TIMESTAMP: string;\n\tPOLY_API_KEY: string;\n\tPOLY_PASSPHRASE: string;\n}\n\nexport enum OrderType {\n\tGTC = \"GTC\",\n\tFOK = \"FOK\",\n\tGTD = \"GTD\",\n\tFAK = \"FAK\",\n}\n\nexport interface OrderPayload {\n\torderID: string;\n}\n\nexport interface OrderResponse {\n\tsuccess: boolean;\n\terrorMsg: string;\n\torderID: string;\n\ttransactionsHashes?: string[];\n\ttradeIDs?: string[];\n\tstatus: string;\n\ttakingAmount: string;\n\tmakingAmount: string;\n}\n\nexport interface OpenOrder {\n\tid: string;\n\tstatus: string;\n\towner: string;\n\tmaker_address: string;\n\tmarket: string;\n\tasset_id: string;\n\tside: string;\n\toriginal_size: string;\n\tsize_matched: string;\n\tprice: string;\n\tassociate_trades: string[];\n\toutcome: string;\n\tcreated_at: number;\n\texpiration: string;\n\torder_type: string;\n}\n\nexport type OpenOrdersResponse = OpenOrder[];\n\nexport type PreMigrationOrder = OpenOrder;\n\nexport type PreMigrationOrdersResponse = PreMigrationOrder[];\n\nexport interface MakerOrder {\n\torder_id: string;\n\towner: string;\n\tmaker_address: string;\n\tmatched_amount: string;\n\tprice: string;\n\tfee_rate_bps: string;\n\tasset_id: string;\n\toutcome: string;\n\tside?: Side;\n\tbuilder_fee?: string;\n\tbuilder_code?: string;\n}\n\nexport interface Trade {\n\tid: string;\n\ttaker_order_id: string;\n\tmarket: string;\n\tasset_id: string;\n\tside: Side;\n\tsize: string;\n\tfee_rate_bps: string;\n\tprice: string;\n\tstatus: string;\n\tmatch_time: string;\n\tmatch_time_nano?: string;\n\tlast_update: string;\n\toutcome: string;\n\tbucket_index: number;\n\towner: string;\n\tmaker_address: string;\n\tmaker_orders: MakerOrder[];\n\ttransaction_hash?: string;\n\terr_msg?: string | null;\n\ttrader_side: \"TAKER\" | \"MAKER\";\n}\n\nexport interface ApiKeysResponse {\n\tapiKeys: ApiKeyCreds[];\n}\n\nexport interface BanStatus {\n\tclosed_only: boolean;\n}\n\nexport interface TradeParams {\n\tid?: string;\n\tmaker_address?: string;\n\tmarket?: string;\n\tasset_id?: string;\n\tbefore?: string;\n\tafter?: string;\n}\n\nexport interface BuilderTradeParams extends TradeParams {\n\tbuilder_code: string;\n}\n\nexport interface OpenOrderParams {\n\tid?: string;\n\tmarket?: string;\n\tasset_id?: string;\n}\n\nexport enum Chain {\n\tPOLYGON = 137,\n\tAMOY = 80002,\n}\n\nexport interface MarketPrice {\n\tt: number; // timestamp\n\tp: number; // price\n}\n\nexport interface PriceHistoryFilterParams {\n\tmarket?: string;\n\tstartTs?: number;\n\tendTs?: number;\n\tfidelity?: number;\n\tinterval?: PriceHistoryInterval;\n}\n\nexport enum PriceHistoryInterval {\n\tMAX = \"max\",\n\tONE_WEEK = \"1w\",\n\tONE_DAY = \"1d\",\n\tSIX_HOURS = \"6h\",\n\tONE_HOUR = \"1h\",\n}\n\nexport interface DropNotificationParams {\n\tids: string[];\n}\n\nexport interface Notification {\n\ttype: number;\n\towner: string;\n\n\tpayload: any;\n}\n\nexport interface OrderMarketCancelParams {\n\tmarket?: string;\n\tasset_id?: string;\n}\n\nexport interface OrderBookSummary {\n\tmarket: string;\n\tasset_id: string;\n\ttimestamp: string;\n\tbids: OrderSummary[];\n\tasks: OrderSummary[];\n\tmin_order_size: string;\n\ttick_size: string;\n\tneg_risk: boolean;\n\thash: string;\n\tlast_trade_price: string;\n}\n\nexport interface OrderSummary {\n\tprice: string;\n\tsize: string;\n}\n\nexport enum AssetType {\n\tCOLLATERAL = \"COLLATERAL\",\n\tCONDITIONAL = \"CONDITIONAL\",\n}\n\nexport interface BalanceAllowanceParams {\n\tasset_type: AssetType;\n\ttoken_id?: string;\n}\n\nexport interface BalanceAllowanceResponse {\n\tbalance: string;\n\tallowances: Record<string, string>;\n}\n\nexport interface OrderScoringParams {\n\torder_id: string;\n}\n\nexport interface OrderScoring {\n\tscoring: boolean;\n}\n\nexport interface OrdersScoringParams {\n\torderIds: string[];\n}\n\nexport type OrdersScoring = { [orderId in string]: boolean };\n\nexport type OrderVersion = 1 | 2 | 3;\n\nexport type CreateOrderOptions = {\n\ttickSize: TickSize;\n\tnegRisk?: boolean;\n\tversion?: OrderVersion;\n};\n\nexport type TickSize = \"0.1\" | \"0.01\" | \"0.005\" | \"0.0025\" | \"0.001\" | \"0.0001\";\n\nexport interface RoundConfig {\n\treadonly price: number;\n\treadonly size: number;\n\treadonly amount: number;\n}\n\nexport interface TickSizes {\n\t[tokenId: string]: TickSize;\n}\n\nexport interface FeeRates {\n\t[tokenId: string]: number;\n}\n\nexport interface NegRisk {\n\t[tokenId: string]: boolean;\n}\n\nexport interface FeeInfo {\n\trate: number;\n\texponent: number;\n}\n\nexport interface FeeInfos {\n\t[tokenId: string]: FeeInfo;\n}\n\nexport interface BuilderFeeRates {\n\t[builderCode: string]: { maker: number; taker: number };\n}\n\nexport type TokenConditionMap = Record<string, string>;\n\nexport interface FeeDetails {\n\tr?: number; // fee rate\n\te?: number; // fee exponent\n\tto?: boolean; // taker only (omitted when false)\n}\n\nexport interface ClobRewards {\n\tmi?: number; // min size\n\tma?: number; // max spread\n\te?: boolean; // enabled\n\tsmoa?: boolean; // skip min order age\n\tmoas?: number; // min order age seconds\n}\n\nexport interface ClobToken {\n\tt: string; // token ID\n\to: string; // outcome\n}\n\nexport interface MarketDetails {\n\tc: string; // condition ID\n\tt: [ClobToken, ClobToken]; // YES and NO tokens\n\tmts: number; // min tick size\n\tnr?: boolean; // neg risk (omitted when false)\n\tfd?: FeeDetails; // platform fee details\n\tmbf?: number; // maker base fee\n\ttbf?: number; // taker base fee\n\tr: ClobRewards | null; // rewards config (always present, null if unset)\n\tao?: boolean; // accepting orders\n\tmos?: number; // min order size\n\tsd?: number; // seconds delay\n\tgst?: string; // game start time (ISO 8601)\n\tcbos?: boolean; // clear book on start\n\taot?: string; // accepting orders timestamp (ISO 8601)\n\trfqe?: boolean; // RFQ enabled\n\titode?: boolean; // taker order delay enabled\n\tibce?: boolean; // blockaid check enabled\n}\n\nexport interface PaginationPayload {\n\treadonly limit: number;\n\treadonly count: number;\n\treadonly next_cursor: string;\n\treadonly data: any[];\n}\n\nexport interface BookParams {\n\ttoken_id: string;\n\tside: Side;\n}\n\nexport interface UserEarning {\n\tdate: string;\n\tcondition_id: string;\n\tasset_address: string;\n\tmaker_address: string;\n\tearnings: number;\n\tasset_rate: number;\n}\n\nexport interface TotalUserEarning {\n\tdate: string;\n\tasset_address: string;\n\tmaker_address: string;\n\tearnings: number;\n\tasset_rate: number;\n}\n\nexport interface RewardsPercentages {\n\t[market: string]: number;\n}\n\nexport interface Token {\n\ttoken_id: string;\n\toutcome: string;\n\tprice: number;\n}\n\nexport interface RewardsConfig {\n\tasset_address: string;\n\tstart_date: string;\n\tend_date: string;\n\trate_per_day: number;\n\ttotal_rewards: number;\n}\n\nexport interface MarketReward {\n\tcondition_id: string;\n\tquestion: string;\n\tmarket_slug: string;\n\tevent_slug: string;\n\timage: string;\n\trewards_max_spread: number;\n\trewards_min_size: number;\n\ttokens: Token[];\n\trewards_config: RewardsConfig[];\n}\n\nexport interface Earning {\n\tasset_address: string;\n\tearnings: number;\n\tasset_rate: number;\n}\n\nexport interface UserRewardsEarning {\n\tcondition_id: string;\n\tquestion: string;\n\tmarket_slug: string;\n\tevent_slug: string;\n\timage: string;\n\trewards_max_spread: number;\n\trewards_min_size: number;\n\tmarket_competitiveness: number;\n\ttokens: Token[];\n\trewards_config: RewardsConfig[];\n\tmaker_address: string;\n\tearning_percentage: number;\n\tearnings: Earning[];\n}\n\nexport interface BuilderTrade {\n\tid: string;\n\ttradeType: string;\n\ttakerOrderHash: string;\n\tbuilder: string;\n\tmarket: string;\n\tassetId: string;\n\tside: string;\n\tsize: string;\n\tsizeUsdc: string;\n\tprice: string;\n\tstatus: string;\n\toutcome: string;\n\toutcomeIndex: number;\n\towner: string;\n\tmaker: string;\n\ttransactionHash: string;\n\tmatchTime: string;\n\tbucketIndex: number;\n\tfee: string;\n\tfeeUsdc: string;\n\tbuilderFee: string;\n\tbuilderCode: string;\n\terr_msg?: string | null;\n\tcreatedAt: string | null;\n\tupdatedAt: string | null;\n}\n\nexport interface ReadonlyApiKeyResponse {\n\tapiKey: string;\n}\n\nexport interface MarketTradeEvent {\n\tevent_type: string;\n\tmarket: {\n\t\tcondition_id: string;\n\t\tasset_id: string;\n\t\tquestion: string;\n\t\ticon: string;\n\t\tslug: string;\n\t};\n\tuser: {\n\t\taddress: string;\n\t\tusername: string;\n\t\tprofile_picture: string;\n\t\toptimized_profile_picture: string;\n\t\tpseudonym: string;\n\t};\n\tside: Side;\n\tsize: string;\n\tfee_rate_bps: string;\n\tprice: string;\n\toutcome: string;\n\toutcome_index: number;\n\ttransaction_hash: string;\n\ttimestamp: string;\n}\n\nexport interface BuilderApiKey {\n\tkey: string;\n\tsecret: string;\n\tpassphrase: string;\n}\n\nexport interface BuilderApiKeyResponse {\n\tkey: string;\n\tcreatedAt?: string;\n\trevokedAt?: string;\n}\n\nexport type ClobErrorResponseBody = {\n\terror: string;\n};\n\nexport interface TradesPaginatedResponse {\n\ttrades: Trade[];\n\tnext_cursor: string;\n\tlimit: number;\n\tcount: number;\n}\n\nexport interface BuilderTradesResponse {\n\ttrades: BuilderTrade[];\n\tnext_cursor: string;\n\tlimit: number;\n\tcount: number;\n}\n"],"mappings":";;;AA6CA,IAAY,kDAAL;AACN;AACA;AACA;AACA;;;AA0GD,IAAY,0CAAL;AACN;AACA;;;AAgBD,IAAY,wEAAL;AACN;AACA;AACA;AACA;AACA;;;AAqCD,IAAY,kDAAL;AACN;AACA"}
@@ -201,11 +201,13 @@ interface OrdersScoringParams {
201
201
  orderIds: string[];
202
202
  }
203
203
  type OrdersScoring = { [orderId in string]: boolean };
204
+ type OrderVersion = 1 | 2 | 3;
204
205
  type CreateOrderOptions = {
205
206
  tickSize: TickSize;
206
207
  negRisk?: boolean;
208
+ version?: OrderVersion;
207
209
  };
208
- type TickSize = "0.1" | "0.01" | "0.001" | "0.0001";
210
+ type TickSize = "0.1" | "0.01" | "0.005" | "0.0025" | "0.001" | "0.0001";
209
211
  interface RoundConfig {
210
212
  readonly price: number;
211
213
  readonly size: number;
@@ -421,5 +423,5 @@ interface BuilderTradesResponse {
421
423
  count: number;
422
424
  }
423
425
  //#endregion
424
- export { ApiKeyCreds, ApiKeyRaw, ApiKeysResponse, AssetType, BalanceAllowanceParams, BalanceAllowanceResponse, BanStatus, BookParams, BuilderApiKey, BuilderApiKeyResponse, BuilderConfig, BuilderFeeRates, BuilderTrade, BuilderTradeParams, BuilderTradesResponse, Chain, ClobErrorResponseBody, ClobRewards, ClobToken, CreateOrderOptions, DropNotificationParams, Earning, FeeDetails, FeeInfo, FeeInfos, FeeRates, L1PolyHeader, L2HeaderArgs, L2PolyHeader, MakerOrder, MarketDetails, MarketPrice, MarketReward, MarketTradeEvent, NegRisk, Notification, OpenOrder, OpenOrderParams, OpenOrdersResponse, OrderBookSummary, OrderMarketCancelParams, OrderPayload, OrderResponse, OrderScoring, OrderScoringParams, OrderSummary, OrderType, OrdersScoring, OrdersScoringParams, PaginationPayload, PreMigrationOrder, PreMigrationOrdersResponse, PriceHistoryFilterParams, PriceHistoryInterval, ReadonlyApiKeyResponse, RewardsConfig, RewardsPercentages, RoundConfig, SimpleHeaders, TickSize, TickSizes, Token, TokenConditionMap, TotalUserEarning, Trade, TradeParams, TradesPaginatedResponse, UserEarning, UserRewardsEarning };
426
+ export { ApiKeyCreds, ApiKeyRaw, ApiKeysResponse, AssetType, BalanceAllowanceParams, BalanceAllowanceResponse, BanStatus, BookParams, BuilderApiKey, BuilderApiKeyResponse, BuilderConfig, BuilderFeeRates, BuilderTrade, BuilderTradeParams, BuilderTradesResponse, Chain, ClobErrorResponseBody, ClobRewards, ClobToken, CreateOrderOptions, DropNotificationParams, Earning, FeeDetails, FeeInfo, FeeInfos, FeeRates, L1PolyHeader, L2HeaderArgs, L2PolyHeader, MakerOrder, MarketDetails, MarketPrice, MarketReward, MarketTradeEvent, NegRisk, Notification, OpenOrder, OpenOrderParams, OpenOrdersResponse, OrderBookSummary, OrderMarketCancelParams, OrderPayload, OrderResponse, OrderScoring, OrderScoringParams, OrderSummary, OrderType, OrderVersion, OrdersScoring, OrdersScoringParams, PaginationPayload, PreMigrationOrder, PreMigrationOrdersResponse, PriceHistoryFilterParams, PriceHistoryInterval, ReadonlyApiKeyResponse, RewardsConfig, RewardsPercentages, RoundConfig, SimpleHeaders, TickSize, TickSizes, Token, TokenConditionMap, TotalUserEarning, Trade, TradeParams, TradesPaginatedResponse, UserEarning, UserRewardsEarning };
425
427
  //# sourceMappingURL=clob.d.cts.map
@@ -201,11 +201,13 @@ interface OrdersScoringParams {
201
201
  orderIds: string[];
202
202
  }
203
203
  type OrdersScoring = { [orderId in string]: boolean };
204
+ type OrderVersion = 1 | 2 | 3;
204
205
  type CreateOrderOptions = {
205
206
  tickSize: TickSize;
206
207
  negRisk?: boolean;
208
+ version?: OrderVersion;
207
209
  };
208
- type TickSize = "0.1" | "0.01" | "0.001" | "0.0001";
210
+ type TickSize = "0.1" | "0.01" | "0.005" | "0.0025" | "0.001" | "0.0001";
209
211
  interface RoundConfig {
210
212
  readonly price: number;
211
213
  readonly size: number;
@@ -421,5 +423,5 @@ interface BuilderTradesResponse {
421
423
  count: number;
422
424
  }
423
425
  //#endregion
424
- export { ApiKeyCreds, ApiKeyRaw, ApiKeysResponse, AssetType, BalanceAllowanceParams, BalanceAllowanceResponse, BanStatus, BookParams, BuilderApiKey, BuilderApiKeyResponse, BuilderConfig, BuilderFeeRates, BuilderTrade, BuilderTradeParams, BuilderTradesResponse, Chain, ClobErrorResponseBody, ClobRewards, ClobToken, CreateOrderOptions, DropNotificationParams, Earning, FeeDetails, FeeInfo, FeeInfos, FeeRates, L1PolyHeader, L2HeaderArgs, L2PolyHeader, MakerOrder, MarketDetails, MarketPrice, MarketReward, MarketTradeEvent, NegRisk, Notification, OpenOrder, OpenOrderParams, OpenOrdersResponse, OrderBookSummary, OrderMarketCancelParams, OrderPayload, OrderResponse, OrderScoring, OrderScoringParams, OrderSummary, OrderType, OrdersScoring, OrdersScoringParams, PaginationPayload, PreMigrationOrder, PreMigrationOrdersResponse, PriceHistoryFilterParams, PriceHistoryInterval, ReadonlyApiKeyResponse, RewardsConfig, RewardsPercentages, RoundConfig, SimpleHeaders, TickSize, TickSizes, Token, TokenConditionMap, TotalUserEarning, Trade, TradeParams, TradesPaginatedResponse, UserEarning, UserRewardsEarning };
426
+ export { ApiKeyCreds, ApiKeyRaw, ApiKeysResponse, AssetType, BalanceAllowanceParams, BalanceAllowanceResponse, BanStatus, BookParams, BuilderApiKey, BuilderApiKeyResponse, BuilderConfig, BuilderFeeRates, BuilderTrade, BuilderTradeParams, BuilderTradesResponse, Chain, ClobErrorResponseBody, ClobRewards, ClobToken, CreateOrderOptions, DropNotificationParams, Earning, FeeDetails, FeeInfo, FeeInfos, FeeRates, L1PolyHeader, L2HeaderArgs, L2PolyHeader, MakerOrder, MarketDetails, MarketPrice, MarketReward, MarketTradeEvent, NegRisk, Notification, OpenOrder, OpenOrderParams, OpenOrdersResponse, OrderBookSummary, OrderMarketCancelParams, OrderPayload, OrderResponse, OrderScoring, OrderScoringParams, OrderSummary, OrderType, OrderVersion, OrdersScoring, OrdersScoringParams, PaginationPayload, PreMigrationOrder, PreMigrationOrdersResponse, PriceHistoryFilterParams, PriceHistoryInterval, ReadonlyApiKeyResponse, RewardsConfig, RewardsPercentages, RoundConfig, SimpleHeaders, TickSize, TickSizes, Token, TokenConditionMap, TotalUserEarning, Trade, TradeParams, TradesPaginatedResponse, UserEarning, UserRewardsEarning };
425
427
  //# sourceMappingURL=clob.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clob.js","names":[],"sources":["../../src/types/clob.ts"],"sourcesContent":["import { Side } from \"../order-utils/model/side.js\";\n\nexport { Side };\n\nexport interface ApiKeyCreds {\n\tkey: string;\n\tsecret: string;\n\tpassphrase: string;\n}\n\nexport interface BuilderConfig {\n\tbuilderCode: string;\n}\n\nexport interface ApiKeyRaw {\n\tapiKey: string;\n\tsecret: string;\n\tpassphrase: string;\n}\n\nexport interface L2HeaderArgs {\n\tmethod: string;\n\trequestPath: string;\n\tbody?: string;\n}\n\nexport type SimpleHeaders = Record<string, string | number | boolean>;\n\n// EIP712 sig verification\nexport interface L1PolyHeader extends SimpleHeaders {\n\tPOLY_ADDRESS: string;\n\tPOLY_SIGNATURE: string;\n\tPOLY_TIMESTAMP: string;\n\tPOLY_NONCE: string;\n}\n\n// API key verification\nexport interface L2PolyHeader extends SimpleHeaders {\n\tPOLY_ADDRESS: string;\n\tPOLY_SIGNATURE: string;\n\tPOLY_TIMESTAMP: string;\n\tPOLY_API_KEY: string;\n\tPOLY_PASSPHRASE: string;\n}\n\nexport enum OrderType {\n\tGTC = \"GTC\",\n\tFOK = \"FOK\",\n\tGTD = \"GTD\",\n\tFAK = \"FAK\",\n}\n\nexport interface OrderPayload {\n\torderID: string;\n}\n\nexport interface OrderResponse {\n\tsuccess: boolean;\n\terrorMsg: string;\n\torderID: string;\n\ttransactionsHashes?: string[];\n\ttradeIDs?: string[];\n\tstatus: string;\n\ttakingAmount: string;\n\tmakingAmount: string;\n}\n\nexport interface OpenOrder {\n\tid: string;\n\tstatus: string;\n\towner: string;\n\tmaker_address: string;\n\tmarket: string;\n\tasset_id: string;\n\tside: string;\n\toriginal_size: string;\n\tsize_matched: string;\n\tprice: string;\n\tassociate_trades: string[];\n\toutcome: string;\n\tcreated_at: number;\n\texpiration: string;\n\torder_type: string;\n}\n\nexport type OpenOrdersResponse = OpenOrder[];\n\nexport type PreMigrationOrder = OpenOrder;\n\nexport type PreMigrationOrdersResponse = PreMigrationOrder[];\n\nexport interface MakerOrder {\n\torder_id: string;\n\towner: string;\n\tmaker_address: string;\n\tmatched_amount: string;\n\tprice: string;\n\tfee_rate_bps: string;\n\tasset_id: string;\n\toutcome: string;\n\tside?: Side;\n\tbuilder_fee?: string;\n\tbuilder_code?: string;\n}\n\nexport interface Trade {\n\tid: string;\n\ttaker_order_id: string;\n\tmarket: string;\n\tasset_id: string;\n\tside: Side;\n\tsize: string;\n\tfee_rate_bps: string;\n\tprice: string;\n\tstatus: string;\n\tmatch_time: string;\n\tmatch_time_nano?: string;\n\tlast_update: string;\n\toutcome: string;\n\tbucket_index: number;\n\towner: string;\n\tmaker_address: string;\n\tmaker_orders: MakerOrder[];\n\ttransaction_hash?: string;\n\terr_msg?: string | null;\n\ttrader_side: \"TAKER\" | \"MAKER\";\n}\n\nexport interface ApiKeysResponse {\n\tapiKeys: ApiKeyCreds[];\n}\n\nexport interface BanStatus {\n\tclosed_only: boolean;\n}\n\nexport interface TradeParams {\n\tid?: string;\n\tmaker_address?: string;\n\tmarket?: string;\n\tasset_id?: string;\n\tbefore?: string;\n\tafter?: string;\n}\n\nexport interface BuilderTradeParams extends TradeParams {\n\tbuilder_code: string;\n}\n\nexport interface OpenOrderParams {\n\tid?: string;\n\tmarket?: string;\n\tasset_id?: string;\n}\n\nexport enum Chain {\n\tPOLYGON = 137,\n\tAMOY = 80002,\n}\n\nexport interface MarketPrice {\n\tt: number; // timestamp\n\tp: number; // price\n}\n\nexport interface PriceHistoryFilterParams {\n\tmarket?: string;\n\tstartTs?: number;\n\tendTs?: number;\n\tfidelity?: number;\n\tinterval?: PriceHistoryInterval;\n}\n\nexport enum PriceHistoryInterval {\n\tMAX = \"max\",\n\tONE_WEEK = \"1w\",\n\tONE_DAY = \"1d\",\n\tSIX_HOURS = \"6h\",\n\tONE_HOUR = \"1h\",\n}\n\nexport interface DropNotificationParams {\n\tids: string[];\n}\n\nexport interface Notification {\n\ttype: number;\n\towner: string;\n\n\tpayload: any;\n}\n\nexport interface OrderMarketCancelParams {\n\tmarket?: string;\n\tasset_id?: string;\n}\n\nexport interface OrderBookSummary {\n\tmarket: string;\n\tasset_id: string;\n\ttimestamp: string;\n\tbids: OrderSummary[];\n\tasks: OrderSummary[];\n\tmin_order_size: string;\n\ttick_size: string;\n\tneg_risk: boolean;\n\thash: string;\n\tlast_trade_price: string;\n}\n\nexport interface OrderSummary {\n\tprice: string;\n\tsize: string;\n}\n\nexport enum AssetType {\n\tCOLLATERAL = \"COLLATERAL\",\n\tCONDITIONAL = \"CONDITIONAL\",\n}\n\nexport interface BalanceAllowanceParams {\n\tasset_type: AssetType;\n\ttoken_id?: string;\n}\n\nexport interface BalanceAllowanceResponse {\n\tbalance: string;\n\tallowances: Record<string, string>;\n}\n\nexport interface OrderScoringParams {\n\torder_id: string;\n}\n\nexport interface OrderScoring {\n\tscoring: boolean;\n}\n\nexport interface OrdersScoringParams {\n\torderIds: string[];\n}\n\nexport type OrdersScoring = { [orderId in string]: boolean };\n\nexport type CreateOrderOptions = {\n\ttickSize: TickSize;\n\tnegRisk?: boolean;\n};\n\nexport type TickSize = \"0.1\" | \"0.01\" | \"0.001\" | \"0.0001\";\n\nexport interface RoundConfig {\n\treadonly price: number;\n\treadonly size: number;\n\treadonly amount: number;\n}\n\nexport interface TickSizes {\n\t[tokenId: string]: TickSize;\n}\n\nexport interface FeeRates {\n\t[tokenId: string]: number;\n}\n\nexport interface NegRisk {\n\t[tokenId: string]: boolean;\n}\n\nexport interface FeeInfo {\n\trate: number;\n\texponent: number;\n}\n\nexport interface FeeInfos {\n\t[tokenId: string]: FeeInfo;\n}\n\nexport interface BuilderFeeRates {\n\t[builderCode: string]: { maker: number; taker: number };\n}\n\nexport type TokenConditionMap = Record<string, string>;\n\nexport interface FeeDetails {\n\tr?: number; // fee rate\n\te?: number; // fee exponent\n\tto?: boolean; // taker only (omitted when false)\n}\n\nexport interface ClobRewards {\n\tmi?: number; // min size\n\tma?: number; // max spread\n\te?: boolean; // enabled\n\tsmoa?: boolean; // skip min order age\n\tmoas?: number; // min order age seconds\n}\n\nexport interface ClobToken {\n\tt: string; // token ID\n\to: string; // outcome\n}\n\nexport interface MarketDetails {\n\tc: string; // condition ID\n\tt: [ClobToken, ClobToken]; // YES and NO tokens\n\tmts: number; // min tick size\n\tnr?: boolean; // neg risk (omitted when false)\n\tfd?: FeeDetails; // platform fee details\n\tmbf?: number; // maker base fee\n\ttbf?: number; // taker base fee\n\tr: ClobRewards | null; // rewards config (always present, null if unset)\n\tao?: boolean; // accepting orders\n\tmos?: number; // min order size\n\tsd?: number; // seconds delay\n\tgst?: string; // game start time (ISO 8601)\n\tcbos?: boolean; // clear book on start\n\taot?: string; // accepting orders timestamp (ISO 8601)\n\trfqe?: boolean; // RFQ enabled\n\titode?: boolean; // taker order delay enabled\n\tibce?: boolean; // blockaid check enabled\n}\n\nexport interface PaginationPayload {\n\treadonly limit: number;\n\treadonly count: number;\n\treadonly next_cursor: string;\n\treadonly data: any[];\n}\n\nexport interface BookParams {\n\ttoken_id: string;\n\tside: Side;\n}\n\nexport interface UserEarning {\n\tdate: string;\n\tcondition_id: string;\n\tasset_address: string;\n\tmaker_address: string;\n\tearnings: number;\n\tasset_rate: number;\n}\n\nexport interface TotalUserEarning {\n\tdate: string;\n\tasset_address: string;\n\tmaker_address: string;\n\tearnings: number;\n\tasset_rate: number;\n}\n\nexport interface RewardsPercentages {\n\t[market: string]: number;\n}\n\nexport interface Token {\n\ttoken_id: string;\n\toutcome: string;\n\tprice: number;\n}\n\nexport interface RewardsConfig {\n\tasset_address: string;\n\tstart_date: string;\n\tend_date: string;\n\trate_per_day: number;\n\ttotal_rewards: number;\n}\n\nexport interface MarketReward {\n\tcondition_id: string;\n\tquestion: string;\n\tmarket_slug: string;\n\tevent_slug: string;\n\timage: string;\n\trewards_max_spread: number;\n\trewards_min_size: number;\n\ttokens: Token[];\n\trewards_config: RewardsConfig[];\n}\n\nexport interface Earning {\n\tasset_address: string;\n\tearnings: number;\n\tasset_rate: number;\n}\n\nexport interface UserRewardsEarning {\n\tcondition_id: string;\n\tquestion: string;\n\tmarket_slug: string;\n\tevent_slug: string;\n\timage: string;\n\trewards_max_spread: number;\n\trewards_min_size: number;\n\tmarket_competitiveness: number;\n\ttokens: Token[];\n\trewards_config: RewardsConfig[];\n\tmaker_address: string;\n\tearning_percentage: number;\n\tearnings: Earning[];\n}\n\nexport interface BuilderTrade {\n\tid: string;\n\ttradeType: string;\n\ttakerOrderHash: string;\n\tbuilder: string;\n\tmarket: string;\n\tassetId: string;\n\tside: string;\n\tsize: string;\n\tsizeUsdc: string;\n\tprice: string;\n\tstatus: string;\n\toutcome: string;\n\toutcomeIndex: number;\n\towner: string;\n\tmaker: string;\n\ttransactionHash: string;\n\tmatchTime: string;\n\tbucketIndex: number;\n\tfee: string;\n\tfeeUsdc: string;\n\tbuilderFee: string;\n\tbuilderCode: string;\n\terr_msg?: string | null;\n\tcreatedAt: string | null;\n\tupdatedAt: string | null;\n}\n\nexport interface ReadonlyApiKeyResponse {\n\tapiKey: string;\n}\n\nexport interface MarketTradeEvent {\n\tevent_type: string;\n\tmarket: {\n\t\tcondition_id: string;\n\t\tasset_id: string;\n\t\tquestion: string;\n\t\ticon: string;\n\t\tslug: string;\n\t};\n\tuser: {\n\t\taddress: string;\n\t\tusername: string;\n\t\tprofile_picture: string;\n\t\toptimized_profile_picture: string;\n\t\tpseudonym: string;\n\t};\n\tside: Side;\n\tsize: string;\n\tfee_rate_bps: string;\n\tprice: string;\n\toutcome: string;\n\toutcome_index: number;\n\ttransaction_hash: string;\n\ttimestamp: string;\n}\n\nexport interface BuilderApiKey {\n\tkey: string;\n\tsecret: string;\n\tpassphrase: string;\n}\n\nexport interface BuilderApiKeyResponse {\n\tkey: string;\n\tcreatedAt?: string;\n\trevokedAt?: string;\n}\n\nexport type ClobErrorResponseBody = {\n\terror: string;\n};\n\nexport interface TradesPaginatedResponse {\n\ttrades: Trade[];\n\tnext_cursor: string;\n\tlimit: number;\n\tcount: number;\n}\n\nexport interface BuilderTradesResponse {\n\ttrades: BuilderTrade[];\n\tnext_cursor: string;\n\tlimit: number;\n\tcount: number;\n}\n"],"mappings":";;;AA6CA,IAAY,kDAAL;AACN;AACA;AACA;AACA;;;AA0GD,IAAY,0CAAL;AACN;AACA;;;AAgBD,IAAY,wEAAL;AACN;AACA;AACA;AACA;AACA;;;AAqCD,IAAY,kDAAL;AACN;AACA"}
1
+ {"version":3,"file":"clob.js","names":[],"sources":["../../src/types/clob.ts"],"sourcesContent":["import { Side } from \"../order-utils/model/side.js\";\n\nexport { Side };\n\nexport interface ApiKeyCreds {\n\tkey: string;\n\tsecret: string;\n\tpassphrase: string;\n}\n\nexport interface BuilderConfig {\n\tbuilderCode: string;\n}\n\nexport interface ApiKeyRaw {\n\tapiKey: string;\n\tsecret: string;\n\tpassphrase: string;\n}\n\nexport interface L2HeaderArgs {\n\tmethod: string;\n\trequestPath: string;\n\tbody?: string;\n}\n\nexport type SimpleHeaders = Record<string, string | number | boolean>;\n\n// EIP712 sig verification\nexport interface L1PolyHeader extends SimpleHeaders {\n\tPOLY_ADDRESS: string;\n\tPOLY_SIGNATURE: string;\n\tPOLY_TIMESTAMP: string;\n\tPOLY_NONCE: string;\n}\n\n// API key verification\nexport interface L2PolyHeader extends SimpleHeaders {\n\tPOLY_ADDRESS: string;\n\tPOLY_SIGNATURE: string;\n\tPOLY_TIMESTAMP: string;\n\tPOLY_API_KEY: string;\n\tPOLY_PASSPHRASE: string;\n}\n\nexport enum OrderType {\n\tGTC = \"GTC\",\n\tFOK = \"FOK\",\n\tGTD = \"GTD\",\n\tFAK = \"FAK\",\n}\n\nexport interface OrderPayload {\n\torderID: string;\n}\n\nexport interface OrderResponse {\n\tsuccess: boolean;\n\terrorMsg: string;\n\torderID: string;\n\ttransactionsHashes?: string[];\n\ttradeIDs?: string[];\n\tstatus: string;\n\ttakingAmount: string;\n\tmakingAmount: string;\n}\n\nexport interface OpenOrder {\n\tid: string;\n\tstatus: string;\n\towner: string;\n\tmaker_address: string;\n\tmarket: string;\n\tasset_id: string;\n\tside: string;\n\toriginal_size: string;\n\tsize_matched: string;\n\tprice: string;\n\tassociate_trades: string[];\n\toutcome: string;\n\tcreated_at: number;\n\texpiration: string;\n\torder_type: string;\n}\n\nexport type OpenOrdersResponse = OpenOrder[];\n\nexport type PreMigrationOrder = OpenOrder;\n\nexport type PreMigrationOrdersResponse = PreMigrationOrder[];\n\nexport interface MakerOrder {\n\torder_id: string;\n\towner: string;\n\tmaker_address: string;\n\tmatched_amount: string;\n\tprice: string;\n\tfee_rate_bps: string;\n\tasset_id: string;\n\toutcome: string;\n\tside?: Side;\n\tbuilder_fee?: string;\n\tbuilder_code?: string;\n}\n\nexport interface Trade {\n\tid: string;\n\ttaker_order_id: string;\n\tmarket: string;\n\tasset_id: string;\n\tside: Side;\n\tsize: string;\n\tfee_rate_bps: string;\n\tprice: string;\n\tstatus: string;\n\tmatch_time: string;\n\tmatch_time_nano?: string;\n\tlast_update: string;\n\toutcome: string;\n\tbucket_index: number;\n\towner: string;\n\tmaker_address: string;\n\tmaker_orders: MakerOrder[];\n\ttransaction_hash?: string;\n\terr_msg?: string | null;\n\ttrader_side: \"TAKER\" | \"MAKER\";\n}\n\nexport interface ApiKeysResponse {\n\tapiKeys: ApiKeyCreds[];\n}\n\nexport interface BanStatus {\n\tclosed_only: boolean;\n}\n\nexport interface TradeParams {\n\tid?: string;\n\tmaker_address?: string;\n\tmarket?: string;\n\tasset_id?: string;\n\tbefore?: string;\n\tafter?: string;\n}\n\nexport interface BuilderTradeParams extends TradeParams {\n\tbuilder_code: string;\n}\n\nexport interface OpenOrderParams {\n\tid?: string;\n\tmarket?: string;\n\tasset_id?: string;\n}\n\nexport enum Chain {\n\tPOLYGON = 137,\n\tAMOY = 80002,\n}\n\nexport interface MarketPrice {\n\tt: number; // timestamp\n\tp: number; // price\n}\n\nexport interface PriceHistoryFilterParams {\n\tmarket?: string;\n\tstartTs?: number;\n\tendTs?: number;\n\tfidelity?: number;\n\tinterval?: PriceHistoryInterval;\n}\n\nexport enum PriceHistoryInterval {\n\tMAX = \"max\",\n\tONE_WEEK = \"1w\",\n\tONE_DAY = \"1d\",\n\tSIX_HOURS = \"6h\",\n\tONE_HOUR = \"1h\",\n}\n\nexport interface DropNotificationParams {\n\tids: string[];\n}\n\nexport interface Notification {\n\ttype: number;\n\towner: string;\n\n\tpayload: any;\n}\n\nexport interface OrderMarketCancelParams {\n\tmarket?: string;\n\tasset_id?: string;\n}\n\nexport interface OrderBookSummary {\n\tmarket: string;\n\tasset_id: string;\n\ttimestamp: string;\n\tbids: OrderSummary[];\n\tasks: OrderSummary[];\n\tmin_order_size: string;\n\ttick_size: string;\n\tneg_risk: boolean;\n\thash: string;\n\tlast_trade_price: string;\n}\n\nexport interface OrderSummary {\n\tprice: string;\n\tsize: string;\n}\n\nexport enum AssetType {\n\tCOLLATERAL = \"COLLATERAL\",\n\tCONDITIONAL = \"CONDITIONAL\",\n}\n\nexport interface BalanceAllowanceParams {\n\tasset_type: AssetType;\n\ttoken_id?: string;\n}\n\nexport interface BalanceAllowanceResponse {\n\tbalance: string;\n\tallowances: Record<string, string>;\n}\n\nexport interface OrderScoringParams {\n\torder_id: string;\n}\n\nexport interface OrderScoring {\n\tscoring: boolean;\n}\n\nexport interface OrdersScoringParams {\n\torderIds: string[];\n}\n\nexport type OrdersScoring = { [orderId in string]: boolean };\n\nexport type OrderVersion = 1 | 2 | 3;\n\nexport type CreateOrderOptions = {\n\ttickSize: TickSize;\n\tnegRisk?: boolean;\n\tversion?: OrderVersion;\n};\n\nexport type TickSize = \"0.1\" | \"0.01\" | \"0.005\" | \"0.0025\" | \"0.001\" | \"0.0001\";\n\nexport interface RoundConfig {\n\treadonly price: number;\n\treadonly size: number;\n\treadonly amount: number;\n}\n\nexport interface TickSizes {\n\t[tokenId: string]: TickSize;\n}\n\nexport interface FeeRates {\n\t[tokenId: string]: number;\n}\n\nexport interface NegRisk {\n\t[tokenId: string]: boolean;\n}\n\nexport interface FeeInfo {\n\trate: number;\n\texponent: number;\n}\n\nexport interface FeeInfos {\n\t[tokenId: string]: FeeInfo;\n}\n\nexport interface BuilderFeeRates {\n\t[builderCode: string]: { maker: number; taker: number };\n}\n\nexport type TokenConditionMap = Record<string, string>;\n\nexport interface FeeDetails {\n\tr?: number; // fee rate\n\te?: number; // fee exponent\n\tto?: boolean; // taker only (omitted when false)\n}\n\nexport interface ClobRewards {\n\tmi?: number; // min size\n\tma?: number; // max spread\n\te?: boolean; // enabled\n\tsmoa?: boolean; // skip min order age\n\tmoas?: number; // min order age seconds\n}\n\nexport interface ClobToken {\n\tt: string; // token ID\n\to: string; // outcome\n}\n\nexport interface MarketDetails {\n\tc: string; // condition ID\n\tt: [ClobToken, ClobToken]; // YES and NO tokens\n\tmts: number; // min tick size\n\tnr?: boolean; // neg risk (omitted when false)\n\tfd?: FeeDetails; // platform fee details\n\tmbf?: number; // maker base fee\n\ttbf?: number; // taker base fee\n\tr: ClobRewards | null; // rewards config (always present, null if unset)\n\tao?: boolean; // accepting orders\n\tmos?: number; // min order size\n\tsd?: number; // seconds delay\n\tgst?: string; // game start time (ISO 8601)\n\tcbos?: boolean; // clear book on start\n\taot?: string; // accepting orders timestamp (ISO 8601)\n\trfqe?: boolean; // RFQ enabled\n\titode?: boolean; // taker order delay enabled\n\tibce?: boolean; // blockaid check enabled\n}\n\nexport interface PaginationPayload {\n\treadonly limit: number;\n\treadonly count: number;\n\treadonly next_cursor: string;\n\treadonly data: any[];\n}\n\nexport interface BookParams {\n\ttoken_id: string;\n\tside: Side;\n}\n\nexport interface UserEarning {\n\tdate: string;\n\tcondition_id: string;\n\tasset_address: string;\n\tmaker_address: string;\n\tearnings: number;\n\tasset_rate: number;\n}\n\nexport interface TotalUserEarning {\n\tdate: string;\n\tasset_address: string;\n\tmaker_address: string;\n\tearnings: number;\n\tasset_rate: number;\n}\n\nexport interface RewardsPercentages {\n\t[market: string]: number;\n}\n\nexport interface Token {\n\ttoken_id: string;\n\toutcome: string;\n\tprice: number;\n}\n\nexport interface RewardsConfig {\n\tasset_address: string;\n\tstart_date: string;\n\tend_date: string;\n\trate_per_day: number;\n\ttotal_rewards: number;\n}\n\nexport interface MarketReward {\n\tcondition_id: string;\n\tquestion: string;\n\tmarket_slug: string;\n\tevent_slug: string;\n\timage: string;\n\trewards_max_spread: number;\n\trewards_min_size: number;\n\ttokens: Token[];\n\trewards_config: RewardsConfig[];\n}\n\nexport interface Earning {\n\tasset_address: string;\n\tearnings: number;\n\tasset_rate: number;\n}\n\nexport interface UserRewardsEarning {\n\tcondition_id: string;\n\tquestion: string;\n\tmarket_slug: string;\n\tevent_slug: string;\n\timage: string;\n\trewards_max_spread: number;\n\trewards_min_size: number;\n\tmarket_competitiveness: number;\n\ttokens: Token[];\n\trewards_config: RewardsConfig[];\n\tmaker_address: string;\n\tearning_percentage: number;\n\tearnings: Earning[];\n}\n\nexport interface BuilderTrade {\n\tid: string;\n\ttradeType: string;\n\ttakerOrderHash: string;\n\tbuilder: string;\n\tmarket: string;\n\tassetId: string;\n\tside: string;\n\tsize: string;\n\tsizeUsdc: string;\n\tprice: string;\n\tstatus: string;\n\toutcome: string;\n\toutcomeIndex: number;\n\towner: string;\n\tmaker: string;\n\ttransactionHash: string;\n\tmatchTime: string;\n\tbucketIndex: number;\n\tfee: string;\n\tfeeUsdc: string;\n\tbuilderFee: string;\n\tbuilderCode: string;\n\terr_msg?: string | null;\n\tcreatedAt: string | null;\n\tupdatedAt: string | null;\n}\n\nexport interface ReadonlyApiKeyResponse {\n\tapiKey: string;\n}\n\nexport interface MarketTradeEvent {\n\tevent_type: string;\n\tmarket: {\n\t\tcondition_id: string;\n\t\tasset_id: string;\n\t\tquestion: string;\n\t\ticon: string;\n\t\tslug: string;\n\t};\n\tuser: {\n\t\taddress: string;\n\t\tusername: string;\n\t\tprofile_picture: string;\n\t\toptimized_profile_picture: string;\n\t\tpseudonym: string;\n\t};\n\tside: Side;\n\tsize: string;\n\tfee_rate_bps: string;\n\tprice: string;\n\toutcome: string;\n\toutcome_index: number;\n\ttransaction_hash: string;\n\ttimestamp: string;\n}\n\nexport interface BuilderApiKey {\n\tkey: string;\n\tsecret: string;\n\tpassphrase: string;\n}\n\nexport interface BuilderApiKeyResponse {\n\tkey: string;\n\tcreatedAt?: string;\n\trevokedAt?: string;\n}\n\nexport type ClobErrorResponseBody = {\n\terror: string;\n};\n\nexport interface TradesPaginatedResponse {\n\ttrades: Trade[];\n\tnext_cursor: string;\n\tlimit: number;\n\tcount: number;\n}\n\nexport interface BuilderTradesResponse {\n\ttrades: BuilderTrade[];\n\tnext_cursor: string;\n\tlimit: number;\n\tcount: number;\n}\n"],"mappings":";;;AA6CA,IAAY,kDAAL;AACN;AACA;AACA;AACA;;;AA0GD,IAAY,0CAAL;AACN;AACA;;;AAgBD,IAAY,wEAAL;AACN;AACA;AACA;AACA;AACA;;;AAqCD,IAAY,kDAAL;AACN;AACA"}
@@ -1,5 +1,6 @@
1
1
  import { Side } from "../order-utils/model/side.js";
2
- import { ApiKeyCreds, ApiKeyRaw, ApiKeysResponse, AssetType, BalanceAllowanceParams, BalanceAllowanceResponse, BanStatus, BookParams, BuilderApiKey, BuilderApiKeyResponse, BuilderConfig, BuilderFeeRates, BuilderTrade, BuilderTradeParams, BuilderTradesResponse, Chain, ClobErrorResponseBody, ClobRewards, ClobToken, CreateOrderOptions, DropNotificationParams, Earning, FeeDetails, FeeInfo, FeeInfos, FeeRates, L1PolyHeader, L2HeaderArgs, L2PolyHeader, MakerOrder, MarketDetails, MarketPrice, MarketReward, MarketTradeEvent, NegRisk, Notification, OpenOrder, OpenOrderParams, OpenOrdersResponse, OrderBookSummary, OrderMarketCancelParams, OrderPayload, OrderResponse, OrderScoring, OrderScoringParams, OrderSummary, OrderType, OrdersScoring, OrdersScoringParams, PaginationPayload, PreMigrationOrder, PreMigrationOrdersResponse, PriceHistoryFilterParams, PriceHistoryInterval, ReadonlyApiKeyResponse, RewardsConfig, RewardsPercentages, RoundConfig, SimpleHeaders, TickSize, TickSizes, Token, TokenConditionMap, TotalUserEarning, Trade, TradeParams, TradesPaginatedResponse, UserEarning, UserRewardsEarning } from "./clob.js";
2
+ import { ApiKeyCreds, ApiKeyRaw, ApiKeysResponse, AssetType, BalanceAllowanceParams, BalanceAllowanceResponse, BanStatus, BookParams, BuilderApiKey, BuilderApiKeyResponse, BuilderConfig, BuilderFeeRates, BuilderTrade, BuilderTradeParams, BuilderTradesResponse, Chain, ClobErrorResponseBody, ClobRewards, ClobToken, CreateOrderOptions, DropNotificationParams, Earning, FeeDetails, FeeInfo, FeeInfos, FeeRates, L1PolyHeader, L2HeaderArgs, L2PolyHeader, MakerOrder, MarketDetails, MarketPrice, MarketReward, MarketTradeEvent, NegRisk, Notification, OpenOrder, OpenOrderParams, OpenOrdersResponse, OrderBookSummary, OrderMarketCancelParams, OrderPayload, OrderResponse, OrderScoring, OrderScoringParams, OrderSummary, OrderType, OrderVersion, OrdersScoring, OrdersScoringParams, PaginationPayload, PreMigrationOrder, PreMigrationOrdersResponse, PriceHistoryFilterParams, PriceHistoryInterval, ReadonlyApiKeyResponse, RewardsConfig, RewardsPercentages, RoundConfig, SimpleHeaders, TickSize, TickSizes, Token, TokenConditionMap, TotalUserEarning, Trade, TradeParams, TradesPaginatedResponse, UserEarning, UserRewardsEarning } from "./clob.js";
3
3
  import { NewOrderV1, PostOrdersV1Args, UserMarketOrderV1, UserOrderV1, orderToJsonV1 } from "./ordersV1.js";
4
4
  import { NewOrderV2, PostOrdersV2Args, UserMarketOrderV2, UserOrderV2, orderToJsonV2 } from "./ordersV2.js";
5
+ import { ExchangeV3OrderAmounts } from "./ordersV3.js";
5
6
  import { PostOrdersArgs, SignedOrder, VersionedPostOrdersArgs, VersionedSignedOrder, VersionedUserMarketOrder, VersionedUserOrder, isV2Order } from "./unifiedOrder.js";
@@ -0,0 +1,43 @@
1
+ import { Side } from "../order-utils/model/side.cjs";
2
+
3
+ //#region src/types/ordersV3.d.ts
4
+
5
+ /**
6
+ * ExchangeV3 order expressed directly in token base units.
7
+ *
8
+ * This is intended for callers that already performed exact integer sizing and
9
+ * must not pass through the price/tick rounding used by the CLOB order API.
10
+ */
11
+ interface ExchangeV3OrderAmounts {
12
+ /**
13
+ * TokenID of the Conditional token asset being traded
14
+ */
15
+ tokenID: string;
16
+ /**
17
+ * Exact maker amount in base units
18
+ */
19
+ makerAmount: string;
20
+ /**
21
+ * Exact taker amount in base units
22
+ */
23
+ takerAmount: string;
24
+ /**
25
+ * Side of the order
26
+ */
27
+ side: Side;
28
+ /**
29
+ * Metadata (bytes32)
30
+ */
31
+ metadata?: string;
32
+ /**
33
+ * Builder code (bytes32)
34
+ */
35
+ builderCode?: string;
36
+ /**
37
+ * Expiration timestamp (unix seconds). Defaults to 0 (no expiration).
38
+ */
39
+ expiration?: number;
40
+ }
41
+ //#endregion
42
+ export { ExchangeV3OrderAmounts };
43
+ //# sourceMappingURL=ordersV3.d.cts.map
@@ -0,0 +1,43 @@
1
+ import { Side } from "../order-utils/model/side.js";
2
+
3
+ //#region src/types/ordersV3.d.ts
4
+
5
+ /**
6
+ * ExchangeV3 order expressed directly in token base units.
7
+ *
8
+ * This is intended for callers that already performed exact integer sizing and
9
+ * must not pass through the price/tick rounding used by the CLOB order API.
10
+ */
11
+ interface ExchangeV3OrderAmounts {
12
+ /**
13
+ * TokenID of the Conditional token asset being traded
14
+ */
15
+ tokenID: string;
16
+ /**
17
+ * Exact maker amount in base units
18
+ */
19
+ makerAmount: string;
20
+ /**
21
+ * Exact taker amount in base units
22
+ */
23
+ takerAmount: string;
24
+ /**
25
+ * Side of the order
26
+ */
27
+ side: Side;
28
+ /**
29
+ * Metadata (bytes32)
30
+ */
31
+ metadata?: string;
32
+ /**
33
+ * Builder code (bytes32)
34
+ */
35
+ builderCode?: string;
36
+ /**
37
+ * Expiration timestamp (unix seconds). Defaults to 0 (no expiration).
38
+ */
39
+ expiration?: number;
40
+ }
41
+ //#endregion
42
+ export { ExchangeV3OrderAmounts };
43
+ //# sourceMappingURL=ordersV3.d.ts.map
@@ -1,7 +1,7 @@
1
1
 
2
2
  //#region src/types/unifiedOrder.ts
3
3
  function isV2Order(order) {
4
- if ("version" in order && "order" in order) return order.version === 2;
4
+ if ("version" in order && "order" in order) return order.version === 2 || order.version === 3;
5
5
  return "timestamp" in order && "metadata" in order && "builder" in order;
6
6
  }
7
7
 
@@ -1 +1 @@
1
- {"version":3,"file":"unifiedOrder.cjs","names":[],"sources":["../../src/types/unifiedOrder.ts"],"sourcesContent":["import type { SignedOrderV1, SignedOrderV2 } from \"../order-utils/index.js\";\nimport type { OrderType } from \"./clob.js\";\nimport type { PostOrdersV1Args, UserMarketOrderV1, UserOrderV1 } from \"./ordersV1.js\";\nimport type { PostOrdersV2Args, UserMarketOrderV2, UserOrderV2 } from \"./ordersV2.js\";\n\nexport type SignedOrder = SignedOrderV1 | SignedOrderV2;\n\nexport type PostOrdersArgs = { order: SignedOrder; orderType: OrderType };\n\nexport type VersionedSignedOrder =\n\t| { version: 1; order: SignedOrderV1 }\n\t| { version: 2; order: SignedOrderV2 };\n\nexport type VersionedUserOrder =\n\t| { version: 1; order: UserOrderV1 }\n\t| { version: 2; order: UserOrderV2 };\n\nexport type VersionedUserMarketOrder =\n\t| { version: 1; order: UserMarketOrderV1 }\n\t| { version: 2; order: UserMarketOrderV2 };\n\nexport type VersionedPostOrdersArgs =\n\t| { version: 1; args: PostOrdersV1Args }\n\t| { version: 2; args: PostOrdersV2Args };\n\nexport function isV2Order(order: SignedOrder | VersionedSignedOrder): order is SignedOrderV2 {\n\tif (\"version\" in order && \"order\" in order) {\n\t\t// VersionedSignedOrder type\n\t\treturn order.version === 2;\n\t}\n\t// Check for V2-specific fields\n\treturn \"timestamp\" in order && \"metadata\" in order && \"builder\" in order;\n}\n"],"mappings":";;AAyBA,SAAgB,UAAU,OAAmE;AAC5F,KAAI,aAAa,SAAS,WAAW,MAEpC,QAAO,MAAM,YAAY;AAG1B,QAAO,eAAe,SAAS,cAAc,SAAS,aAAa"}
1
+ {"version":3,"file":"unifiedOrder.cjs","names":[],"sources":["../../src/types/unifiedOrder.ts"],"sourcesContent":["import type { SignedOrderV1, SignedOrderV2 } from \"../order-utils/index.js\";\nimport type { OrderType } from \"./clob.js\";\nimport type { PostOrdersV1Args, UserMarketOrderV1, UserOrderV1 } from \"./ordersV1.js\";\nimport type { PostOrdersV2Args, UserMarketOrderV2, UserOrderV2 } from \"./ordersV2.js\";\n\nexport type SignedOrder = SignedOrderV1 | SignedOrderV2;\n\nexport type PostOrdersArgs = { order: SignedOrder; orderType: OrderType };\n\nexport type VersionedSignedOrder =\n\t| { version: 1; order: SignedOrderV1 }\n\t| { version: 2; order: SignedOrderV2 }\n\t| { version: 3; order: SignedOrderV2 };\n\nexport type VersionedUserOrder =\n\t| { version: 1; order: UserOrderV1 }\n\t| { version: 2; order: UserOrderV2 }\n\t| { version: 3; order: UserOrderV2 };\n\nexport type VersionedUserMarketOrder =\n\t| { version: 1; order: UserMarketOrderV1 }\n\t| { version: 2; order: UserMarketOrderV2 }\n\t| { version: 3; order: UserMarketOrderV2 };\n\nexport type VersionedPostOrdersArgs =\n\t| { version: 1; args: PostOrdersV1Args }\n\t| { version: 2; args: PostOrdersV2Args }\n\t| { version: 3; args: PostOrdersV2Args };\n\nexport function isV2Order(order: SignedOrder | VersionedSignedOrder): order is SignedOrderV2 {\n\tif (\"version\" in order && \"order\" in order) {\n\t\t// VersionedSignedOrder type\n\t\treturn order.version === 2 || order.version === 3;\n\t}\n\t// Check for V2-specific fields\n\treturn \"timestamp\" in order && \"metadata\" in order && \"builder\" in order;\n}\n"],"mappings":";;AA6BA,SAAgB,UAAU,OAAmE;AAC5F,KAAI,aAAa,SAAS,WAAW,MAEpC,QAAO,MAAM,YAAY,KAAK,MAAM,YAAY;AAGjD,QAAO,eAAe,SAAS,cAAc,SAAS,aAAa"}
@@ -16,6 +16,9 @@ type VersionedSignedOrder = {
16
16
  } | {
17
17
  version: 2;
18
18
  order: SignedOrderV2;
19
+ } | {
20
+ version: 3;
21
+ order: SignedOrderV2;
19
22
  };
20
23
  type VersionedUserOrder = {
21
24
  version: 1;
@@ -23,6 +26,9 @@ type VersionedUserOrder = {
23
26
  } | {
24
27
  version: 2;
25
28
  order: UserOrderV2;
29
+ } | {
30
+ version: 3;
31
+ order: UserOrderV2;
26
32
  };
27
33
  type VersionedUserMarketOrder = {
28
34
  version: 1;
@@ -30,6 +36,9 @@ type VersionedUserMarketOrder = {
30
36
  } | {
31
37
  version: 2;
32
38
  order: UserMarketOrderV2;
39
+ } | {
40
+ version: 3;
41
+ order: UserMarketOrderV2;
33
42
  };
34
43
  type VersionedPostOrdersArgs = {
35
44
  version: 1;
@@ -37,6 +46,9 @@ type VersionedPostOrdersArgs = {
37
46
  } | {
38
47
  version: 2;
39
48
  args: PostOrdersV2Args;
49
+ } | {
50
+ version: 3;
51
+ args: PostOrdersV2Args;
40
52
  };
41
53
  declare function isV2Order(order: SignedOrder | VersionedSignedOrder): order is SignedOrderV2;
42
54
  //#endregion
@@ -17,6 +17,9 @@ type VersionedSignedOrder = {
17
17
  } | {
18
18
  version: 2;
19
19
  order: SignedOrderV2;
20
+ } | {
21
+ version: 3;
22
+ order: SignedOrderV2;
20
23
  };
21
24
  type VersionedUserOrder = {
22
25
  version: 1;
@@ -24,6 +27,9 @@ type VersionedUserOrder = {
24
27
  } | {
25
28
  version: 2;
26
29
  order: UserOrderV2;
30
+ } | {
31
+ version: 3;
32
+ order: UserOrderV2;
27
33
  };
28
34
  type VersionedUserMarketOrder = {
29
35
  version: 1;
@@ -31,6 +37,9 @@ type VersionedUserMarketOrder = {
31
37
  } | {
32
38
  version: 2;
33
39
  order: UserMarketOrderV2;
40
+ } | {
41
+ version: 3;
42
+ order: UserMarketOrderV2;
34
43
  };
35
44
  type VersionedPostOrdersArgs = {
36
45
  version: 1;
@@ -38,6 +47,9 @@ type VersionedPostOrdersArgs = {
38
47
  } | {
39
48
  version: 2;
40
49
  args: PostOrdersV2Args;
50
+ } | {
51
+ version: 3;
52
+ args: PostOrdersV2Args;
41
53
  };
42
54
  declare function isV2Order(order: SignedOrder | VersionedSignedOrder): order is SignedOrderV2;
43
55
  //#endregion
@@ -1,6 +1,6 @@
1
1
  //#region src/types/unifiedOrder.ts
2
2
  function isV2Order(order) {
3
- if ("version" in order && "order" in order) return order.version === 2;
3
+ if ("version" in order && "order" in order) return order.version === 2 || order.version === 3;
4
4
  return "timestamp" in order && "metadata" in order && "builder" in order;
5
5
  }
6
6
 
@@ -1 +1 @@
1
- {"version":3,"file":"unifiedOrder.js","names":[],"sources":["../../src/types/unifiedOrder.ts"],"sourcesContent":["import type { SignedOrderV1, SignedOrderV2 } from \"../order-utils/index.js\";\nimport type { OrderType } from \"./clob.js\";\nimport type { PostOrdersV1Args, UserMarketOrderV1, UserOrderV1 } from \"./ordersV1.js\";\nimport type { PostOrdersV2Args, UserMarketOrderV2, UserOrderV2 } from \"./ordersV2.js\";\n\nexport type SignedOrder = SignedOrderV1 | SignedOrderV2;\n\nexport type PostOrdersArgs = { order: SignedOrder; orderType: OrderType };\n\nexport type VersionedSignedOrder =\n\t| { version: 1; order: SignedOrderV1 }\n\t| { version: 2; order: SignedOrderV2 };\n\nexport type VersionedUserOrder =\n\t| { version: 1; order: UserOrderV1 }\n\t| { version: 2; order: UserOrderV2 };\n\nexport type VersionedUserMarketOrder =\n\t| { version: 1; order: UserMarketOrderV1 }\n\t| { version: 2; order: UserMarketOrderV2 };\n\nexport type VersionedPostOrdersArgs =\n\t| { version: 1; args: PostOrdersV1Args }\n\t| { version: 2; args: PostOrdersV2Args };\n\nexport function isV2Order(order: SignedOrder | VersionedSignedOrder): order is SignedOrderV2 {\n\tif (\"version\" in order && \"order\" in order) {\n\t\t// VersionedSignedOrder type\n\t\treturn order.version === 2;\n\t}\n\t// Check for V2-specific fields\n\treturn \"timestamp\" in order && \"metadata\" in order && \"builder\" in order;\n}\n"],"mappings":";AAyBA,SAAgB,UAAU,OAAmE;AAC5F,KAAI,aAAa,SAAS,WAAW,MAEpC,QAAO,MAAM,YAAY;AAG1B,QAAO,eAAe,SAAS,cAAc,SAAS,aAAa"}
1
+ {"version":3,"file":"unifiedOrder.js","names":[],"sources":["../../src/types/unifiedOrder.ts"],"sourcesContent":["import type { SignedOrderV1, SignedOrderV2 } from \"../order-utils/index.js\";\nimport type { OrderType } from \"./clob.js\";\nimport type { PostOrdersV1Args, UserMarketOrderV1, UserOrderV1 } from \"./ordersV1.js\";\nimport type { PostOrdersV2Args, UserMarketOrderV2, UserOrderV2 } from \"./ordersV2.js\";\n\nexport type SignedOrder = SignedOrderV1 | SignedOrderV2;\n\nexport type PostOrdersArgs = { order: SignedOrder; orderType: OrderType };\n\nexport type VersionedSignedOrder =\n\t| { version: 1; order: SignedOrderV1 }\n\t| { version: 2; order: SignedOrderV2 }\n\t| { version: 3; order: SignedOrderV2 };\n\nexport type VersionedUserOrder =\n\t| { version: 1; order: UserOrderV1 }\n\t| { version: 2; order: UserOrderV2 }\n\t| { version: 3; order: UserOrderV2 };\n\nexport type VersionedUserMarketOrder =\n\t| { version: 1; order: UserMarketOrderV1 }\n\t| { version: 2; order: UserMarketOrderV2 }\n\t| { version: 3; order: UserMarketOrderV2 };\n\nexport type VersionedPostOrdersArgs =\n\t| { version: 1; args: PostOrdersV1Args }\n\t| { version: 2; args: PostOrdersV2Args }\n\t| { version: 3; args: PostOrdersV2Args };\n\nexport function isV2Order(order: SignedOrder | VersionedSignedOrder): order is SignedOrderV2 {\n\tif (\"version\" in order && \"order\" in order) {\n\t\t// VersionedSignedOrder type\n\t\treturn order.version === 2 || order.version === 3;\n\t}\n\t// Check for V2-specific fields\n\treturn \"timestamp\" in order && \"metadata\" in order && \"builder\" in order;\n}\n"],"mappings":";AA6BA,SAAgB,UAAU,OAAmE;AAC5F,KAAI,aAAa,SAAS,WAAW,MAEpC,QAAO,MAAM,YAAY,KAAK,MAAM,YAAY;AAGjD,QAAO,eAAe,SAAS,cAAc,SAAS,aAAa"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@polymarket/clob-client-v2",
3
3
  "description": "TypeScript client for Polymarket's CLOB",
4
- "version": "1.0.6",
4
+ "version": "1.0.8",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
7
7
  "types": "dist/index.d.ts",