Skip to content

Commit

Permalink
.pyi file optional arg bug
Browse files Browse the repository at this point in the history
  • Loading branch information
smartgoo committed Dec 7, 2024
1 parent 96351c2 commit 65850d5
Showing 1 changed file with 59 additions and 56 deletions.
115 changes: 59 additions & 56 deletions python/kaspa.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from enum import Enum
from typing import Any, Callable, Iterator, Optional, Union
from typing import Any, Callable, Iterator, Optional, TypedDict, Union

class Address:

Expand Down Expand Up @@ -117,7 +117,7 @@ class TransactionInput:
signature_script: Union[str, bytes, list[int]],
sequence: int,
sig_op_count: int,
utxo: Optional[UtxoEntryReference]
utxo: Optional[UtxoEntryReference] = None
) -> None: ...

@property
Expand Down Expand Up @@ -263,10 +263,10 @@ class Language(Enum):

class Mnemonic:

def __init__(self, phrase: str, language: Optional[Language]) -> None: ...
def __init__(self, phrase: str, language: Optional[Language] = None) -> None: ...

@staticmethod
def validate(phrase: str, language: Optional[Language]) -> bool: ...
def validate(phrase: str, language: Optional[Language] = None) -> bool: ...

@property
def entropy(self) -> str: ...
Expand All @@ -275,15 +275,15 @@ class Mnemonic:
def entropy(self, entropy: str) -> None: ...

@staticmethod
def random(word_count: Optional[int]) -> Mnemonic: ...
def random(word_count: Optional[int] = None) -> Mnemonic: ...

@property
def phrase(self) -> str: ...

@phrase.setter
def phrase(self, phrase: str) -> None: ...

def to_seed(self, password: Optional[str]) -> str: ...
def to_seed(self, password: Optional[str] = None) -> str: ...


class ScriptBuilder:
Expand Down Expand Up @@ -608,7 +608,7 @@ class Opcodes(Enum):
OpInvalidOpCode = 0xff


def sign_message(message: str, private_key: PrivateKey) -> str: ...
def sign_message(message: str, private_key: PrivateKey, no_aux_rand: Optional[bool] = False) -> str: ...

def verify_message(message: str, signature: str, public_key: PublicKey) -> bool: ...

Expand All @@ -620,13 +620,13 @@ class Generator:
self,
network_id: str,
entries: list[Union[UtxoEntryReference, dict]],
outputs: list[Union[PaymentOutput, dict]],
change_address: Address,
payload: Optional[Union[str, bytes, list[int]]],
priority_fee: Optional[int],
priority_entries: Optional[list[Union[UtxoEntryReference, dict]]],
sig_op_count: Optional[int],
minimun_signatures: Optional[int]
outputs: Optional[list[Union[PaymentOutput, dict]]] = None,
payload: Optional[Union[str, bytes, list[int]]] = None,
priority_fee: Optional[int] = None,
priority_entries: Optional[list[Union[UtxoEntryReference, dict]]] = None,
sig_op_count: Optional[int] = None,
minimun_signatures: Optional[int] = None
) -> None: ...

