Skip to content

Commit

Permalink
Merge pull request #32 from tian000/napas/use-new-blockhash-each-time
Browse files Browse the repository at this point in the history
Use new blockhash each time for v0 transaction flow
  • Loading branch information
0xproflupin authored Feb 12, 2023
2 parents 85f7d69 + 5b42b9b commit c217651
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ const message = 'To avoid digital dognappers, sign below to authenticate with Cr

export type ConnectedMethods =
| {
name: string;
onClick: () => Promise<string>;
}
name: string;
onClick: () => Promise<string>;
}
| {
name: string;
onClick: () => Promise<void>;
};
name: string;
onClick: () => Promise<void>;
};

interface Props {
publicKey: PublicKey | null;
Expand Down Expand Up @@ -217,13 +217,12 @@ const useProps = (): Props => {
/** SignAndSendTransactionV0WithLookupTable */
const handleSignAndSendTransactionV0WithLookupTable = useCallback(async () => {
if (!provider) return;
let blockhash = await connection.getLatestBlockhash().then((res) => res.blockhash);
try {
const [lookupSignature, lookupTableAddress] = await createAddressLookupTable(
provider,
provider.publicKey,
connection,
blockhash
await connection.getLatestBlockhash().then((res) => res.blockhash)
);
createLog({
status: 'info',
Expand All @@ -234,7 +233,7 @@ const useProps = (): Props => {
provider,
provider.publicKey,
connection,
blockhash,
await connection.getLatestBlockhash().then((res) => res.blockhash),
lookupTableAddress
);
createLog({
Expand All @@ -247,7 +246,7 @@ const useProps = (): Props => {
provider,
provider.publicKey,
connection,
blockhash,
await connection.getLatestBlockhash().then((res) => res.blockhash),
lookupTableAddress
);
createLog({
Expand Down

0 comments on commit c217651

Please sign in to comment.