Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: general improvements to the examples section #111

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Loading