def estimate(
Expand Down Expand Up @@ -682,13 +682,13 @@ class PendingTransaction:

def get_utxo_entries(self) -> list[UtxoEntryReference]: ...

def create_input_signature(self, input_index: int, private_key: PrivateKey, sighash_type: Optional[SighashType]) -> str: ...
def create_input_signature(self, input_index: int, private_key: PrivateKey, sighash_type: Optional[SighashType] = None) -> str: ...

def fill_input(self, input_index: int, signature_script: Union[str, bytes, list[int]]) -> None: ...

def sign_input(self, input_index: int, private_key: PrivateKey, sighash_type: Optional[SighashType]) -> None: ...
def sign_input(self, input_index: int, private_key: PrivateKey, sighash_type: Optional[SighashType] = None) -> None: ...

def sign(self, private_keys: list[PrivateKey], check_fully_signed: Optional[bool]) -> None: ...
def sign(self, private_keys: list[PrivateKey], check_fully_signed: Optional[bool] = None) -> None: ...

def submit(self, rpc_client: RpcClient) -> str: ...

Expand Down Expand Up @@ -717,43 +717,46 @@ class GeneratorSummary:
def final_transaction_id(self) -> Optional[str]: ...


def calculate_transaction_fee(network_id: str, tx: Transaction, minimum_signatures: Optional[int]) -> Optional[int]: ...
def calculate_transaction_fee(network_id: str, tx: Transaction, minimum_signatures: Optional[int] = None) -> Optional[int]: ...

def calculate_transaction_mass(network_id: str, tx: Transaction, minimum_signatures: Optional[int]) -> int: ...
def calculate_transaction_mass(network_id: str, tx: Transaction, minimum_signatures: Optional[int] = None) -> int: ...

def update_transaction_mass(network_id: str, tx: Transaction, minimum_signatures: Optional[int]) -> bool: ...
def update_transaction_mass(network_id: str, tx: Transaction, minimum_signatures: Optional[int] = None) -> bool: ...

def create_transaction(
utxo_entry_source: list[dict],
outputs: list[dict],
priority_fee: int,
payload: Optional[list[int]],
sig_op_count: Optional[int]
payload: Optional[list[int]] = None,
sig_op_count: Optional[int] = None
) -> Transaction: ...

class CreateTransactionsDict(TypedDict):
transactions: list[PendingTransaction]
summary: GeneratorSummary

def create_transactions(
network_id: str,
entries: list[dict],
outputs: list[dict],
change_address: Address,
payload: Optional[str],
priority_fee: Optional[int],
priority_entries: Optional[list[dict]],
sig_op_count: Optional[int],
minimum_signatures: Optional[int]
) -> dict: ...
outputs: Optional[list[dict]] = None,
payload: Optional[str] = None,
priority_fee: Optional[int] = None,
priority_entries: Optional[list[dict]] = None,
sig_op_count: Optional[int] = None,
minimum_signatures: Optional[int] = None
) -> CreateTransactionsDict: ...

def estimate_transactions(
network_id: str,
entries: list[dict],
outputs: list[dict],
change_address: Address,
payload: Optional[str],
priority_fee: Optional[int],
priority_entries: Optional[list[dict]],
sig_op_count: Optional[int],
minimum_signatures: Optional[int]
outputs: Optional[list[dict]] = None,
payload: Optional[str] = None,
priority_fee: Optional[int] = None,
priority_entries: Optional[list[dict]] = None,
sig_op_count: Optional[int] = None,
minimum_signatures: Optional[int] = None
) -> GeneratorSummary: ...

def kaspa_to_sompi(kaspa: float) -> int: ...
Expand All @@ -777,7 +780,7 @@ class DerivationPath:

def parent(self) -> Optional[DerivationPath]: ...

def push(self, child_number: int, hardened: bool) -> None: ...
def push(self, child_number: int, hardened: Optional[bool] = None) -> None: ...

def to_string(self) -> str: ...

Expand Down Expand Up @@ -823,7 +826,7 @@ class PrivateKey:
class PrivateKeyGenerator:

def __init__(self, xprv: str, is_multisig: bool,
account_index: int, cosigner_index: int) -> str: ...
account_index: int, cosigner_index: Optional[int] = None) -> str: ...

def receive_key(self, index: int) -> PrivateKey: ...

Expand All @@ -846,10 +849,10 @@ class PublicKey:
class PublicKeyGenerator:

@staticmethod
def from_xpub(kpub: str, cosigner_index: Optional[int]) ->PublicKeyGenerator: ...
def from_xpub(kpub: str, cosigner_index: Optional[int] = None) ->PublicKeyGenerator: ...

@staticmethod
def from_master_xprv(xprv: str, is_multisig: bool, account_index: int, cosigner_index: Optional[int]) -> PublicKeyGenerator: ...
def from_master_xprv(xprv: str, is_multisig: bool, account_index: int, cosigner_index: Optional[int] = None) -> PublicKeyGenerator: ...

def receive_pubkeys(self, start: int, end: int) -> list[PublicKey]: ...

Expand Down Expand Up @@ -907,7 +910,7 @@ class XPrv:
@staticmethod
def from_xprv(xprv: str) -> XPrv: ...

def derive_child(self, child_number: int, hardened: Optional[bool]) -> XPrv: ...
def derive_child(self, child_number: int, hardened: Optional[bool] = None) -> XPrv: ...

