File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 8585 StellarWalletsKit ,
8686 WalletNetwork ,
8787 allowAllModules ,
88+ XBULL_ID
8889 } from './build/index.mjs' ;
8990 import { WalletConnectModule , WalletConnectAllowedMethods } from './build/modules/walletconnect.module.mjs'
9091 import { LedgerModule } from './build/modules/ledger.module.mjs'
9394 const kit = new StellarWalletsKit ( {
9495 network : WalletNetwork . TESTNET ,
9596 modules : [
96- ...allowAllModules ( ) ,
97+ ...allowAllModules ( { filterBy : module => module . productId === XBULL_ID } ) ,
9798 new LedgerModule ( ) ,
9899 new TrezorModule ( {
99100 appUrl : 'http://localhost:5173' ,
Original file line number Diff line number Diff line change @@ -7,8 +7,12 @@ import { HotWalletModule } from './modules/hotwallet.module';
77import { HanaModule } from './modules/hana.module' ;
88import { ModuleInterface } from './types' ;
99
10- export function allowAllModules ( ) : ModuleInterface [ ] {
11- return [
10+ /**
11+ * This method returns all modules that don't require extra configuration before they can be loaded
12+ * You can provide a filter function if needed
13+ */
14+ export function allowAllModules ( opts ?: { filterBy : ( module : ModuleInterface ) => boolean } ) : ModuleInterface [ ] {
15+ const modules : ModuleInterface [ ] = [
1216 new AlbedoModule ( ) ,
1317 new FreighterModule ( ) ,
1418 new RabetModule ( ) ,
@@ -17,6 +21,16 @@ export function allowAllModules(): ModuleInterface[] {
1721 new HanaModule ( ) ,
1822 new HotWalletModule ( ) ,
1923 ] ;
24+ return opts ?. filterBy ? modules . filter ( opts . filterBy ) : modules ;
25+ }
26+
27+ /**
28+ * This method only returns those modules from wallet that follow exactly the SEP-43 standard and don't require extra configuration before they can be loaded
29+ * You can provide a filter function if needed
30+ */
31+ export function sep43Modules ( opts ?: { filterBy : ( module : ModuleInterface ) => boolean } ) : ModuleInterface [ ] {
32+ const modules : ModuleInterface [ ] = [ new FreighterModule ( ) , new HotWalletModule ( ) ] ;
33+ return opts ?. filterBy ? modules . filter ( opts . filterBy ) : modules ;
2034}
2135
2236export function parseError ( e : any ) {
You can’t perform that action at this time.
0 commit comments