Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
#----------------------------------------------
# load pip cache if cache exists
#----------------------------------------------
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip
Expand All @@ -35,7 +35,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
python-version: [ "3.9", "3.10", "3.11" ]
runs-on: "ubuntu-latest"
steps:
#----------------------------------------------
Expand All @@ -61,7 +61,7 @@ jobs:
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
Expand Down
80 changes: 6 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ Mainnet
- Flare: `"flare"`
- Gnosis Chain: `"gnosis"`
- Scroll: `"scroll"`
- Stellar: `"stellar"`
- Linea: `"linea"`
- Xai: `"xai"`
- Xlayer: `"xlayer"`
Expand All @@ -118,19 +119,15 @@ Testnet
- Ethereum Holesky: `"eth_holesky"`
- Avalanche Fuji: `"avalanche_fuji"`
- Polygon Amoy: `"polygon_amoy"`
- Optimism Testnet: `"optimism_testnet"`
- Optimism Sepolia: `"optimism_sepolia"`
- Base Sepolia: `"base_sepolia"`

Appchain

- META Apes: `"bas_metaapes"`
- Neura Devnet `"neura_devnet"`
- Neura Testnet `"neura_testnet_v1"`

Appchain Testnet

- META Apes Testnet: `"bas_metaapes_testnet"`
- Neura Devnet `"neura_devnet"`
- Neura Testnet `"neura_testnet_v1"`
- Incentiv Devnet `"incentiv_devnet"`
- Incentiv Devnet `"incentiv_devnet_v3"`
- Incentiv Testnet `"incentiv_testnet"`

When passing blockchain, you can use one available from `types.py` (preferred) or just a string value.

Expand All @@ -141,9 +138,6 @@ When passing blockchain, you can use one available from `types.py` (preferred) o
Early Access

- [`get_token_price_history`](#gettokenpricehistory--gettokenpricehistoryraw)
- [`get_account_balance_historical`](#getaccountbalancehistorical--getaccountbalancehistoricalraw)
- [`get_internal_transactions_by_block_number`](#getinternaltransactionsbyblocknumber--getinternaltransactionsbyblocknumberraw)
- [`get_internal_transactions_by_parent_hash`](#getinternaltransactionsbyparenthash--getinternaltransactionsbyparenthashraw)

Token API

Expand Down Expand Up @@ -208,68 +202,6 @@ result = advancedAPI.get_token_price_history(
print(result)
```

#### `get_account_balance_historical` / `get_account_balance_historical_raw`

Get the coin and token balances of the wallet at specified block.

```python3
from ankr import AnkrAdvancedAPI
from ankr.types import Blockchain, GetAccountBalanceHistoricalRequest

advancedAPI = AnkrAdvancedAPI("YOUR-TOKEN")

result = advancedAPI.get_account_balance_historical(
request=GetAccountBalanceHistoricalRequest(
blockchain=Blockchain.Eth,
walletAddress='vitalik.eth',
onlyWhitelisted=False,
blockHeight=17967813,
)
)
print(result)
```

#### `get_internal_transactions_by_block_number` / `get_internal_transactions_by_block_number_raw`

Get a list of internal transactions in the block.

```python3
from ankr import AnkrAdvancedAPI
from ankr.types import Blockchain, GetInternalTransactionsByBlockNumberRequest

advancedAPI = AnkrAdvancedAPI("YOUR-TOKEN")

result = advancedAPI.get_internal_transactions_by_block_number(
request=GetInternalTransactionsByBlockNumberRequest(
blockchain=Blockchain.Eth,
blockNumber=10000000,
onlyWithValue=True,
)
)
for transaction in result:
print(transaction)
```

#### `get_internal_transactions_by_parent_hash` / `get_internal_transactions_by_parent_hash_raw`

Get a list of internal transactions in the transaction.

```python3
from ankr import AnkrAdvancedAPI
from ankr.types import Blockchain, GetInternalTransactionsByParentHashRequest

advancedAPI = AnkrAdvancedAPI("YOUR-TOKEN")

result = advancedAPI.get_internal_transactions_by_parent_hash(
request=GetInternalTransactionsByParentHashRequest(
blockchain=Blockchain.Eth,
parentTransactionHash='0xa50f8744e65cb76f66f9d54499d5401866a75d93db2e784952f55205afc3acc5',
onlyWithValue=True,
)
)
for transaction in result:
print(transaction)
```

### Token API

Expand Down
81 changes: 0 additions & 81 deletions ankr/advanced_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,87 +44,6 @@ def get_token_price_history_raw(

return reply

def get_account_balance_historical(
self,
request: types.GetAccountBalanceHistoricalRequest,
limit: Optional[int] = None,
) -> Iterable[types.Balance]:
for asset in self.provider.call_method_paginated(
rpc="ankr_getAccountBalanceHistorical",
request=request,
reply=types.GetAccountBalanceHistoricalReply,
iterable_name="assets",
iterable_type=types.Balance,
limit=limit,
):
yield asset

def get_account_balance_historical_raw(
self,
request: types.GetAccountBalanceHistoricalRequest,
) -> types.GetAccountBalanceHistoricalReply:
reply = self.provider.call_method(
rpc="ankr_getAccountBalanceHistorical",
request=request,
reply=types.GetAccountBalanceReply,
)

return reply

def get_internal_transactions_by_block_number(
self,
request: types.GetInternalTransactionsByBlockNumberRequest,
limit: Optional[int] = None,
) -> Iterable[types.InternalTransaction]:
for asset in self.provider.call_method_paginated(
rpc="ankr_getInternalTransactionsByBlockNumber",
request=request,
reply=types.GetInternalTransactionsReply,
iterable_name="internalTransactions",
iterable_type=types.InternalTransaction,
limit=limit,
):
yield asset

def get_internal_transactions_by_block_number_raw(
self,
request: types.GetInternalTransactionsByBlockNumberRequest,
) -> types.GetInternalTransactionsReply:
reply = self.provider.call_method(
rpc="ankr_getInternalTransactionsByBlockNumber",
request=request,
reply=types.GetInternalTransactionsReply,
)

return reply

def get_internal_transactions_by_parent_hash(
self,
request: types.GetInternalTransactionsByParentHashRequest,
limit: Optional[int] = None,
) -> Iterable[types.InternalTransaction]:
for asset in self.provider.call_method_paginated(
rpc="ankr_getInternalTransactionsByParentHash",
request=request,
reply=types.GetInternalTransactionsReply,
iterable_name="internalTransactions",
iterable_type=types.InternalTransaction,
limit=limit,
):
yield asset

def get_internal_transactions_by_parent_hash_raw(
self,
request: types.GetInternalTransactionsByBlockNumberRequest,
) -> types.GetInternalTransactionsReply:
reply = self.provider.call_method(
rpc="ankr_getInternalTransactionsByParentHash",
request=request,
reply=types.GetInternalTransactionsReply,
)

return reply


class AnkrQueryAPI(AnkrMultichainAPI):
def get_logs(
Expand Down
Loading