Skip to content

Commit 2c5b23a

Browse files
committed
Remove network type from blockfrost context in all examples
1 parent bbae01d commit 2c5b23a

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

examples/delegator_loyalty_rewards.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
)
4242

4343
# Create a BlockFrost chain context
44-
context = BlockFrostChainContext(BLOCK_FROST_PROJECT_ID, network)
44+
context = BlockFrostChainContext(BLOCK_FROST_PROJECT_ID, base_url=ApiUrls.mainnet.value)
4545

4646
api = BlockFrostApi(BLOCK_FROST_PROJECT_ID, ApiUrls.mainnet.value)
4747

examples/native_token.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
"""
99
import pathlib
1010

11+
from blockfrost import ApiUrls
12+
1113
from pycardano import *
1214

1315
# Copy your BlockFrost project ID below. Go to https://blockfrost.io/ for more information.
@@ -16,8 +18,7 @@
1618

1719
chain_context = BlockFrostChainContext(
1820
project_id=BLOCK_FROST_PROJECT_ID,
19-
network=NETWORK,
20-
base_url="https://cardano-preprod.blockfrost.io/api",
21+
base_url=ApiUrls.preprod.value,
2122
)
2223

2324
"""Preparation"""

examples/plutus/forty_two/forty_two.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import os
99

1010
import cbor2
11+
from blockfrost import ApiUrls
1112
from retry import retry
1213

1314
from pycardano import *
@@ -27,8 +28,7 @@ def get_env_val(key):
2728

2829
chain_context = BlockFrostChainContext(
2930
project_id=get_env_val("BLOCKFROST_ID"),
30-
network=NETWORK,
31-
base_url="https://cardano-preview.blockfrost.io/api",
31+
base_url=ApiUrls.preprod.value,
3232
)
3333

3434

examples/tx_builder.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Build a transaction using transaction builder"""
2+
from blockfrost import ApiUrls
23

34
from pycardano import *
45

@@ -17,8 +18,10 @@
1718
# Derive an address from payment verification key and stake verification key
1819
address = Address(pvk.hash(), svk.hash(), network)
1920

20-
# Create a BlockFrost chain context
21-
context = BlockFrostChainContext("your_blockfrost_project_id", network)
21+
# Create a BlockFrost chain context. In this example, we will use preprod network.
22+
context = BlockFrostChainContext(
23+
"your_blockfrost_project_id", base_url=ApiUrls.preprod.value
24+
)
2225

2326
# Create a transaction builder
2427
builder = TransactionBuilder(context)

0 commit comments

Comments
 (0)