web3-wizzard-lib 1.11.12__py3-none-any.whl → 1.12.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,155 @@
1
+ import requests
2
+ from eth_account.messages import encode_defunct
3
+
4
+ from sybil_engine.contract.send import Send
5
+ from sybil_engine.domain.balance.balance import NativeBalance
6
+ from sybil_engine.utils.web3_utils import init_web3
7
+
8
+ from web3_wizzard_lib.core.modules.nft.nft_submodule import NftSubmodule
9
+
10
+
11
+ class LineaWheel(NftSubmodule):
12
+ module_name = 'LINEA_WHEEL'
13
+ nft_address = '0xDb3a3929269281F157A58D91289185F21E30A1e0'
14
+
15
+ def execute(self, account, chain='LINEA'):
16
+ web3 = init_web3(
17
+ {
18
+ "rpc": "https://rpc.linea.build",
19
+ "poa": "true",
20
+ "chain_id": 59144
21
+ },
22
+ account.proxy
23
+ )
24
+ jwt_token = get_jwt_token(account, web3)
25
+ data = create_data(jwt_token, web3)
26
+
27
+ print(f"DATA {data}")
28
+
29
+ Send(
30
+ None,
31
+ web3
32
+ ).send_to_wallet(
33
+ account,
34
+ self.nft_address,
35
+ NativeBalance(0, chain, "ETH"),
36
+ data
37
+ )
38
+
39
+ def log(self):
40
+ return "LINEA WHEEL"
41
+
42
+
43
+ def get_jwt_token(account, web3):
44
+ from datetime import datetime, timezone
45
+
46
+ nonce = requests.get("https://app.dynamicauth.com/api/v0/sdk/ae98b9b4-daaf-4bb3-b5e0-3f07175906ed/nonce")
47
+ print(f"NONCE {nonce.text}")
48
+ nonce_text = nonce.json()['nonce']
49
+
50
+ # Use current timestamp instead of hardcoded one
51
+ current_time = datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3] + 'Z'
52
+ message_to_sign = f"""linea.build wants you to sign in with your Ethereum account:
53
+ {account.address}
54
+
55
+ Welcome to Linea Hub. Signing is the only way we can truly know that you are the owner of the wallet you are connecting. Signing is a safe, gas-less transaction that does not in any way give Linea Hub permission to perform any transactions with your wallet.
56
+
57
+ URI: https://linea.build/hub/rewards
58
+ Version: 1
59
+ Chain ID: 59144
60
+ Nonce: {nonce_text}
61
+ Issued At: {current_time}
62
+ Request ID: ae98b9b4-daaf-4bb3-b5e0-3f07175906ed"""
63
+ print(f"message to sign: {message_to_sign}")
64
+ encoded_message_to_sign = encode_defunct(text=message_to_sign)
65
+ signed_message = web3.eth.account.sign_message(encoded_message_to_sign, private_key=account.key)
66
+
67
+ print(f"HASH {signed_message.signature.hex()}")
68
+
69
+ # Try without the 0x prefix for the signature
70
+ signature_hex = signed_message.signature.hex()
71
+ if signature_hex.startswith('0x'):
72
+ signature_hex = signature_hex[2:]
73
+ params = {
74
+ "signedMessage": f"0x{signature_hex}",
75
+ "messageToSign": message_to_sign,
76
+ "publicWalletAddress": account.address,
77
+ "chain": "EVM",
78
+ "walletName": "metamask",
79
+ "walletProvider": "browserExtension",
80
+ "network": "59144",
81
+ "additionalWalletAddresses": []
82
+ # Removed sessionPublicKey - it's likely causing the verification failure
83
+ }
84
+
85
+ result = requests.post("https://app.dynamicauth.com/api/v0/sdk/ae98b9b4-daaf-4bb3-b5e0-3f07175906ed/verify",
86
+ json=params)
87
+
88
+ print(result)
89
+ print(result.text)
90
+
91
+ return result.json()["jwt"]
92
+
93
+
94
+ def create_data(jwt_token, web3):
95
+ import requests
96
+ from sybil_engine.utils.file_loader import load_abi
97
+
98
+ url = "https://hub-api.linea.build/spins"
99
+
100
+ headers = {
101
+ "Accept": "*/*",
102
+ "Accept-Language": "en-US,en;q=0.5",
103
+ "Accept-Encoding": "gzip, deflate, br, zstd",
104
+ "Referer": "https://linea.build/",
105
+ "Content-Type": "application/json",
106
+ "Authorization": f"Bearer {jwt_token}",
107
+ "Origin": "https://linea.build",
108
+ "Connection": "keep-alive",
109
+ "Sec-Fetch-Dest": "empty",
110
+ "Sec-Fetch-Mode": "cors",
111
+ "Sec-Fetch-Site": "same-site",
112
+ "Priority": "u=0",
113
+ "Content-Length": "0",
114
+ "TE": "trailers"
115
+ }
116
+
117
+ response = requests.post(url, headers=headers)
118
+
119
+ print("Status code:", response.status_code)
120
+ print("Response body:", response.content)
121
+
122
+ if response.status_code != 200:
123
+ raise Exception(response.json()['message'])
124
+
125
+ # Get the JSON response data
126
+ response_data = response.json()
127
+ print(f"Response JSON: {response_data}")
128
+
129
+ # Load LineaWheel contract ABI and create contract instance
130
+ abi = load_abi("resources/abi/linea_wheel/abi.json")
131
+ contract_address = '0xDb3a3929269281F157A58D91289185F21E30A1e0' # LineaWheel contract address
132
+ contract = web3.eth.contract(address=contract_address, abi=abi)
133
+
134
+ # Convert response data to contract function parameters
135
+ nonce = int(response_data['nonce'])
136
+ expiration_timestamp = int(response_data['expirationTimestamp'])
137
+ boost = int(response_data['boost'])
138
+
139
+ # Convert signature array to struct format
140
+ signature_array = response_data['signature']
141
+ signature_struct = {
142
+ 'r': signature_array[0], # bytes32
143
+ 's': signature_array[1], # bytes32
144
+ 'v': int(signature_array[2]) # uint8
145
+ }
146
+
147
+ # Encode the participate function call
148
+ encoded_data = contract.encode_abi("participate", args=(
149
+ nonce,
150
+ expiration_timestamp,
151
+ boost,
152
+ signature_struct
153
+ ))
154
+
155
+ return encoded_data
@@ -63,7 +63,7 @@ class NFTMinter(RepeatableModule):
63
63
  self.storage.put("minted_nfts", minted_nfts)