def derive_path(self, path: Union[str, DerivationPath]) -> XPrv: ...

Expand Down Expand Up @@ -942,7 +945,7 @@ class XPub:

def __init__(self, xpub: str) -> None: ...

def derive_child(self, child_number: int, hardened: Optional[bool]) -> XPub: ...
def derive_child(self, child_number: int, hardened: Optional[bool] = None) -> XPub: ...

def derive_path(self, path: str) -> XPub: ...

Expand All @@ -968,7 +971,7 @@ class XPub:

class Resolver:

def __init__(self, urls: Optional[list[str]], tls: Optional[int]) -> None: ...
def __init__(self, urls: Optional[list[str]] = None, tls: Optional[int] = None) -> None: ...

def urls(self) -> list[str]: ...

Expand All @@ -981,7 +984,7 @@ class Resolver:

class RpcClient:

def __init__(self, resolver: Optional[Resolver], url: Optional[str], encoding: Optional[str], network_id: Optional[str]) -> None: ...
def __init__(self, resolver: Optional[Resolver] = None, url: Optional[str] = None, encoding: Optional[str] = None, network_id: Optional[str] = None) -> None: ...

@property
def url(self) -> str: ...
Expand All @@ -1002,7 +1005,7 @@ class RpcClient:
@property
def node_id(self) -> str: ...

async def connect(self, block_async_connect: Optional[bool], strategy: Optional[str], url: Optional[str], timeout_duration: Optional[int], retry_interval: Optional[int]) -> None: ...
async def connect(self, block_async_connect: Optional[bool] = None, strategy: Optional[str] = None, url: Optional[str] = None, timeout_duration: Optional[int] = None, retry_interval: Optional[int] = None) -> None: ...

async def disconnect(self) -> None: ...

Expand All @@ -1012,7 +1015,7 @@ class RpcClient:

def add_event_listener(self, event: str, callback: Callable[..., Any], *args: Any, **kwargs: Optional[Any]) -> None: ...

def remove_event_listener(self, event: str, callback: Callable[..., Any]) -> None: ...
def remove_event_listener(self, event: str, callback: Callable[..., Any] = None) -> None: ...

def remove_all_event_listeners(self) -> None: ...

Expand Down Expand Up @@ -1058,29 +1061,29 @@ class RpcClient:

async def unsubscribe_virtual_daa_score_changed(self) -> None: ...

async def get_block_count(self, request: Optional[dict]) -> dict: ...
async def get_block_count(self, request: Optional[dict] = None) -> dict: ...

async def get_block_dag_info(self, request: Optional[dict]) -> dict: ...
async def get_block_dag_info(self, request: Optional[dict] = None) -> dict: ...

async def get_coin_supply(self, request: Optional[dict]) -> dict: ...
async def get_coin_supply(self, request: Optional[dict] = None) -> dict: ...

async def get_connected_peer_info(self, request: Optional[dict]) -> dict: ...
async def get_connected_peer_info(self, request: Optional[dict] = None) -> dict: ...

async def get_info(self, request: Optional[dict]) -> dict: ...
async def get_info(self, request: Optional[dict] = None) -> dict: ...

async def get_peer_addresses(self, request: Optional[dict]) -> dict: ...
async def get_peer_addresses(self, request: Optional[dict] = None) -> dict: ...

async def get_sink(self, request: Optional[dict]) -> dict: ...
async def get_sink(self, request: Optional[dict] = None) -> dict: ...

async def get_sink_blue_score(self, request: Optional[dict]) -> dict: ...
async def get_sink_blue_score(self, request: Optional[dict] = None) -> dict: ...

async def ping(self, request: Optional[dict]) -> dict: ...
async def ping(self, request: Optional[dict] = None) -> dict: ...

async def shutdown(self, request: Optional[dict]) -> dict: ...
async def shutdown(self, request: Optional[dict] = None) -> dict: ...

async def get_server_info(self, request: Optional[dict]) -> dict: ...
async def get_server_info(self, request: Optional[dict] = None) -> dict: ...

async def get_sync_status(self, request: Optional[dict]) -> dict: ...
async def get_sync_status(self, request: Optional[dict] = None) -> dict: ...

async def add_peer(self, request: dict) -> dict: ...

Expand Down

0 comments on commit 65850d5

Please sign in to comment.