FederationWallet

FederationWallet

class FederationWallet(**kwargs)

Implements the federationwallet api endpoints.

general_info(**kwargs) WalletGeneralInfoModel

Retrieves general information about the wallet.

Parameters

**kwargs – Extra keyword arguments.

Returns

General information about the federation wallet.

Return type

WalletGeneralInfoModel

Raises

APIError – Error thrown by node API. See message for details.

balance(**kwargs) WalletBalanceModel

Retrieves wallet balances.

Parameters

**kwargs – Extra keyword arguments.

Returns

Federation wallet balance information.

Return type

WalletBalanceModel

Raises

APIError – Error thrown by node API. See message for details.

history(max_entries_to_return: int, **kwargs) List[WithdrawalModel]

Retrieves a withdrawal history for the wallet.

Parameters
  • max_entries_to_return (int) – The maximum number of history entries to return.

  • **kwargs – Extra keyword arguments.

Returns

The federation wallet history.

Return type

List[WithdrawalModel]

Raises

APIError – Error thrown by node API. See message for details.

sync(block_hash: Union[str, uint256], **kwargs) None

Starts sending block to wallet for synchronisation. Demo/testing use only.

Parameters
  • block_hash (uint256, str) – The block hash at which to start sync.

  • **kwargs – Extra keyword arguments.

Returns

None

Raises

APIError – Error thrown by node API. See message for details.

enable_federation(mnemonic: str, password: str, passphrase: Optional[str] = None, timeout_seconds: int = 60, **kwargs) Union[None, str]

Enables the federation so that it can sign transactions.

Parameters
  • mnemonic (str) – The mnemonic.

  • password (str) – The password.

  • passphrase (str, optional) – The passphrase.

  • timeout_seconds (int, optional) – Seconds to timeout. Default=60.

  • **kwargs – Extra keyword arguments.

Returns

None if successful, str if error.

Return type

(str, None)

Raises

APIError

remove_transactions(resync: bool = True, **kwargs) List[RemovedTransactionModel]

Remove all transactions from the wallet.

Parameters
  • resync (bool, optional) – A flag to resync the wallet after transactions are removed. Default=True.

  • **kwargs – Extra keyword arguments.

Returns

A list of removed transactions from the federation wallet.

Return type

List[RemovedTransactionModel]

Raises

APIError – Error thrown by node API. See message for details.

RemovedTransactionModel

class RemovedTransactionModel(*, transactionId: uint256, creationTime: datetime.datetime)

A pydantic model for a removed transaction.

transaction_id: uint256

The removed transaction hash.

creation_time: datetime.datetime

The creation time of the removed transaction.

WalletBalanceModel

class WalletBalanceModel(*, balances: List[AccountBalanceModel])

A pydantic model for a wallet balance.

balances: List[AccountBalanceModel]

A list of account balances.

WalletGeneralInfoModel

class WalletGeneralInfoModel(*, walletName: str = None, network: str, creationTime: datetime.datetime, isDecrypted: bool, lastBlockSyncedHeight: int, chainTip: int, isChainSynced: bool, connectedNodes: int)

A model representing general wallet info.

wallet_name: Optional[str]

The name of the wallet. Will be None for multisig.

network: str

The name of the network the wallet is operating on.

creation_time: datetime.datetime

The datetime of wallet creation

is_decrypted: bool

If true, wallet is decrypted.

last_block_synced_height: int

The height of last block synced by wallet.

chain_tip: int

The height off the chain tip.

is_chain_synced: bool

If true, chain is synced.

connected_nodes: int

The number of connected nodes.

WithdrawalModel

class WithdrawalModel(*, id: uint256, depositId: uint256, amount: Money, payingTo: Union[str, Address], blockHeight: int, blockHash: uint256, signatureCount: int, spendingOutputDetails: str, transferStatus: CrossChainTransferStatus)

A pydantic model for a withdrawal processed by the multisig federation.

trx_id: uint256

The transaction hash.

deposit_id: uint256

The deposit transaction hash.

amount: Money

The amount of the withdrawal.

paying_to: Union[str, Address]

The address receiving the withdrawal.

block_height: int

The block height of the withdrawal.

block_hash: uint256

The hash of the block containing the withdrawal.

signature_count: int

The number of signatures on the withdrawal.

spending_output_details: str

Spending output details.

transfer_status: CrossChainTransferStatus

The cross chain transfer status.