From 7258ee0e081861094a332ced40a85d1dc95899af Mon Sep 17 00:00:00 2001 From: 0xExp-po Date: Tue, 10 Dec 2024 00:32:04 +0900 Subject: [PATCH] chore: add console log to check delegation --- dapp/src/pages/api/w3up-delegation.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dapp/src/pages/api/w3up-delegation.js b/dapp/src/pages/api/w3up-delegation.js index cbbb14e..b8a4737 100644 --- a/dapp/src/pages/api/w3up-delegation.js +++ b/dapp/src/pages/api/w3up-delegation.js @@ -47,11 +47,19 @@ async function backend(did) { "filecoin/offer", "upload/add", ]; - const expiration = Math.floor(Date.now() / 1000) + 10; + const expiration = Math.floor(Date.now() / 1000) + 86400; + const expirationDate = new Date(expiration * 1000); + console.log("expiration time:", expirationDate.toUTCString()); + const delegation = await client.createDelegation(audience, abilities, { expiration, }); + console.log( + "delegation expire time:", + new Date(delegation.expiration * 1000).toUTCString(), + ); + const archive = await delegation.archive(); return archive.ok; }