@@ -23,7 +23,7 @@ def __init__(self, address: str, client: Web3):
23
23
self .__abi_module = NFT (client , address )
24
24
25
25
def mint (self , arg : MintArg ) -> NftType :
26
- return self .mint_to (self .get_signer_address (), arg )
26
+ return self .mint_to (self .__get_signer_address (), arg )
27
27
28
28
def mint_to (
29
29
self ,
@@ -44,8 +44,8 @@ def mint_to(
44
44
'properties' : final_properties
45
45
}
46
46
47
- uri = storage .upload (json .dumps (meta ), self .address , self .get_signer_address ())
48
- tx = self .__abi_module .mint_nft .build_transaction (to_address , uri , self .get_transact_opts ())
47
+ uri = storage .upload (json .dumps (meta ), self .address , self .__get_signer_address ())
48
+ tx = self .__abi_module .mint_nft .build_transaction (to_address , uri , self .__get_transact_opts ())
49
49
receipt = self .execute_tx (tx )
50
50
result = self .__abi_module .get_minted_event (tx_hash = receipt .transactionHash .hex ())
51
51
token_id = result [0 ]['args' ]['tokenId' ]
@@ -72,17 +72,17 @@ def __get_metadata_uri(self, nft_id: int):
72
72
return uri
73
73
74
74
def mint_batch (self , args : List [MintArg ]):
75
- return self .mint_batch_to (self .get_signer_address (), args )
75
+ return self .mint_batch_to (self .__get_signer_address (), args )
76
76
77
77
def mint_batch_to (self , to_address : str , args : List [MintArg ]):
78
78
uris = [self .get_storage ().upload (json .dumps ({
79
79
'name' : arg .name ,
80
80
'description' : arg .description ,
81
81
'image' : arg .image_uri ,
82
82
'properties' : arg .properties if arg .properties is not None else {}
83
- }), self .address , self .get_signer_address ()) for arg in args ]
83
+ }), self .address , self .__get_signer_address ()) for arg in args ]
84
84
85
- tx = self .__abi_module .mint_nft_batch .build_transaction (to_address , uris , self .get_transact_opts ())
85
+ tx = self .__abi_module .mint_nft_batch .build_transaction (to_address , uris , self .__get_transact_opts ())
86
86
87
87
receipt = self .execute_tx (tx )
88
88
result = self .__abi_module .get_minted_batch_event (tx_hash = receipt .transactionHash .hex ())
@@ -92,7 +92,7 @@ def mint_batch_to(self, to_address: str, args: List[MintArg]):
92
92
def burn (self , token_id : int ):
93
93
tx = self .__abi_module .burn .build_transaction (
94
94
token_id ,
95
- self .get_transact_opts ()
95
+ self .__get_transact_opts ()
96
96
)
97
97
self .execute_tx (tx )
98
98
@@ -101,7 +101,7 @@ def transfer_from(self, from_address: str, to_address: str, token_id: int):
101
101
from_address ,
102
102
to_address ,
103
103
token_id ,
104
- self .get_transact_opts ()
104
+ self .__get_transact_opts ()
105
105
)
106
106
self .execute_tx (tx )
107
107
@@ -110,15 +110,15 @@ def transfer_from(self, from_address: str, to_address: str, token_id: int):
110
110
"""
111
111
def transfer (self , to_address : str , token_id : int ):
112
112
tx = self .__abi_module .safe_transfer_from1 .build_transaction (
113
- self .get_signer_address (),
113
+ self .__get_signer_address (),
114
114
to_address ,
115
115
token_id ,
116
- self .get_transact_opts ()
116
+ self .__get_transact_opts ()
117
117
)
118
118
self .execute_tx (tx )
119
119
120
120
def set_royalty_bps (self , amount : int ):
121
- tx = self .__abi_module .set_royalty_bps .build_transaction (amount , self .get_transact_opts ())
121
+ tx = self .__abi_module .set_royalty_bps .build_transaction (amount , self .__get_transact_opts ())
122
122
self .execute_tx (tx )
123
123
124
124
def get_all (self ) -> List [NftType ]:
@@ -131,7 +131,7 @@ def get_all(self) -> List[NftType]:
131
131
"""
132
132
def get_owned (self , address : str = "" ) -> List [NftType ]:
133
133
if address == "" :
134
- address = self .get_signer_address ()
134
+ address = self .__get_signer_address ()
135
135
136
136
balance = self .__abi_module .balance_of .call (address )
137
137
owned_tokens = [self .__token_of_owner_by_index (address , i ) for i in range (balance )]
@@ -144,7 +144,7 @@ def __token_of_owner_by_index(self, address: str, token_id: int) -> int:
144
144
Returns balance of the current signers wallet
145
145
"""
146
146
def balance (self ) -> int :
147
- return self .__abi_module .balance_of .call (self .get_signer_address ())
147
+ return self .__abi_module .balance_of .call (self .__get_signer_address ())
148
148
149
149
def balance_of (self , address : str ) -> int :
150
150
return self .__abi_module .balance_of .call (address )
@@ -157,22 +157,22 @@ def is_approved(self, address: str, operator: str) -> bool:
157
157
"""
158
158
def set_approval (self , operator : str , approved : bool = True ):
159
159
self .execute_tx (self .__abi_module .set_approval_for_all .call (
160
- operator , approved , self .get_transact_opts ()
160
+ operator , approved , self .__get_transact_opts ()
161
161
))
162
162
163
163
def grant_role (self , role : Role , address : str ):
164
164
role_hash = role .get_hash ()
165
165
self .execute_tx (self .__abi_module .grant_role .build_transaction (
166
- role_hash , address , self .get_transact_opts ()
166
+ role_hash , address , self .__get_transact_opts ()
167
167
))
168
168
169
169
def revoke_role (self , role , address : str ):
170
170
role_hash = role .get_hash ()
171
171
self .execute_tx (self .__abi_module .revoke_role .build_transaction (
172
- role_hash , address , self .get_transact_opts ()
172
+ role_hash , address , self .__get_transact_opts ()
173
173
))
174
174
175
175
def set_restricted_transfer (self , restricted : bool = True ):
176
176
self .execute_tx (self .__abi_module .set_restricted_transfer .build_transaction (
177
- restricted , self .get_transact_opts ()
177
+ restricted , self .__get_transact_opts ()
178
178
))
0 commit comments