64
64
 
65
65
  def get_nfts(self):
66
- import_all_modules_in_directory("utils.modules.nft")
66
+ import_all_modules_in_directory("web3_wizzard_lib.core.modules.nft")
67
67
  return get_all_subclasses(SubModule) + get_all_subclasses(NftSubmodule)
68
68
 
69
69
  def get_nft_address(self, chain, inited_module):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: web3-wizzard-lib
3
- Version: 1.11.12
3
+ Version: 1.12.0
4
4
  Summary: Engine for web3 smart contracts automatization.
5
5
  Author-email: Indeoo <indeooars@gmail.com>
6
6
  License: MIT
@@ -114,7 +114,7 @@ web3_wizzard_lib/core/modules/linea_poh_lxp.py,sha256=kVVtd5gkcEdyYc3YSRlECgPmDs
114
114
  web3_wizzard_lib/core/modules/liquidity_pool.py,sha256=vu0vBoXomvAJFa10n9woo66v62hQbEO726M4lkiLWNE,2181
115
115
  web3_wizzard_lib/core/modules/merkly_refuel.py,sha256=whQD6CplGt-hQxFN7lg40F6SmFU5niOO529lKMj0dyA,3488
116
116
  web3_wizzard_lib/core/modules/new_rage_withdraw.py,sha256=e4VSaQYgBBi6WZbU6HJr_q4LTzyBURMnXANVJqRagdY,1450
