When receiving a Request for Quote (RFQ) while interacting with both the Upshot Pool and the Upshot Vault, you need to sign the EIP712 data twice. This is because each protocol requires a separate signature. If you use the same wallet to create both the Upshot Pool and Upshot Vault, you can utilize that wallet to sign for both protocols.
Example Message
{"messageType": "rfqT";"message": {"protocols": ["pool","vault"],"data": {"rfqId": string;"source": string;"nonce": number;"baseToken": string;"quoteToken": string;"trader": string;"effectiveTrader": string;"baseTokenAmount"?: number;"quoteTokenAmount"?: number;"baseChain": {"chainType": string;"chainId": number; };"quoteChain": {"chainType": string;"chainId": number; };"feesBps": number;"pool": {},// This data is for signing EIP712, but you can ignore it."vault": {}, } }}
Below is the adjusted code to handle signing the RFQ data for both the Upshot Pool and Upshot Vault:
Example: Receiving the RFQ, Signing EIP712 Data, and Sending Back RFQQuote
The following code snippet demonstrates how to receive a Request for Quote (RFQ) via the socket, sign the EIP712 data, and then send back the signed RFQQuote. You will need to fill in the fulfilledAmount, poolAddress, and externalAccount based on your specific setup.
The fulfilledAmount: This is the amount that the Upshot Pool will fulfill in response to the RFQ. Make sure to set this value based on the specific asset being traded, represented in its smallest unit.
The poolAddress: Set this to the Upshot Pool address obtained during the pool creation step.
The externalAccount: Set this to the Upshot Vault address, linking the RFQ to the vault's assets for the transaction.