FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-bitshares/bitshares/instance.py at master · allrob23/python-bitshares · GitHub
allrob23
/
python-bitshares
Public
forked from
bitshares/python-bitshares
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-bitshares
/
bitshares
/
instance.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
50 lines (32 loc) · 1.44 KB
Breadcrumbs
python-bitshares
/
bitshares
/
instance.py
Copy path
File metadata and controls
50 lines (32 loc) · 1.44 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
# -*- coding: utf-8 -*-
from
graphenecommon
.
instance
import
AbstractBlockchainInstanceProvider
class
SharedInstance
:
"""This class merely offers a singelton for the Blockchain Instance."""
instance
=
None
config
=
{}
class
BlockchainInstance
(
AbstractBlockchainInstanceProvider
):
"""This is a class that allows compatibility with previous naming conventions."""
_sharedInstance
=
SharedInstance
def
__init__
(
self
,
*
args
,
**
kwargs
):
# Also allow 'bitshares_instance'
if
kwargs
.
get
(
"bitshares_instance"
):
kwargs
[
"blockchain_instance"
]
=
kwargs
[
"bitshares_instance"
]
AbstractBlockchainInstanceProvider
.
__init__
(
self
,
*
args
,
**
kwargs
)
def
get_instance_class
(
self
):
"""Should return the Chain instance class, e.g. `bitshares.BitShares`"""
import
bitshares
as
bts
return
bts
.
BitShares
@
property
def
bitshares
(
self
):
"""Alias for the specific blockchain."""
return
self
.
blockchain
def
shared_blockchain_instance
():
return
BlockchainInstance
().
shared_blockchain_instance
()
def
set_shared_blockchain_instance
(
instance
):
instance
.
clear_cache
()
# instance.set_shared_instance()
BlockchainInstance
.
set_shared_blockchain_instance
(
instance
)
def
set_shared_config
(
config
):
BlockchainInstance
.
set_shared_config
(
config
)
shared_bitshares_instance
=
shared_blockchain_instance
set_shared_bitshares_instance
=
set_shared_blockchain_instance
Back
|
FazBrowse Home
|
New Git URL