Skip to content

Commit

Permalink
Merge pull request #184 from fireblocks/Add-rescan-txs
Browse files Browse the repository at this point in the history
added a rescan_transactions
  • Loading branch information
barakfireblocks authored Aug 27, 2024
2 parents 1c547be + 8894798 commit 562bfbc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
12 changes: 12 additions & 0 deletions fireblocks_sdk/api_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,18 @@ def __init__(self, message="Fireblocks SDK error", error_code=None):
self.error_code = error_code
super().__init__(self.message)

class RescanTx:
"""
Args
asset_id (string): The asset symbol
tx_hash (string): The hash of the transaction
"""
def __init__(self, asset_id, tx_hash):
self.asset_id = asset_id
self.tx_hash = tx_hash

def to_dict(self):
return convert_class_to_dict(self.__dict__)

class PagedVaultAccountsRequestFilters:
""" Optional filters to apply for request
Expand Down
13 changes: 13 additions & 0 deletions fireblocks_sdk/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
SpamTokenOwnershipValues,
TokenOwnershipSpamUpdatePayload,
TokenOwnershipSpamUpdatePayload,
RescanTx,
)
from .tokenization_api_types import \
CreateTokenRequest, \
Expand Down Expand Up @@ -2108,6 +2109,18 @@ def get_max_bip44_index_used(self, vault_account_id, asset_id):

return self._get_request(url)

def rescan_transactions_beta(self, rescan_txs: List[RescanTx]) -> List[Dict[str, Any]]:
"""initiate rescan for given transactions
Args:
rescan_txs: (Array of RescanTx): the transaction asset_id and hash for rescan
Each RescanTx should have the following keys:
- 'asset_id': string
- 'tx_hash': String
"""
path = f"/v1/transactions/rescan"
request_data = [tx.to_dict() for tx in rescan_txs]
return self._post_request(path, request_data)

def get_paginated_addresses(self, vault_account_id, asset_id, limit=500, before=None, after=None):
"""Gets a paginated response of the addresses for a given vault account and asset
Args:
Expand Down

0 comments on commit 562bfbc

Please sign in to comment.