forked from kaspanet/rusty-kaspa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Python .pyi file example for type hints/editor completion (kaspanet#72)
* Feat: adding pyi file and testing first commit * Feat: Added py interface file * fix python IDE autocompletion and imports
- Loading branch information
Showing
3 changed files
with
66 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
from kaspa import ( | ||
PrivateKey, | ||
) | ||
from kaspa import PrivateKey | ||
|
||
if __name__ == "__main__": | ||
private_key = PrivateKey('b7e151628aed2a6abf7158809cf4f3c762e7160f38b4da56a784d9045190cfef') | ||
private_key = PrivateKey( | ||
'b7e151628aed2a6abf7158809cf4f3c762e7160f38b4da56a784d9045190cfef') | ||
print(f'Private Key: {private_key.to_hex()}') | ||
|
||
public_key = private_key.to_public_key() | ||
print(f'Public Key: {public_key.to_string_impl()}') | ||
|
||
address = public_key.to_address('mainnet') | ||
print(f'Address: {address.address_to_string()}') | ||
print(f'Address: {address.address_to_string()}') |
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
|
||
class Address: | ||
|
||
def __init__(self, address: str) -> None: ... | ||
|
||
def to_string(self) -> str: ... | ||
|
||
def version(self) -> str: ... | ||
|
||
def set_prefix(self, prefix: str) -> None: ... | ||
|
||
def payload(self) -> str: ... | ||
|
||
@staticmethod | ||
def validate(address: str) -> bool: ... | ||
|
||
|
||
class PrivateKeyGenerator: | ||
|
||
def __init__(self, xprv: str, is_multisig: bool, | ||
account_index: int, cosigner_index: int) -> str: ... | ||
|
||
def receive_key(self, index: int) -> PrivateKey: ... | ||
|
||
def change_key(self, index: int) -> PrivateKey: ... | ||
|
||
|
||
class PrivateKey: | ||
|
||
def __init__(self, secret_key: str) -> None: ... | ||
|
||
def to_string(self) -> str: ... | ||
|
||
def to_public_key(self) -> PublicKey: ... | ||
|
||
def to_address(self, network: str) -> Address: ... | ||
|
||
def to_address_ecdsa(self, network: str) -> Address: ... | ||
|
||
@staticmethod | ||
def try_new(key: str) -> PrivateKey: ... | ||
|
||
|
||
class PublicKey: | ||
def __init__(self, key: str) -> None: ... | ||
|
||
def to_string(self) -> str: ... | ||
|
||
def to_address(self, network: str) -> Address: ... | ||
|
||
def to_address_ecdsa(self, network: str) -> Address: ... | ||
|
||
|
||
class RpcClient: | ||
|
||
def __init__(self, url: str) -> None: ... | ||
|
||
def is_connected(self) -> bool: ... | ||
|
||
def connect(self) -> None: ... | ||
|
||
def disconnect(self) -> None: ... |
File renamed without changes.