Skip to content

Commit 4f10dc6

Browse files
Bump js-pro and fix time synchronization
1 parent fb02f46 commit 4f10dc6

File tree

6 files changed

+36
-15
lines changed

6 files changed

+36
-15
lines changed

apps/web/app/layout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import AppProviders from '@/context/AppProviders';
66
import { ThemeProvider } from '@/context/ThemeProvider';
77
import { ReactScan } from '@/components/ReactScan';
88
import Analytics from '@/components/background/Analytics';
9+
import TimeService from '@/components/background/TimeService';
910

1011
const workSans = Work_Sans({
1112
display: 'swap',
@@ -65,6 +66,7 @@ export default function RootLayout({
6566
</ThemeProvider>
6667
</body>
6768
<Analytics />
69+
<TimeService />
6870
</AppProviders>
6971
</html>
7072
);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use client';
2+
3+
import { useEffect } from 'react';
4+
import { synchronizeTime } from '@/lib/serverTime';
5+
6+
export default function TimeService() {
7+
useEffect(() => {
8+
synchronizeTime();
9+
}, []);
10+
11+
return null;
12+
}

apps/web/context/ActiveProposalProvider.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { useQuery } from '@tanstack/react-query';
1515
import {
1616
AccountAddress,
1717
buildTransaction,
18+
DEFAULT_TXN_EXP_SEC_FROM_NOW,
1819
Deserializer,
1920
Hex,
2021
MultiSig,
@@ -31,7 +32,7 @@ export const [ActiveProposalProvider, useActiveProposal] = constate(
3132
({ sequenceNumber }: { sequenceNumber: number }) => {
3233
const { vaultAddress, network } = useActiveVault();
3334
const account = useAccount();
34-
const { aptos } = useClients();
35+
const { aptos, client } = useClients();
3536

3637
const latestSequenceNumber = useMultisigSequenceNumber({
3738
address: vaultAddress,
@@ -94,6 +95,11 @@ export const [ActiveProposalProvider, useActiveProposal] = constate(
9495

9596
return await buildTransaction({
9697
aptosConfig: aptos.config,
98+
options: {
99+
expireTimestamp: Math.floor(
100+
client.getServerTime() + DEFAULT_TXN_EXP_SEC_FROM_NOW
101+
)
102+
},
97103
sender: vaultAddress,
98104
payload: new TransactionPayloadEntryFunction(
99105
multisigPayload.transaction_payload

apps/web/lib/serverTime.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ async function getServerTimeDelta() {
5252
export async function synchronizeTime() {
5353
try {
5454
serverTimeDelta = await getServerTimeDelta();
55+
return serverTimeDelta;
5556
} catch (error) {
5657
if (!isProduction) {
5758
throw error;

apps/web/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"check-types": "tsc --noEmit"
2020
},
2121
"dependencies": {
22-
"@aptos-labs/js-pro": "^0.1.1",
23-
"@aptos-labs/react": "^0.1.1",
22+
"@aptos-labs/js-pro": "^0.1.5",
23+
"@aptos-labs/react": "^0.1.5",
2424
"@aptos-labs/ts-sdk": "^3.1.3",
2525
"@aptos-labs/wallet-adapter-react": "^7.0.4",
2626
"@aptos-labs/wallet-api": "workspace:*",

pnpm-lock.yaml

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)