Skip to content

Commit 8bdf911

Browse files
committed
refactor: use the format accounts util for connect on solana
1 parent e644232 commit 8bdf911

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed
Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
import type { ProviderAPI, SolanaActions } from './types.js';
22
import type { Context } from '../../hub/namespaces/mod.js';
3-
import type { CaipAccount } from '../../types/accounts.js';
43
import type { FunctionWithContext } from '../../types/actions.js';
54

6-
import { AccountId } from 'caip';
7-
85
import { recommended as commonRecommended } from '../common/actions.js';
96

10-
import { CAIP_NAMESPACE, CAIP_SOLANA_CHAIN_ID } from './constants.js';
11-
import { getAccounts } from './utils.js';
7+
import { formatAccountsToCAIP, getAccounts } from './utils.js';
128

139
export const recommended = [...commonRecommended];
1410

@@ -25,15 +21,6 @@ export function connect(
2521
);
2622
}
2723

28-
return result.accounts.map(
29-
(account) =>
30-
AccountId.format({
31-
address: account,
32-
chainId: {
33-
namespace: CAIP_NAMESPACE,
34-
reference: CAIP_SOLANA_CHAIN_ID,
35-
},
36-
}) as CaipAccount
37-
);
24+
return formatAccountsToCAIP(result.accounts);
3825
};
3926
}

0 commit comments

Comments
 (0)