Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 3, 2024. It is now read-only.

Commit de36361

Browse files
committed
Signature based minting works :D switch dependency eth-account to forked version
1 parent 1818a81 commit de36361

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

requirements.txt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ dataclasses-json==0.5.6
2121
Deprecated==1.2.13
2222
deprecation==2.1.0
2323
docutils==0.17.1
24-
eth-abi==2.1.1
24+
eth-abi==3.0.0
2525
eth-account==0.5.7
2626
eth-hash==0.3.2
27-
eth-keyfile==0.5.1
28-
eth-keys==0.3.4
29-
eth-rlp==0.2.1
30-
eth-typing==2.2.2
31-
eth-utils==1.10.0
27+
eth-keyfile==0.6.0
28+
eth-keys==0.4.0
29+
eth-rlp==0.3.0
30+
eth-typing==3.0.0
31+
eth-utils==2.0.0
3232
ghp-import==2.0.2
3333
hexbytes==0.2.2
3434
idna==3.2
@@ -70,11 +70,12 @@ pytz==2021.3
7070
PyYAML==6.0
7171
pyyaml_env_tag==0.1
7272
requests==2.26.0
73-
rlp==2.0.1
73+
rlp==3.0.0
7474
six==1.16.0
7575
snowballstemmer==2.2.0
7676
stringcase==1.2.0
7777
thirdweb-contract-wrappers==2.0.3
78+
thirdweb-eth-account==0.6.4
7879
thirdweb-web3==5.24.8
7980
toml==0.10.2
8081
tomli==1.2.3
@@ -86,7 +87,7 @@ urllib3==1.26.7
8687
uuid==1.30
8788
varint==1.0.2
8889
watchdog==2.1.6
89-
web3==5.24.0
90+
web3==5.27.0
9091
websockets==9.1
9192
wrapt==1.13.1
9293
yarl==1.7.0

thirdweb/modules/nft.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from typing import Dict, List, Union
44
import json
55
from uuid import uuid4
6-
from eth_account.messages import encode_structured_data
6+
7+
from thirdweb_eth_account.messages import encode_structured_data
78

89
import web3
910
from thirdweb.abi.erc20 import ERC20
@@ -364,9 +365,9 @@ def resolve_id(mint_request: NewSignaturePayload):
364365
if mint_request.id is None:
365366
print("mint_request.id is empty, generating uuid-v4")
366367
generated_id = uuid4().hex
367-
return "0x" + binascii.hexlify(str.encode(generated_id)).decode()
368+
return str.encode(generated_id)
368369
else:
369-
return "0x" + binascii.hexlify(str.encode(mint_request.id)).decode()
370+
return str.encode(mint_request.id)
370371

371372
if not self.get_signer_address() in self.get_role_members(Role.minter):
372373
raise Exception("You are not a minter")
@@ -383,11 +384,7 @@ def generate_signature(payload: NewSignaturePayload) -> BatchGeneratedSignature:
383384
message["uid"] = resolved_id
384385

385386
print("message", message)
386-
encode_message = {
387-
**message,
388-
"uid": str(message['uid'].encode('utf-8'))
389-
}
390-
encoded_message = encode_structured_data(text=json.dumps({
387+
encoded_message = encode_structured_data({
391388
"types": {
392389
"MintRequest": [
393390
{"name": "to", "type": "address"},
@@ -413,7 +410,7 @@ def generate_signature(payload: NewSignaturePayload) -> BatchGeneratedSignature:
413410
"verifyingContract": self.address
414411
},
415412
"message": message
416-
}))
413+
})
417414
print("encoded_message =", encoded_message)
418415
return BatchGeneratedSignature(
419416
payload=payload,

0 commit comments

Comments
 (0)