Skip to content

Conversation

@anyxem
Copy link
Collaborator

@anyxem anyxem commented Jul 4, 2025

No description provided.

@anyxem anyxem requested a review from Copilot July 4, 2025 21:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the SDK client by extracting transaction construction into build* methods and updating existing methods to call these builders before signing. It centralizes transaction creation, clarifies returns, and adapts JSDoc accordingly.

  • Introduce build* methods for all transaction types, returning unsigned Transaction objects.
  • Update original methods to call the new builders and then sign the transaction.
  • Adjust JSDoc comments to describe unsigned return values for builders.
Comments suppressed due to low confidence (1)

packages/sdk/src/mintlayer-connect-sdk.ts:2587

  • Add a @returns annotation to this JSDoc comment to specify that it returns an unsigned Transaction object, keeping it consistent with other build* methods.
   * Builds an NFT transfer transaction without signing it.

/**
* Builds a bridge request transaction without signing it.
*/
async buildBridgeRequest({ destination, amount, token_id, intent }: BridgeRequestArgs): Promise<Transaction> {
Copy link

Copilot AI Jul 4, 2025

Choose a reason for hiding this comment

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

The buildBridgeRequest method signature declares a return type of Transaction but actually returns { ...tx, intent }, which includes the extra intent field. Update the return type to include intent (e.g., a union or extended interface) or remove the extra property to match the declared type.

Suggested change
async buildBridgeRequest({ destination, amount, token_id, intent }: BridgeRequestArgs): Promise<Transaction> {
async buildBridgeRequest({ destination, amount, token_id, intent }: BridgeRequestArgs): Promise<BridgeTransaction> {

Copilot uses AI. Check for mistakes.
/**
* Builds a delegation creation transaction without signing it.
*/
async buildDelegationCreate({ pool_id, destination }: DelegationCreateArgs): Promise<Transaction> {
Copy link

Copilot AI Jul 4, 2025

Choose a reason for hiding this comment

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

[nitpick] There are two builder methods for the same CreateDelegationId action (buildDelegate and buildDelegationCreate), which may confuse consumers. Consider consolidating these into a single named builder to reduce duplication.

Copilot uses AI. Check for mistakes.
@anyxem anyxem merged commit a4a5425 into main Jul 4, 2025
1 check passed
@anyxem anyxem deleted the feat/refactor-build-helper branch July 4, 2025 21:38
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