@@ -3,28 +3,7 @@ import ABI from './lib/abi/bet.json';
3
3
import { ClientModule } from './modules/clientModule' ;
4
4
import { ContractModule } from './modules/contractModule' ;
5
5
// import { EventModule } from './modules/eventModule';
6
-
7
- export enum NetworkType {
8
- Mainnet ,
9
- Testnet ,
10
- }
11
-
12
- export type SdkCtorOptions = {
13
- privateKey ?: string ;
14
- networkType ?: NetworkType ;
15
- }
16
-
17
- export type SdkOptions = {
18
- privateKey ?: string ;
19
- networkOptions : NetworkOptions ;
20
- }
21
-
22
- export type NetworkOptions = {
23
- contractAddress : string ;
24
- rpcUrl : string ;
25
- chainId : number ;
26
- abi : any ;
27
- }
6
+ import { SdkCtorOptions , SdkOptions } from './types' ;
28
7
29
8
export class SDK {
30
9
private _sdkOptions : SdkOptions ;
@@ -33,31 +12,18 @@ export class SDK {
33
12
// private _event: EventModule;
34
13
35
14
constructor ( options ?: SdkCtorOptions ) {
36
- const { networkType } = { ...options } ;
37
-
38
- const mainnetOptions = {
39
- contractAddress : '0x902e2f3179aa959137fdc823754555b10c40f5b1' ,
40
- rpcUrl : 'https://rpc.linea.build' ,
41
- chainId : 59144 ,
42
- abi : ABI
43
- }
44
-
45
- const testnetOptions = {
46
- contractAddress : '0xD5C57B49b58744202EB1e67F4b7e6cB1aD06844f' ,
47
- rpcUrl : 'https://open-campus-codex-sepolia.drpc.org' ,
48
- chainId : 656476 ,
49
- abi : ABI
50
- }
51
-
52
- let networkOptions = mainnetOptions
15
+ const { networkOptions } = { ...options } ;
53
16
54
- if ( networkType === NetworkType . Testnet ) {
55
- networkOptions = testnetOptions
17
+ if ( ! networkOptions ) {
18
+ throw new Error ( 'Network options are required' ) ;
56
19
}
57
20
58
21
this . _sdkOptions = {
59
22
privateKey : options ?. privateKey ,
60
- networkOptions
23
+ networkOptions : {
24
+ ...networkOptions ,
25
+ abi : ABI
26
+ }
61
27
}
62
28
63
29
this . _client = new ClientModule ( this ) ;
0 commit comments