{"version":3,"file":"eip712.cjs","names":["getSignerAddress","signTypedDataWithSigner","MSG_TO_SIGN"],"sources":["../../src/signing/eip712.ts"],"sourcesContent":["import type { Chain } from \"../types/index.js\";\n\nimport { MSG_TO_SIGN } from \"./constants.js\";\nimport { type ClobSigner, getSignerAddress, signTypedDataWithSigner } from \"./signer.js\";\n\n/**\n * Builds the canonical Polymarket CLOB EIP712 signature\n * @param signer\n * @param ts\n * @returns string\n */\nexport const buildClobEip712Signature = async (\n\tsigner: ClobSigner,\n\tchainId: Chain,\n\ttimestamp: number,\n\tnonce: number,\n\taddress?: string,\n): Promise<string> => {\n\tconst resolvedAddress = address ?? (await getSignerAddress(signer));\n\tconst ts = timestamp.toString();\n\n\tconst domain = {\n\t\tname: \"ClobAuthDomain\",\n\t\tversion: \"1\",\n\t\tchainId: chainId,\n\t};\n\n\tconst types = {\n\t\tClobAuth: [\n\t\t\t{ name: \"address\", type: \"address\" },\n\t\t\t{ name: \"timestamp\", type: \"string\" },\n\t\t\t{ name: \"nonce\", type: \"uint256\" },\n\t\t\t{ name: \"message\", type: \"string\" },\n\t\t],\n\t};\n\tconst value = {\n\t\taddress: resolvedAddress,\n\t\ttimestamp: ts,\n\t\tnonce,\n\t\tmessage: MSG_TO_SIGN,\n\t};\n\tconst sig = await signTypedDataWithSigner({\n\t\tsigner,\n\t\tdomain,\n\t\ttypes,\n\t\tvalue,\n\t\tprimaryType: \"ClobAuth\",\n\t});\n\treturn sig;\n};\n"],"mappings":";;;;;;;;;;AAWA,MAAa,2BAA2B,OACvC,QACA,SACA,WACA,OACA,YACqB;CACrB,MAAM,kBAAkB,WAAY,MAAMA,gCAAiB,OAAO;CAClE,MAAM,KAAK,UAAU,UAAU;AA6B/B,QAPY,MAAMC,uCAAwB;EACzC;EACA,QAtBc;GACd,MAAM;GACN,SAAS;GACA;GACT;EAmBA,OAjBa,EACb,UAAU;GACT;IAAE,MAAM;IAAW,MAAM;IAAW;GACpC;IAAE,MAAM;IAAa,MAAM;IAAU;GACrC;IAAE,MAAM;IAAS,MAAM;IAAW;GAClC;IAAE,MAAM;IAAW,MAAM;IAAU;GACnC,EACD;EAWA,OAVa;GACb,SAAS;GACT,WAAW;GACX;GACA,SAASC;GACT;EAMA,aAAa;EACb,CAAC"}