def __init__(self, config): self.config = config self.dbCon = sqlite.connect('gateway.db') self.node = self.config['tn']['node'] self.pwTN = PyCWaves.PyCWaves() self.pwTN.setNode(node=self.node, chain=self.config['tn']['network'], chain_id='L') seed = os.getenv(self.config['tn']['seedenvname'], self.config['tn']['gatewaySeed']) self.tnAddress = self.pwTN.Address(seed=seed) self.tnAsset = self.pwTN.Asset(self.config['tn']['assetId']) self.pwW = PyCWaves.PyCWaves() self.pwW.setNode(node=self.config['waves']['node'], chain=self.config['waves']['network']) self.wAddress = self.pwW.Address( seed=os.getenv(self.config['waves']['seedenvname'], self.config['waves']['gatewaySeed'])) self.wAsset = self.pwW.Asset(self.config['waves']['assetId']) self.verifier = verifier(config) cursor = self.dbCon.cursor() self.lastScannedBlock = cursor.execute( 'SELECT height FROM heights WHERE chain = "TN"').fetchall()[0][0]
def __init__(self, config): self.config = config self.dbCon = sqlite.connect('gateway.db') self.node = self.config['tn']['node'] self.verifier = verifier(config) cursor = self.dbCon.cursor() self.lastScannedBlock = cursor.execute( 'SELECT height FROM heights WHERE chain = "TN"').fetchall()[0][0]
def __init__(self, config): self.config = config self.dbCon = sqlite.connect('gateway.db') self.node = self.config['tn']['node'] self.w3 = Web3(Web3.HTTPProvider(self.config['erc20']['node'])) self.privatekey = os.getenv(self.config['erc20']['seedenvname'], self.config['erc20']['privateKey']) self.verifier = verifier(config) cursor = self.dbCon.cursor() self.lastScannedBlock = cursor.execute( 'SELECT height FROM heights WHERE chain = "TN"').fetchall()[0][0]
def __init__(self, config, db=None): self.config = config if db == None: if self.config['main']['use-pg']: self.db = dbPGCalls(config) else: self.db = dbCalls(config) else: self.db = db self.tnc = tnCalls(config, self.db) self.verifier = verifier(config, self.db) self.otc = otherCalls(config, self.db)
def __init__(self, config): self.config = config self.tnc = tnCalls(config) self.verifier = verifier(config) if self.config['other']['etherscan-on']: self.otc = etherscanCalls(config) else: self.otc = otherCalls(config) if self.config['main']['use-pg']: self.db = dbPGCalls(config) else: self.db = dbCalls(config)
def __init__(self, config, db = None): self.config = config if db == None: if self.config['main']['use-pg']: self.db = dbPGCalls(config) else: self.db = dbCalls(config) else: self.db = db self.tnc = tnCalls(config, self.db) self.verifier = verifier(config, self.db) self.lastScannedBlock = self.db.lastScannedBlock("TN")
def __init__(self, config, db = None): self.config = config if db == None: if self.config['main']['use-pg']: self.db = dbPGCalls(config) else: self.db = dbCalls(config) else: self.db = db self.tnc = tnCalls(config, self.db) self.verifier = verifier(config, self.db) if self.config['other']['etherscan-on']: self.otc = etherscanCalls(config, self.db) else: self.otc = otherCalls(config, self.db) self.lastScannedBlock = self.db.lastScannedBlock("ETH")
def __init__(self, config): self.config = config self.dbCon = sqlite.connect('gateway.db') self.myProxy = authproxy.AuthServiceProxy(self.config['other']['node']) self.pwTN = PyCWaves.PyCWaves() self.pwTN.setNode(node=self.config['tn']['node'], chain=self.config['tn']['network'], chain_id='L') self.pwTN.THROW_EXCEPTION_ON_ERROR = True seed = os.getenv(self.config['tn']['seedenvname'], self.config['tn']['gatewaySeed']) self.tnAddress = self.pwTN.Address(seed=seed) self.tnAsset = self.pwTN.Asset(self.config['tn']['assetId']) self.verifier = verifier(config) cursor = self.dbCon.cursor() self.lastScannedBlock = cursor.execute( 'SELECT height FROM heights WHERE chain = "Other"').fetchall( )[0][0]
security = HTTPBasic() app.mount("/static", StaticFiles(directory="static"), name="static") templates = Jinja2Templates(directory="templates") with open('config.json') as json_file: config = json.load(json_file) if config['main']['use-pg']: dbc = dbPGCalls(config) else: dbc = dbCalls(config) tnc = tnCalls(config, dbc) #otc = otherCalls(config, dbc) checkit = verifier(config, dbc) def get_current_username(credentials: HTTPBasicCredentials = Depends(security)): correct_username = secrets.compare_digest(credentials.username, config["main"]["admin-username"]) correct_password = secrets.compare_digest(credentials.password, config["main"]["admin-password"]) if not (correct_username and correct_password): print("ERROR: invalid logon details") raise HTTPException( status_code=HTTP_401_UNAUTHORIZED, detail="Incorrect email or password", headers={"WWW-Authenticate": "Basic"}, ) return credentials.username def get_tnBalance():
app.add_middleware( CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) security = HTTPBasic() app.mount("/static", StaticFiles(directory="static"), name="static") templates = Jinja2Templates(directory="templates") with open('config.json') as json_file: config = json.load(json_file) checkit = verifier(config) def get_current_username( credentials: HTTPBasicCredentials = Depends(security)): correct_username = secrets.compare_digest(credentials.username, config["main"]["admin-username"]) correct_password = secrets.compare_digest(credentials.password, config["main"]["admin-password"]) if not (correct_username and correct_password): raise HTTPException( status_code=HTTP_401_UNAUTHORIZED, detail="Incorrect email or password", headers={"WWW-Authenticate": "Basic"}, ) return credentials.username
async def api_wdCheck(tnAddress): checkit = verifier(config) result = checkit.checkWD(address=tnAddress) return result
async def api_depositCheck(tnAddress): checkit = verifier(config) result = checkit.checkDeposit(address=tnAddress) return result