Skip to content

Commit

Permalink
fix: general improvements to the examples section (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorShadurin committed Oct 2, 2023
1 parent 224b582 commit 78e4050
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
8 changes: 6 additions & 2 deletions examples/alchemy-daapp/src/pages/api/nfts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,23 @@ export default async (req: NextApiRequest, res: NextApiResponse) => {
throw new Error("chainId is required");
}

if (!address) {
throw new Error('address is required')
}

const contractAddress =
daappConfigurations[Number(chainId)]?.nftContractAddress;
if (!contractAddress) {
throw new Error("Unsupported chainID.");
}

const repsonse = await callEndpoint(
const response = await callEndpoint(
"GET",
`${getApiUrl(
chainId as string
)}/getNFTs/?owner=${address}&contractAddresses[]=${contractAddress}`
);
return res.send(repsonse);
return res.send(response);
} catch (e) {
console.error(e);
return res.status(400).send((e as Error).message);
Expand Down
4 changes: 2 additions & 2 deletions examples/alchemy-daapp/src/surfaces/connect/ConnectPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ export function ConnectPage() {
return (
<Center>
<VStack gap={4}>
<Heading size="lg">Welcome to the Alchemy exmple D🅰️🅰️pp!</Heading>
<Heading size="lg">Welcome to the Alchemy example D🅰️🅰️pp!</Heading>
<Text align="center">
We're excited for you to start using account abstraction!! <br />
Click below to connect your wallet, and create your own account
abstrated smart contract wallet.
abstracted smart contract wallet.
</Text>
<ConnectButton />
</VStack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ async function pollForLambdaForComplete(
txnMaxDurationSeconds: number = 20
) {
let txnRetryCount = 0;
let reciept;
let receipt;
do {
reciept = await lambda();
if (!reciept) {
receipt = await lambda();
if (!receipt) {
// wait 1 second before trying again
await new Promise((resolve) => setTimeout(resolve, 1000));
}
} while (!reciept && txnRetryCount++ < txnMaxDurationSeconds);
if (!reciept) {
throw new Error("Timedout waiting for processs completion.");
} while (!receipt && txnRetryCount++ < txnMaxDurationSeconds);
if (!receipt) {
throw new Error("Timeout waiting for processes completion.");
}
return reciept;
return receipt;
}

type OnboardingFunction = (
Expand Down Expand Up @@ -120,14 +120,14 @@ const onboardingStepHandlers: Record<
});
});


const smartAccountAddress = await baseSigner.getAddress();
if (context.useGasManager) {
const smartAccountSigner = withAlchemyGasManager(baseSigner, {
policyId: appConfig.gasManagerPolicyId,
entryPoint: entryPointAddress,
});

return {
nextStep: OnboardingStepIdentifier.MINT_NFT,
addedContext: {
Expand Down
2 changes: 1 addition & 1 deletion examples/alchemy-daapp/src/surfaces/profile/NftSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const NftSection: React.NamedExoticComponent<NFTsProps> = memo(
function NftSection({ address, chainId, ...boxProps }: NFTsProps) {
const ownedNFTsQuery = useNFTsQuery(address, chainId);
if (!address) {
return <Text size="sm">No Address to Assoicate Achievements</Text>;
return <Text size="sm">No Address to Associate Achievements</Text>;
}

if (ownedNFTsQuery.isLoading) {
Expand Down

0 comments on commit 78e4050

Please sign in to comment.