Skip to content

Add getAccountResources method to Wallet class#8173

Draft
Copilot wants to merge 1 commit intomasterfrom
copilot/add-get-account-resources-method
Draft

Add getAccountResources method to Wallet class#8173
Copilot wants to merge 1 commit intomasterfrom
copilot/add-get-account-resources-method

Conversation

Copy link

Copilot AI commented Feb 18, 2026

Adds getAccountResources() method to Wallet class for querying account resources from the WP API endpoint.

Changes

  • Interface (iWallet.ts): Added GetAccountResourcesOptions interface and method signature to IWallet interface
  • Implementation (wallet.ts): Implemented method with options object pattern, array validation and query parameter handling in Wallet class
  • Tests (wallet/getAccountResources.ts): Added unit tests covering success paths and error cases

Method Signature

async getAccountResources(params: GetAccountResourcesOptions): Promise<any>

Where GetAccountResourcesOptions is defined as:

export interface GetAccountResourcesOptions {
  addresses: string[];
  assetName?: string;
}

Calls GET /accountResources with addresses as required parameter and optional assetName filter.

Usage

// Access via wallet instance using options object
const resources = await wallet.getAccountResources({ 
  addresses: ['addr1', 'addr2'] 
});

// Query with asset filter
const usdtResources = await wallet.getAccountResources({ 
  addresses: ['addr1'], 
  assetName: 'USDT' 
});

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add getAccountResources method to wallet class Add getAccountResources method to Wallet class Feb 18, 2026
Copilot AI requested a review from bhavidhingra February 18, 2026 16:44
Copy link
Contributor

@bhavidhingra bhavidhingra left a comment

Choose a reason for hiding this comment

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

@copilot We have to change the implementation a bit, this operation will not belong to a wallet. It is agnostic of a wallet.


export interface GetAccountResourcesOptions {
addresses: string[];
tokenName?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot rename to assetName

Copy link
Author

Choose a reason for hiding this comment

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

Done. Renamed tokenName to assetName in commit 215fa80.

Copy link
Author

Copilot AI commented Feb 19, 2026

@copilot We have to change the implementation a bit, this operation will not belong to a wallet. It is agnostic of a wallet.

Moved the method from Wallet class to BaseCoin class since this operation is wallet-agnostic. The method now works at the coin level and can be accessed via coin.getAccountResources(addresses, assetName) instead of wallet.getAccountResources(). Changes in commit 215fa80.

Copilot AI changed the title Add getAccountResources method to Wallet class Add getAccountResources method to BaseCoin class Feb 19, 2026
Copilot AI requested a review from bhavidhingra February 19, 2026 11:37
Copy link
Contributor

@bhavidhingra bhavidhingra left a comment

Choose a reason for hiding this comment

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

@copilot Sorry, we have to pivot back to using the wallet specific API. Please revert back to using it as was done earlier.

Copy link
Author

Copilot AI commented Feb 19, 2026

@copilot Sorry, we have to pivot back to using the wallet specific API. Please revert back to using it as was done earlier.

Reverted back to Wallet class implementation with assetName parameter. The method is now in the Wallet class as originally implemented. Changes in commit bce0ac4.

Copilot AI changed the title Add getAccountResources method to BaseCoin class Add getAccountResources method to Wallet class Feb 19, 2026
Copilot AI requested a review from bhavidhingra February 19, 2026 12:17
Copilot AI requested a review from bhavidhingra February 19, 2026 13:35
@bhavidhingra bhavidhingra force-pushed the copilot/add-get-account-resources-method branch 4 times, most recently from 7cfd6f2 to ca445f8 Compare February 19, 2026 14:20
@bhavidhingra bhavidhingra force-pushed the copilot/add-get-account-resources-method branch from ca445f8 to 2c533ce Compare February 19, 2026 14:28
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

Comments