-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update /paymentTxParams and /submitPaymentTx endpoints to work with Slice payloads #12
base: main
Are you sure you want to change the base?
Conversation
import { http } from 'viem'; | ||
|
||
// Create a Wagmi config, and get the relayed slice data | ||
export const wagmiConfig = createConfig({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need more mappings? or does Slice only support 8453 right now?
let value = txMessage.rpcProxySubmissionParams.typedData.message.value; | ||
if (txMessage.additionalPayload.cartParams && txMessage.additionalPayload.slicerId) { | ||
// construct the cart using the slicekit to calculate the total amount | ||
value = await getSliceCartUsdcPrice({ cartParams: txMessage.additionalPayload.cartParams, slicerId: txMessage.additionalPayload.slicerId }); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move this logic to a formatSliceTxMessageReponse
helper as well
allProducts, | ||
}); | ||
|
||
console.log({ cart }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to remove the console logs after we're sure implementation is the correct one
if (additionalPayload) { | ||
const { txHash } = await relayPayWithAuthorization({ | ||
cartParams: additionalPayload.cartParams, | ||
slicerId: additionalPayload.slicerId, | ||
totalUsdcPrice: value, | ||
buyer: from, | ||
chainId, | ||
signature, | ||
authorizationParams: { | ||
from, | ||
nonce, | ||
to, | ||
validAfter, | ||
validBefore, | ||
value, | ||
}, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed during Sync: Let's move this to a new endpoint called submitSlicePaymentTx
No description provided.