Skip to content

feat(tangle-cloud): blueprint deployment request args configuration & finalization #2957

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
91669f1
feat(tangle-cloud): config asset security commitment
danielbui12 Apr 4, 2025
69d5320
chore(tangle-cloud): format code
danielbui12 Apr 4, 2025
5024c41
fix(libs/tangle-shared-ui): update type of useAssetsMetadata
danielbui12 Apr 4, 2025
1565e6c
fix(tangle-cloud): update layout blueprint deployment asset configura…
danielbui12 Apr 5, 2025
103c5dd
chore(tangle-cloud): format code
danielbui12 Apr 5, 2025
2d7eb11
fix(tangle-cloud): refactor operator selection table
danielbui12 Apr 6, 2025
1a89c84
chore(tangle-cloud): format code
danielbui12 Apr 6, 2025
994f69f
fix(tangle-cloud): filter operator by selected asset
danielbui12 Apr 7, 2025
9f6fc95
chore(tangle-cloud): format code
danielbui12 Apr 7, 2025
91b1366
chore(tangle-cloud): fix typecheck error
danielbui12 Apr 7, 2025
542354e
feat(tangle-cloud): review blueprint deployment step
danielbui12 Apr 7, 2025
ca5f1d8
chore(tangle-cloud): foramt code
danielbui12 Apr 7, 2025
b7b936a
chore(tangle-cloud): foramt code
danielbui12 Apr 7, 2025
b702c82
refactor(tangle-cloud): refactor blueprint deployment page
danielbui12 Apr 8, 2025
05c9a58
chore(tangle-cloud): format code
danielbui12 Apr 8, 2025
5e00f67
chore(tangle-cloud): rebase develop & resolve conflicts
danielbui12 Apr 8, 2025
ce63daa
fix(tangle-cloud): update UI blueprint deployment
danielbui12 Apr 9, 2025
35d9dd7
chore(tangle-cloud): format code
danielbui12 Apr 9, 2025
2219d1f
fix(tangle-cloud): fetch related asset for each section
danielbui12 Apr 10, 2025
6c219bc
chore(tangle-cloud): format code
danielbui12 Apr 10, 2025
8948e8a
feat(tangle-cloud): send services precompile tx
danielbui12 Apr 12, 2025
c1bb01b
chore(tangle-cloud): format code
danielbui12 Apr 12, 2025
4993916
chore(tangle-cloud): lint code
danielbui12 Apr 12, 2025
8dab91a
chore(tangle-cloud): format code
danielbui12 Apr 12, 2025
608219f
fix(tangle-cloud): blueprint deployment operator selection
danielbui12 Apr 12, 2025
539886d
fix(tangle-cloud): blueprint deployment listen to transaction status
danielbui12 Apr 12, 2025
3811490
chore(repo): remove comments
danielbui12 Apr 12, 2025
5f6e410
chore(tangle-cloud): resolve pr comments
danielbui12 Apr 13, 2025
b139beb
chore(tangle-cloud): rename services hooks
danielbui12 Apr 13, 2025
e74a3fe
Merge remote-tracking branch 'origin/develop' into daniel/blueprint-d…
danielbui12 Apr 14, 2025
ad6985f
Merge branch 'develop' into daniel/blueprint-deployment-request-args-…
drewstone Apr 14, 2025
3996aa7
chore(tangle-cloud): resolve pr comments
danielbui12 Apr 15, 2025
240fea7
chore(tangle-cloud): foramt code
danielbui12 Apr 15, 2025
c952e4a
chore(tangle-cloud): format code
danielbui12 Apr 15, 2025
9fe12cb
chore(tangle-cloud): fix error type globalPricingForm
danielbui12 Apr 15, 2025
71dbec5
chore(tangle-cloud): format code
danielbui12 Apr 15, 2025
c38bae2
fix(libs/tangle-shared-ui): fix logic of returning asset metadata
danielbui12 Apr 15, 2025
58eb52c
fix(tangle-shared-ui): Update Tx Eligible Check (#2969)
AtelyPham Apr 15, 2025
67d42c8
chore(tangle-cloud): resolve conflicts
danielbui12 Apr 15, 2025
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
11 changes: 7 additions & 4 deletions apps/tangle-cloud/src/components/InstanceHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { FC } from 'react';
import { twMerge } from 'tailwind-merge';

type Props = {
title: string;
githubPath?: string;
creator: string;
title?: string;
githubPath?: string | null;
creator?: string;
};

const InstanceHeader: FC<Props> = ({ title, githubPath, creator }) => {
Expand All @@ -20,7 +20,10 @@ const InstanceHeader: FC<Props> = ({ title, githubPath, creator }) => {
>
<div className="flex flex-col gap-2">
<Typography variant="h5" className="flex items-center gap-2">
{title} <GithubFill size="lg" target="_blank" href={githubPath} />
{title}{' '}
{githubPath && (
<GithubFill size="lg" target="_blank" href={githubPath} />
)}
</Typography>

<Typography variant="body1" className="!text-mono-100">
Expand Down
1 change: 0 additions & 1 deletion apps/tangle-cloud/src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import useRoleStore, { Role, ROLE_ICON_MAP } from '../stores/roleStore';
import { PagePath } from '../types';
import { ChevronRight, HomeFillIcon } from '@tangle-network/icons';
import { twMerge } from 'tailwind-merge';
import cx from 'classnames';

type Props = {
isExpandedByDefault?: boolean;
Expand Down
1 change: 1 addition & 0 deletions apps/tangle-cloud/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export enum TxName {
REGISTER_BLUEPRINT = 'register blueprint',
REJECT_SERVICE_REQUEST = 'reject service request',
APPROVE_SERVICE_REQUEST = 'approve service request',
DEPLOY_BLUEPRINT = 'deploy blueprint',
}

export enum SessionStorageKey {
Expand Down
125 changes: 0 additions & 125 deletions apps/tangle-cloud/src/data/services/useServiceRegisterTx.ts

This file was deleted.

7 changes: 2 additions & 5 deletions apps/tangle-cloud/src/data/services/useServicesApproveTx.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { SUCCESS_MESSAGES } from '../../hooks/useTxNotification';
import { BN } from '@polkadot/util';
import { useCallback } from 'react';

import { TxName } from '../../constants';
Expand All @@ -8,7 +7,7 @@ import {
useSubstrateTxWithNotification,
} from '@tangle-network/tangle-shared-ui/hooks/useSubstrateTx';
import { ApprovalConfirmationFormFields } from '../../types';
import { isEvmAddress } from '@tangle-network/ui-components';
import createAssetIdEnum from '@tangle-network/tangle-shared-ui/utils/createAssetIdEnum';

type Context = ApprovalConfirmationFormFields;

Expand All @@ -17,9 +16,7 @@ const useServicesApproveTx = () => {
(api, _activeSubstrateAddress, context) => {
const securityCommitments = context.securityCommitment.map(
(commitment) => ({
asset: isEvmAddress(commitment.assetId)
? { Erc20: new BN(commitment.assetId) }
: { Custom: new BN(commitment.assetId) },
asset: createAssetIdEnum(commitment.assetId),
exposurePercent: commitment.exposurePercent,
}),
);
Expand Down
48 changes: 48 additions & 0 deletions apps/tangle-cloud/src/data/services/useServicesRegisterTx.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import optimizeTxBatch from '@tangle-network/tangle-shared-ui/utils/optimizeTxBatch';
import { SUCCESS_MESSAGES } from '../../hooks/useTxNotification';
import { useCallback } from 'react';

import { TxName } from '../../constants';
import {
SubstrateTxFactory,
useSubstrateTxWithNotification,
} from '@tangle-network/tangle-shared-ui/hooks/useSubstrateTx';
import { RegisterServiceFormFields } from '../../types';
import { TANGLE_TOKEN_DECIMALS } from '@tangle-network/dapp-config';
import { parseUnits } from 'viem';

type Context = RegisterServiceFormFields;

const useServicesRegisterTx = () => {
const substrateTxFactory: SubstrateTxFactory<Context> = useCallback(
async (api, _activeSubstrateAddress, context) => {
const { blueprintIds, preferences, registrationArgs, amounts } = context;

// TODO: Find a better way to get the chain decimals
const decimals =
api.registry.chainDecimals.length > 0
? api.registry.chainDecimals[0]
: TANGLE_TOKEN_DECIMALS;
Comment on lines +16 to +25
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can import the network and get the decimals from it: useNetworkStore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but it results in a recursive hook within a hook. @AtelyPham do you have any idea?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielbui12 using custom hooks within custom hooks is totally normal & common practice, if that's what you meant. Think about it like functions within functions -- it makes sense, it's simply building blocks reusing each other

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any update here? @danielbui12


const registerTx = blueprintIds.map((blueprintId, idx) => {
return api.tx.services.register(
blueprintId,
preferences[idx],
registrationArgs[idx],
parseUnits(amounts[idx].toString(), decimals),
);
});

return optimizeTxBatch(api, registerTx);
},
[],
);

return useSubstrateTxWithNotification(
TxName.REGISTER_BLUEPRINT,
substrateTxFactory,
SUCCESS_MESSAGES,
);
};

export default useServicesRegisterTx;
Loading
Loading