Skip to content

Commit

Permalink
fix deadlines
Browse files Browse the repository at this point in the history
  • Loading branch information
0xNe0x1 committed Sep 25, 2024
1 parent 51715a9 commit 2100b36
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

window._debug(`window?.WorldApp: ${window?.WorldApp ? JSON.stringify(window?.WorldApp) : undefined}`)

window._debug(`v19`)
window._debug(`v20`)

});

Expand Down Expand Up @@ -298,7 +298,7 @@ <h5 class="px-4">WorldApp SendTransaction tuple</h5>
transferDetails.requestedAmount,
]

const paymentDeadline = Date.now() + 30 * 60 * 1000; // Current time + 30 minutes (in ms)
const paymentDeadline = permitDeadline * 1000; // permitDeadline in ms

WorldcoinPrecompiled.MiniKit.subscribe(WorldcoinPrecompiled.ResponseEvent.MiniAppSendTransaction, async (payload) => {
window._debug(JSON.stringify(payload))
Expand Down Expand Up @@ -416,7 +416,7 @@ <h5 class="px-4">WorldApp SendTransaction tuple with explicit method with args</
transferDetails.requestedAmount,
]

const paymentDeadline = Date.now() + 30 * 60 * 1000; // Current time + 30 minutes (in ms)
const paymentDeadline = permitDeadline * 1000; // permitDeadline in ms

WorldcoinPrecompiled.MiniKit.subscribe(WorldcoinPrecompiled.ResponseEvent.MiniAppSendTransaction, async (payload) => {
window._debug(JSON.stringify(payload))
Expand Down Expand Up @@ -577,7 +577,37 @@ <h5 class="px-4">Test DePay V3 SignatureTransfer</h5>
})
console.log('signature', signature)

const paymentDeadline = Date.now() + 30 * 60 * 1000; // Current time + 30 minutes (in ms)
const paymentDeadline = permitDeadline * 1000; // permitDeadline in ms

console.log([
[ // payment
amount.toString(), // amountIn
amount.toString(), // paymentAmount
"0", // feeAmount
"0", // protocolAmount
paymentDeadline, // deadline
USDCE, // tokenInAddress
ZERO_ADDRESS, // exchangeAddress
USDCE, // tokenOutAddress
PAYMENT_RECEIVER, // paymentReceiverAddress
ZERO_ADDRESS, // feeReceiverAddress
0, // exchangeType
0, // receiverType
true, // permit2
ZERO_BYTES, // exchangeCallData
ZERO_BYTES, // receiverCallData
],
[ // permitTransferFromAndSignature
[ // permitTransferFrom
[ // permitted
USDCE, // token
amount.toString() // amount
],
nonce.toString(), // nonce
permitDeadline.toString() // deadline
],
signature
]])

await wallet.sendTransaction({
blockchain: "optimism",
Expand Down

0 comments on commit 2100b36

Please sign in to comment.