forked from crackedstudio/tikka
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.module.ts
More file actions
54 lines (51 loc) · 1.76 KB
/
Copy pathapp.module.ts
File metadata and controls
54 lines (51 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { Module, DynamicModule } from '@nestjs/common';
import { NetworkModule } from './network/network.module';
import { ContractService } from './contract/contract.service';
import { RaffleModule } from './modules/raffle/raffle.module';
import { TicketModule } from './modules/ticket/ticket.module';
import { UserModule } from './modules/user/user.module';
import { AdminModule } from './modules/admin/admin.module';
import { FeeEstimatorModule } from './fee-estimator/fee-estimator.module';
import { TikkaNetwork, NetworkConfig, RpcConfig } from './network/network.config';
import { WalletAdapter } from './wallet/wallet.interface';
export interface TikkaSdkOptions {
/** Network name or config (supports partial overrides with required network name) */
network: TikkaNetwork | NetworkConfig | (Partial<NetworkConfig> & { network: TikkaNetwork });
/** Optional low-level RPC transport config */
rpcConfig?: RpcConfig;
/** Optional wallet adapter for write operations */
wallet?: WalletAdapter;
/** Override the raffle contract ID */
contractId?: string;
}
@Module({})
export class AppModule {
static forRoot(options: TikkaSdkOptions): DynamicModule {
const walletProviders = options.wallet
? [{ provide: 'WALLET_ADAPTER', useValue: options.wallet }]
: [];
return {
module: AppModule,
imports: [
NetworkModule.forRoot(options.network, options.rpcConfig),
RaffleModule,
TicketModule,
UserModule,
AdminModule,
FeeEstimatorModule,
],
providers: [
ContractService,
...walletProviders,
],
exports: [
ContractService,
RaffleModule,
TicketModule,
UserModule,
AdminModule,
FeeEstimatorModule,
],
};
}
}