-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: KayleCoder <[email protected]>
- Loading branch information
1 parent
afd25a7
commit a84d3c4
Showing
4 changed files
with
79 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
import {ApiPromise, WsProvider} from '@polkadot/api'; | ||
import {ApiPromise, ApiRx, WsProvider} from '@polkadot/api'; | ||
import {typesBundleForPolkadot} from '@crustio/type-definitions'; | ||
import {configs} from '../../config/config'; | ||
|
||
export const api = new ApiPromise({ | ||
provider: new WsProvider(configs.crust.chainWsUrl), | ||
typesBundle: typesBundleForPolkadot, | ||
}); | ||
export const apiConnect = (): ApiPromise => { | ||
return new ApiPromise({ | ||
provider: new WsProvider(configs.crust.chainWsUrl), | ||
typesBundle: typesBundleForPolkadot, | ||
}); | ||
} | ||
|
||
export const disconnectApi = async (api: ApiPromise) => { | ||
if (api) { | ||
await api.disconnect().catch((e) => {}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters