-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathindex.ts
39 lines (36 loc) · 1.21 KB
/
index.ts
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
import {
KATANA_CLASS_HASH,
KATANA_ETH_CONTRACT_ADDRESS,
KATANA_PREFUNDED_ADDRESS,
KATANA_PREFUNDED_PRIVATE_KEY,
LOCAL_KATANA,
LOCAL_RELAY,
LOCAL_TORII,
} from "../constants";
export type DojoConfig = ReturnType<typeof createDojoConfig>;
interface DojoConfigParams {
rpcUrl?: string;
toriiUrl?: string;
relayUrl?: string;
masterAddress?: string;
masterPrivateKey?: string;
accountClassHash?: string;
feeTokenAddress?: string;
manifest: any;
}
/**
* Create Dojo Config: Creates a Dojo Config object. If no parameters are passed, it will use the default values of the current Dojo version.
*/
export function createDojoConfig({ manifest, ...config }: DojoConfigParams) {
return {
rpcUrl: config.rpcUrl ?? LOCAL_KATANA,
toriiUrl: config.toriiUrl ?? LOCAL_TORII,
relayUrl: config.relayUrl ?? LOCAL_RELAY,
masterAddress: config.masterAddress ?? KATANA_PREFUNDED_ADDRESS,
masterPrivateKey:
config.masterPrivateKey ?? KATANA_PREFUNDED_PRIVATE_KEY,
accountClassHash: config.accountClassHash ?? KATANA_CLASS_HASH,
feeTokenAddress: config.feeTokenAddress ?? KATANA_ETH_CONTRACT_ADDRESS,
manifest,
};
}