117
- web3_wizzard_lib/core/modules/nft_minter.py,sha256=DhTH05ORBy3hypglf7HRN8yN3_Ojkts72M1oOK3sYR4,4151
117
+ web3_wizzard_lib/core/modules/nft_minter.py,sha256=FrUidXlnQZBO6MeITJaT4ln2uFhnvf3gHwMgkWIAmUY,4167
118
118
  web3_wizzard_lib/core/modules/orbiter.py,sha256=Y_1xX7QkRdju9wXo-RKgeIoNwPJYIqrhxPK6uC5TaHU,1400
119
119
  web3_wizzard_lib/core/modules/orbiter_checker.py,sha256=Zo3r2S986sz5srcKTz2g6vpwv9i3YVOJSGkQEvE7ul8,666
120
120
  web3_wizzard_lib/core/modules/rage.py,sha256=uIJiUGbXxGkKuusaLH3ndsYIzm3ze3KcLw7nZsMkBoU,1979
@@ -196,6 +196,7 @@ web3_wizzard_lib/core/modules/nft/linea_culture_4_6_laurent.py,sha256=aYSmG39cwh
196
196
  web3_wizzard_lib/core/modules/nft/linea_culture_day2.py,sha256=Vb3l7kLWfHA5iqojeoGBbdfw8VnfN8NvkICkYqdQ4rU,709
197
197
  web3_wizzard_lib/core/modules/nft/linea_culture_day3.py,sha256=Nlqey71z2XZoKWJfpX5lf2aIzvhq5Oa-MqzuzT0dvm0,707
198
198
  web3_wizzard_lib/core/modules/nft/linea_ens_names.py,sha256=-p4uMAd2ZChqQGDWV6HwdA-wSEOoPkAyuFoVgHmipTE,3978
199
+ web3_wizzard_lib/core/modules/nft/linea_wheel.py,sha256=TYN4RhcvTwiK9oUoBYwiMXYF8aU8cF8TOohdpkA4e7Q,5149
199
200
  web3_wizzard_lib/core/modules/nft/lucky_cat.py,sha256=E2NDk0ptNRUeue1ZTdlHKTEcm9BSCQ_3mfamRmrJvW4,828
200
201
  web3_wizzard_lib/core/modules/nft/merkly_minter_module.py,sha256=g41FIisQX6UJ94Egb95jGA5Mil2lA7sAm4fGgiSOQ-I,753
201
202
  web3_wizzard_lib/core/modules/nft/micro3.py,sha256=m6yqqIDz6wGe8W9_I7HOcfsgPVBrkQXsZ83B__8aWw8,748
@@ -371,7 +372,7 @@ web3_wizzard_lib/resources/main/pairs.json,sha256=uvIFvY46Ctiw8hjGd9e-1WE0qLf_du
371
372
  web3_wizzard_lib/resources/main/tokens.json,sha256=AoZz_I6AVoZuecNdyX5L-SnGm6TREuPrsYd2i9PJr7U,5707
372
373
  web3_wizzard_lib/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
373
374
  web3_wizzard_lib/utils/debank_utils.py,sha256=CE2SUN9RpFK_j9KjJgxf7a__VRJ75tLIw9tLrVNrn3c,484
374
- web3_wizzard_lib-1.11.12.dist-info/METADATA,sha256=c36_SAd5JV8RguFcpWRQ2K47NnRQ7PFnaRH94xVgru4,342
375
- web3_wizzard_lib-1.11.12.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
376
- web3_wizzard_lib-1.11.12.dist-info/top_level.txt,sha256=31sEPHxuJ1p5fpc75vHQJ8eJdSs80aCZeeT3L8YAHNg,17
377
- web3_wizzard_lib-1.11.12.dist-info/RECORD,,
375
+ web3_wizzard_lib-1.12.0.dist-info/METADATA,sha256=sFbUYCu1gPDNwNmRoWzH9Fao32zyQs-XZdv9cN11Dzs,341
376
+ web3_wizzard_lib-1.12.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
377
+ web3_wizzard_lib-1.12.0.dist-info/top_level.txt,sha256=31sEPHxuJ1p5fpc75vHQJ8eJdSs80aCZeeT3L8YAHNg,17
378
+ web3_wizzard_lib-1.12.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.3.1)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5