Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe(ManagedSignerService.name, () => {
findById: jest.fn().mockResolvedValue(user)
});

await expect(service.executeDecodedTxByUserId("user-123", [])).rejects.toThrow("UserWallet has no fee allowance");
await expect(service.executeDecodedTxByUserId("user-123", [])).rejects.toThrow("Not enough funds to cover the transaction fee");
});

it("throws 403 error when userWallet has no deployment allowance for deployment message", async () => {
Expand All @@ -91,7 +91,7 @@ describe(ManagedSignerService.name, () => {
findById: jest.fn().mockResolvedValue(user)
});

await expect(service.executeDecodedTxByUserId("user-123", [deploymentMessage])).rejects.toThrow("UserWallet has no deployment allowance");
await expect(service.executeDecodedTxByUserId("user-123", [deploymentMessage])).rejects.toThrow("Not enough funds to cover the deployment costs");
});

it("validates trial limits when anonymous free trial is enabled", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ export class ManagedSignerService {
transactionHash: string;
rawLog: string;
}> {
assert(userWallet.feeAllowance > 0, 403, "UserWallet has no fee allowance");
assert(userWallet.feeAllowance > 0, 403, "Not enough funds to cover the transaction fee");

const hasDeploymentMessage = messages.some(message => message.typeUrl.endsWith(".MsgCreateDeployment"));

if (hasDeploymentMessage) {
assert(userWallet.deploymentAllowance > 0, 403, "UserWallet has no deployment allowance");
assert(userWallet.deploymentAllowance > 0, 403, "Not enough funds to cover the deployment costs");
}

await this.anonymousValidateService.validateLeaseProvidersAuditors(messages, userWallet);
Expand Down
20 changes: 20 additions & 0 deletions apps/deploy-web/src/components/api-keys/ApiKeyDocsBanner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Alert, AlertDescription, AlertTitle } from "@akashnetwork/ui/components";
import { Book } from "iconoir-react";

import { ExternalLink } from "@src/components/shared/ExternalLink";

export function ApiKeyDocsBanner() {
return (
<Alert variant="default" className="border-primary/30 bg-primary/5">
<Book className="h-5 w-5 text-primary" />
<AlertTitle className="text-base font-semibold text-primary">Learn How to Use Your API Keys</AlertTitle>
<AlertDescription>
<p className="mb-2 text-muted-foreground">
Discover how to integrate the Akash API into your applications. Our comprehensive documentation covers authentication, creating deployments, managing
resources, and more.
</p>
<ExternalLink href="https://github.com/akash-network/console/wiki/Managed-wallet-API" text="View API Documentation" />
</AlertDescription>
</Alert>
);
}
5 changes: 5 additions & 0 deletions apps/deploy-web/src/components/api-keys/ApiKeyList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { ApiKeyResponse } from "@akashnetwork/http-sdk";
import { Button, Popup, Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@akashnetwork/ui/components";
import { Trash } from "iconoir-react";

import { ApiKeyDocsBanner } from "@src/components/api-keys/ApiKeyDocsBanner";
import { CreateApiKeyModal } from "@src/components/api-keys/CreateApiKeyModal";
import { VerifiedPayingCustomerRequiredLink } from "@src/components/user/VerifiedPayingCustomerRequiredLink";
import { useWallet } from "@src/context/WalletProvider";
Expand Down Expand Up @@ -112,6 +113,10 @@ export function ApiKeyList({ apiKeys, onDeleteApiKey, onDeleteClose, isDeleting,
</TableBody>
</Table>
</div>

<div className="mt-6">
<ApiKeyDocsBanner />
</div>
</div>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const DeploymentDetailTopBar: React.FunctionComponent<Props> = ({
const { changeDeploymentName, getDeploymentData, getDeploymentName } = useLocalNotes();
const { udenomToUsd } = usePricing();
const router = useRouter();
const { signAndBroadcastTx, isManaged, isTrialing } = useWallet();
const { signAndBroadcastTx, isManaged } = useWallet();
const [isDepositingDeployment, setIsDepositingDeployment] = useState(false);
const storageDeploymentData = getDeploymentData(deployment?.dseq);
const deploymentName = getDeploymentName(deployment?.dseq);
Expand Down Expand Up @@ -218,7 +218,7 @@ export const DeploymentDetailTopBar: React.FunctionComponent<Props> = ({
Add funds
</Button>

{isManaged && !isTrialing && browserEnvConfig.NEXT_PUBLIC_AUTO_TOP_UP_ENABLED && (
{isManaged && (
<div className="ml-4 flex items-center gap-2">
<Switch checked={deploymentSetting.data?.autoTopUpEnabled} onCheckedChange={setAutoTopUpEnabled} disabled={deploymentSetting.isLoading} />
<span>Auto top-up</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@ import formatDistanceToNow from "date-fns/formatDistanceToNow";
import isValid from "date-fns/isValid";
import { InfoCircle, WarningCircle } from "iconoir-react";

import { CopyTextToClipboardButton } from "@src/components/shared/CopyTextToClipboardButton";
import { LabelValue } from "@src/components/shared/LabelValue";
import { PricePerMonth } from "@src/components/shared/PricePerMonth";
import { PriceValue } from "@src/components/shared/PriceValue";
import { StatusPill } from "@src/components/shared/StatusPill";
import { TrialDeploymentBadge } from "@src/components/shared/TrialDeploymentBadge";
import { useServices } from "@src/context/ServicesProvider";
import { useWallet } from "@src/context/WalletProvider";
import { useDeploymentMetrics } from "@src/hooks/useDeploymentMetrics";
import { useFlag } from "@src/hooks/useFlag";
import { useTrialDeploymentTimeRemaining } from "@src/hooks/useTrialDeploymentTimeRemaining";
import { useDenomData } from "@src/hooks/useWalletBalance";
import type { DeploymentDto, LeaseDto } from "@src/types/deployment";
import { udenomToDenom } from "@src/utils/mathHelpers";
import { getAvgCostPerMonth } from "@src/utils/priceUtils";
import { TrialDeploymentBadge } from "../shared";
import { CopyTextToClipboardButton } from "../shared/CopyTextToClipboardButton";

type Props = {
deployment: DeploymentDto;
Expand All @@ -34,6 +36,15 @@ export const DeploymentSubHeader: React.FunctionComponent<Props> = ({ deployment
const denomData = useDenomData(deployment.escrowAccount.state.funds[0]?.denom || "");
const { isCustodial, isTrialing } = useWallet();
const isAnonymousFreeTrialEnabled = useFlag("anonymous_free_trial");
const { appConfig } = useServices();

const trialDuration = appConfig.NEXT_PUBLIC_TRIAL_DEPLOYMENTS_DURATION_HOURS;
const { timeRemainingText: trialTimeRemaining } = useTrialDeploymentTimeRemaining({
createdHeight: deployment.createdAt,
trialDurationHours: trialDuration,
averageBlockTime: 6
});

return (
<div className="grid grid-cols-2 gap-4 p-4">
<div>
Expand Down Expand Up @@ -137,7 +148,12 @@ export const DeploymentSubHeader: React.FunctionComponent<Props> = ({ deployment
<LabelValue
label="Time left"
labelWidth="6rem"
value={realTimeLeft && isValid(realTimeLeft?.timeLeft) && `~${formatDistanceToNow(realTimeLeft?.timeLeft)}`}
value={
<div className="flex items-center space-x-2">
{realTimeLeft && isValid(realTimeLeft?.timeLeft) && <span>~{formatDistanceToNow(realTimeLeft?.timeLeft)}</span>}
{!isAnonymousFreeTrialEnabled && isTrialing && trialTimeRemaining && <span className="text-xs text-primary">(Trial: {trialTimeRemaining})</span>}
</div>
}
/>
<LabelValue
label="DSEQ"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ export const OnboardingContainer: React.FunctionComponent<OnboardingContainerPro
}
} catch (error) {
enqueueSnackbar("Failed to deploy template. Please try again.", { variant: "error" });
throw error;
}
},
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const WelcomeStep: React.FunctionComponent<WelcomeStepProps> = ({ onCompl
});

await onComplete(templateName);
} catch (error) {
} finally {
setIsDeploying(false);
setDeployingTemplate(null);
}
Expand Down
1 change: 0 additions & 1 deletion apps/deploy-web/src/config/browser-env.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const browserEnvConfig = validateStaticEnvVars({
NEXT_PUBLIC_UAKT_TOP_UP_MASTER_WALLET_ADDRESS: process.env.NEXT_PUBLIC_UAKT_TOP_UP_MASTER_WALLET_ADDRESS,
NEXT_PUBLIC_USDC_TOP_UP_MASTER_WALLET_ADDRESS: process.env.NEXT_PUBLIC_USDC_TOP_UP_MASTER_WALLET_ADDRESS,
NEXT_PUBLIC_BILLING_ENABLED: process.env.NEXT_PUBLIC_BILLING_ENABLED,
NEXT_PUBLIC_AUTO_TOP_UP_ENABLED: process.env.NEXT_PUBLIC_AUTO_TOP_UP_ENABLED,
NEXT_PUBLIC_MANAGED_WALLET_NETWORK_ID: process.env.NEXT_PUBLIC_MANAGED_WALLET_NETWORK_ID,
NEXT_PUBLIC_MANAGED_WALLET_DENOM: process.env.NEXT_PUBLIC_MANAGED_WALLET_DENOM,
NEXT_PUBLIC_DEFAULT_INITIAL_DEPOSIT: process.env.NEXT_PUBLIC_DEFAULT_INITIAL_DEPOSIT,
Expand Down
1 change: 0 additions & 1 deletion apps/deploy-web/src/config/env-config.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export const browserEnvSchema = z.object({
NEXT_PUBLIC_UAKT_TOP_UP_MASTER_WALLET_ADDRESS: z.string(),
NEXT_PUBLIC_USDC_TOP_UP_MASTER_WALLET_ADDRESS: z.string(),
NEXT_PUBLIC_BILLING_ENABLED: coercedBoolean().optional().default("false"),
NEXT_PUBLIC_AUTO_TOP_UP_ENABLED: coercedBoolean().optional().default("false"),
NEXT_PUBLIC_MANAGED_WALLET_NETWORK_ID: networkId.optional().default("mainnet"),
NEXT_PUBLIC_DEFAULT_NETWORK_ID: networkId.optional().default("mainnet"),
NEXT_PUBLIC_MANAGED_WALLET_DENOM: z.enum(["uakt", "usdc"]).optional().default("usdc"),
Expand Down
6 changes: 3 additions & 3 deletions apps/deploy-web/src/pages/user/verify-email/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ type VerificationResultProps = {
};

function VerificationResult({ isVerified }: VerificationResultProps) {
const gotoHome = useCallback(() => {
window.location.href = UrlService.home();
const gotoOnboarding = useCallback(() => {
window.location.href = UrlService.onboarding();
}, []);

return (
Expand All @@ -31,7 +31,7 @@ function VerificationResult({ isVerified }: VerificationResultProps) {
You can continue using the application.
</h5>
<AutoButton
onClick={gotoHome}
onClick={gotoOnboarding}
text={
<>
Continue <ArrowRight className="ml-4" />
Expand Down