OSDN Git Service

feat : add net select support
[bytom/Bytom-JS-SDK.git] / src / index.js
1 import keysApi from './api/keys.js';
2 import accountsApi from './api/accounts.js';
3 import transactionsApi from './api/transactions.js';
4 import keysSDK from './sdk/keys.js';
5 import accountsSDK from './sdk/accounts.js';
6 import transactionSDK from './sdk/transaction.js';
7 import walletSDK from './sdk/wallet.js';
8 import {serverHttp, http} from './http.js';
9
10 //todo vue use
11 function Bytom(serverHost, wasmPath, baseURL, token) {
12     this.install = function(Vue) {
13         Vue.prototype.$Bytom = this;
14     };
15     
16     if(baseURL) {
17         this.http = new http(baseURL, token);
18         this.keys = new keysApi(this.http);
19         this.accounts = new accountsApi(this.http);
20         this.transactions = new transactionsApi(this.http);
21     }
22
23     Bytom.wasmPath = wasmPath;
24     this.serverHttp = new serverHttp(serverHost);
25     this.sdk = {};
26     this.sdk.keys = new keysSDK();
27     this.sdk.accounts = new accountsSDK(this.serverHttp);
28     this.sdk.transaction = new transactionSDK(this.serverHttp);
29     this.sdk.wallet = new walletSDK(this);
30 }
31
32 export default Bytom;