Skip to content

Commit

Permalink
Use selectedAddress as fallback for interacting address
Browse files Browse the repository at this point in the history
  • Loading branch information
Cal-L committed Mar 28, 2023
1 parent f781a16 commit c38d0ec
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/assets-controllers/src/TokensController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export type SuggestedAssetMetaBase = {
* @property time - Timestamp associated with this this suggested asset
* @property type - Type type this suggested asset
* @property asset - Asset suggested object
* @property interactingAddress - Account address that requested watch asset
*/
export type SuggestedAssetMeta =
| (SuggestedAssetMetaBase & {
Expand Down Expand Up @@ -629,16 +630,17 @@ export class TokensController extends BaseController<
type: string,
interactingAddress?: string,
): Promise<AssetSuggestionResult> {
const { selectedAddress } = this.config;

const suggestedAssetMeta: SuggestedAssetMeta = {
asset,
id: this._generateRandomId(),
status: SuggestedAssetStatus.pending as SuggestedAssetStatus.pending,
time: Date.now(),
type,
interactingAddress: interactingAddress || selectedAddress,
};
if (interactingAddress) {
suggestedAssetMeta.interactingAddress = interactingAddress;
}

try {
switch (type) {
case 'ERC20':
Expand Down

0 comments on commit c38d0ec

Please sign in to comment.