Skip to content
This repository was archived by the owner on Mar 2, 2026. It is now read-only.
Merged
Changes from all commits
Commits
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
23 changes: 21 additions & 2 deletions src/background/controller/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1104,8 +1104,27 @@ export class WalletController extends BaseController {
ids: number,
receiver: string
): Promise<string> => transactionService.bridgeNftFromEvmToFlow(flowIdentifier, ids, receiver);
getAssociatedFlowIdentifier = async (address: string): Promise<string> =>
transactionService.getAssociatedFlowIdentifier(address);
// getAssociatedFlowIdentifier = async (address: string): Promise<string> =>
// transactionService.getAssociatedFlowIdentifier(address);

getAssociatedFlowIdentifier = async (address: string): Promise<string> => {
const network = await userWalletService.getNetwork();
const allScripts = await openapiService.getCadenceScripts();
const encodedScript = allScripts.scripts[network]?.bridge?.getAssociatedFlowIdentifier;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The code accesses allScripts.scripts[network]?.bridge without first checking if allScripts.scripts[network] exists. While the optional chaining on .bridge helps, you should add a check for the network existence to provide a more specific error message if the network is not supported.


if (!encodedScript) {
throw new Error('Script get_associated_flow_identifier not found in bridge category');
}

// Decode the base64 script
const script = atob(encodedScript);

const result = await fcl.query({
cadence: script,
args: (arg, t) => [arg(address, t.String)],
});
return result;
};
sendNFT = async (recipient: string, id: number, token: NFTModelV2): Promise<string> =>
transactionService.sendNFT(recipient, id, token);
sendNBANFT = async (recipient: string, id: number, token: NFTModelV2): Promise<string> =>
Expand Down
Loading