File tree Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 41
41
)
42
42
43
43
# 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 )
45
45
46
46
api = BlockFrostApi (BLOCK_FROST_PROJECT_ID , ApiUrls .mainnet .value )
47
47
Original file line number Diff line number Diff line change 8
8
"""
9
9
import pathlib
10
10
11
+ from blockfrost import ApiUrls
12
+
11
13
from pycardano import *
12
14
13
15
# Copy your BlockFrost project ID below. Go to https://blockfrost.io/ for more information.
16
18
17
19
chain_context = BlockFrostChainContext (
18
20
project_id = BLOCK_FROST_PROJECT_ID ,
19
- network = NETWORK ,
20
- base_url = "https://cardano-preprod.blockfrost.io/api" ,
21
+ base_url = ApiUrls .preprod .value ,
21
22
)
22
23
23
24
"""Preparation"""
Original file line number Diff line number Diff line change 8
8
import os
9
9
10
10
import cbor2
11
+ from blockfrost import ApiUrls
11
12
from retry import retry
12
13
13
14
from pycardano import *
@@ -27,8 +28,7 @@ def get_env_val(key):
27
28
28
29
chain_context = BlockFrostChainContext (
29
30
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 ,
32
32
)
33
33
34
34
Original file line number Diff line number Diff line change 1
1
"""Build a transaction using transaction builder"""
2
+ from blockfrost import ApiUrls
2
3
3
4
from pycardano import *
4
5
17
18
# Derive an address from payment verification key and stake verification key
18
19
address = Address (pvk .hash (), svk .hash (), network )
19
20
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
+ )
22
25
23
26
# Create a transaction builder
24
27
builder = TransactionBuilder (context )
You can’t perform that action at this time.
0 commit comments