Skip to content

feat: Complete implementation of hcs-16#95

Open
gaurangtorvekar wants to merge 1 commit into
mainfrom
feat/hcs-16-full-implementation
Open

feat: Complete implementation of hcs-16#95
gaurangtorvekar wants to merge 1 commit into
mainfrom
feat/hcs-16-full-implementation

Conversation

@gaurangtorvekar
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Comment thread src/hcs-16/tx.ts
Comment on lines +382 to +398
/** Schedule delete of a Flora account (AccountDeleteTransaction). */
export function buildHcs16ScheduleAccountDeleteTx(params: {
floraAccountId: string;
transferAccountId: string;
memo?: string;
}): ScheduleCreateTransaction {
const inner = new AccountUpdateTransaction() as any; // AccountDeleteTransaction not imported in current SDK typings set
// Fallback: construct via new proto if needed in future; here we use typed import when available
// Replace when AccountDeleteTransaction is exported in the used SDK version
(inner as any).setAccountId?.(AccountId.fromString(params.floraAccountId));
if (params.memo) {
(inner as any).setTransactionMemo?.(params.memo);
}
(inner as any).setTransferAccountId?.(
AccountId.fromString(params.transferAccountId),
);
return new ScheduleCreateTransaction().setScheduledTransaction(inner);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Schedule delete uses AccountUpdateTransaction so no deletion occurs

The new buildHcs16ScheduleAccountDeleteTx builds the scheduled transaction from an AccountUpdateTransaction and conditionally calls setTransferAccountId and other delete-only setters via optional chaining. Because AccountUpdateTransaction does not implement these methods, none of them execute and the scheduled transaction ends up as an empty account update rather than an AccountDeleteTransaction. Any call to scheduleFloraDeletion will therefore submit a schedule that never deletes the Flora account and omits the mandatory transfer account, causing execution to fail. Use a proper AccountDeleteTransaction (or construct the delete proto directly) so the schedule actually performs an account deletion.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed this

@kantorcodes
Copy link
Copy Markdown
Member

kantorcodes commented Oct 14, 2025

@gaurangtorvekar it looks like the DCO check is still failing. Either the GPG key is not working or -s was not used with the commits. You might have to do a squash / rebase

Comment thread src/hcs-16/base-client.ts Outdated
const pub = await this.mirrorNode.getPublicKey(accountId);
// Enforce ECDSA: ED25519 keys are not supported for Flora membership
const pubStr = pub.toString();
if (
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comment thread src/hcs-16/sdk.ts Outdated
floraAccountId: string;
profileResource: string;
}): Promise<TransactionReceipt> {
const tx = new AccountUpdateTransaction()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should have this transaction generated in tx.ts - the main reason we started doing this recently is so standards-agent-kit can reuse a transaction assembled in the right format without executing it immediately for use of the builder pattern.

Comment thread src/hcs-16/sdk.ts Outdated
floraAccountId: string;
profile: FloraProfile | any;
}): Promise<{ profileResource: string; receipt: TransactionReceipt }> {
const result = await params.hcs11.inscribeProfile(params.profile as any);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need type any here, should we be enforcing the profile shape with zod?

Comment thread src/hcs-16/tx.ts Outdated

let transactionMemo: string | undefined;
if (
typeof params.opCode === 'number' &&
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Zod could be good for these type checks too potentially

Comment thread src/hcs-16/tx.ts
Signed-off-by: Gaurang Torvekar <2285764+gaurangtorvekar@users.noreply.github.com>
@gaurangtorvekar gaurangtorvekar force-pushed the feat/hcs-16-full-implementation branch from 1c5871d to d0e12cc Compare October 15, 2025 10:47
@gaurangtorvekar
Copy link
Copy Markdown
Collaborator Author

@kantorcodes Made changes as per your comments, and now the DCO check is also passing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants