2
2
from typing import Dict , List
3
3
from json import dumps
4
4
5
- from web3 import Web3
5
+ from thirdweb_web3 import Web3
6
6
from eth_abi import encode_abi
7
7
8
8
@@ -26,19 +26,19 @@ def __init__(self, address: str, client: Web3):
26
26
self .__abi_module = Pack (client , address )
27
27
28
28
def get (self , pack_id : int ) -> PackMetadata :
29
- uri = self ._BaseModule__get_token_uri (pack_id )
29
+ uri = self .__abi_module . uri . call (pack_id )
30
30
if uri == "" :
31
31
raise AssetNotFoundException (pack_id )
32
32
metadata = self .get_storage ().get (uri )
33
33
state = self .__abi_module .get_pack .call (pack_id )
34
34
total_supply = self .__abi_module .total_supply .call (pack_id )
35
35
return PackMetadata (
36
36
id = pack_id ,
37
- creator_address = state . creator ,
37
+ creator_address = state [ ' creator' ] ,
38
38
current_supply = total_supply ,
39
39
metadata = metadata ,
40
- open_start = None if state . openStart <= 0 else datetime .fromtimestamp (
41
- state . openStart ),
40
+ open_start = None if state [ ' openStart' ] <= 0 else datetime .fromtimestamp (
41
+ state [ ' openStart' ] ),
42
42
)
43
43
44
44
def open (self , pack_id : int ) -> List [NftMetadata ]:
@@ -98,6 +98,8 @@ def create(self, arg: CreatePackArg) -> PackMetadata:
98
98
))
99
99
result = self .__abi_module .get_pack_created_event (
100
100
receipt .transactionHash )
101
+ new_pack_id = result [0 ]['args' ]['packId' ]
102
+ return self .get (new_pack_id )
101
103
102
104
def transfer_from (self , from_address : str , to_address : str , args : AssetAmountPair ):
103
105
return self .execute_tx (self .__abi_module .safe_transfer_from .build_transaction (
0 commit comments