Skip to content
Snippets Groups Projects
Commit f9ec7cc5 authored by s2191814's avatar s2191814
Browse files

Add wallet.py

parent 8a252a91
No related branches found
No related tags found
1 merge request!2Draft: initial user flow for creating a wallet
This commit is part of merge request !2. Comments created here will be created in the context of that merge request.
#!/bin/env python3
from typing import Union
from bitcoinlib.wallets import Wallet, HDKey, WalletKey
import os
from util import DBManager
db = DBManager()
def new_wallet(userId: Union[int, str]) -> Wallet:
"""
Creates a new regular wallet.
userId: name of the wallet
"""
return Wallet.create(name=userId,
network=os.getenv("BTC_NETWORK"),
db_uri=db.db_uri)
def new_multig_wallet(userId: Union[int, str],
sigs: int, klist: list[HDKey]) -> WalletKey:
"""
Creates a new multisig wallet.
userId: name of the wallet
sigs: number of signatures needed for the wallet
klist: list of (public master) keys inside the wallet
"""
return Wallet.create(name=userId,
sigs_required=sigs,
keys=klist,
network=os.getenv("BTC_NETWORK"),
db_uri=db.db_uri)
def new_HD_key() -> HDKey:
"""
Generates a new Hierarchical Deterministic key
"""
return HDKey(network=os.getenv("BTC_NETWORK"))
def main():
pass
if __name__ == "__main__":
main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment