oli-python 1.0.0__tar.gz → 1.0.2__tar.gz
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.
- {oli_python-1.0.0 → oli_python-1.0.2}/PKG-INFO +9 -9
- {oli_python-1.0.0 → oli_python-1.0.2}/README.md +8 -8
- {oli_python-1.0.0 → oli_python-1.0.2}/oli/attestation/offchain.py +1 -1
- {oli_python-1.0.0 → oli_python-1.0.2}/oli/attestation/onchain.py +3 -3
- {oli_python-1.0.0 → oli_python-1.0.2}/oli/attestation/utils_validator.py +1 -1
- {oli_python-1.0.0 → oli_python-1.0.2}/oli/core.py +13 -12
- {oli_python-1.0.0 → oli_python-1.0.2}/oli_python.egg-info/PKG-INFO +9 -9
- {oli_python-1.0.0 → oli_python-1.0.2}/setup.py +1 -1
- {oli_python-1.0.0 → oli_python-1.0.2}/oli/__init__.py +0 -0
- {oli_python-1.0.0 → oli_python-1.0.2}/oli/attestation/__init__.py +0 -0
- {oli_python-1.0.0 → oli_python-1.0.2}/oli/attestation/utils_other.py +0 -0
- {oli_python-1.0.0 → oli_python-1.0.2}/oli/data/__init__.py +0 -0
- {oli_python-1.0.0 → oli_python-1.0.2}/oli/data/fetcher.py +0 -0
- {oli_python-1.0.0 → oli_python-1.0.2}/oli/data/graphql.py +0 -0
- {oli_python-1.0.0 → oli_python-1.0.2}/oli_python.egg-info/SOURCES.txt +0 -0
- {oli_python-1.0.0 → oli_python-1.0.2}/oli_python.egg-info/dependency_links.txt +0 -0
- {oli_python-1.0.0 → oli_python-1.0.2}/oli_python.egg-info/requires.txt +0 -0
- {oli_python-1.0.0 → oli_python-1.0.2}/oli_python.egg-info/top_level.txt +0 -0
- {oli_python-1.0.0 → oli_python-1.0.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: oli-python
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: Python SDK for interacting with the Open Labels Initiative; A framework for address labels in the blockchain space. Read & write labels into the OLI Label Pool, check your labels for OLI compliance.
|
|
5
5
|
Home-page: https://github.com/openlabelsinitiative/oli-python
|
|
6
6
|
Author: Lorenz Lehmann
|
|
@@ -45,7 +45,7 @@ import os
|
|
|
45
45
|
# Make sure to pull in your private key from an .env file
|
|
46
46
|
oli = OLI(private_key=os.environ['OLI_PRIVATE_KEY'], is_production=True)
|
|
47
47
|
|
|
48
|
-
# Create
|
|
48
|
+
# Create a label
|
|
49
49
|
address = "0x9438b8B447179740cD97869997a2FCc9b4AA63a2"
|
|
50
50
|
chain_id = "eip155:1" # Ethereum Mainnet
|
|
51
51
|
tags = {
|
|
@@ -60,12 +60,11 @@ print(f"You can attest your label: {possible_to_attest}")
|
|
|
60
60
|
|
|
61
61
|
# Submit a label as an offchain attestation
|
|
62
62
|
response = oli.submit_offchain_label(address, chain_id, tags)
|
|
63
|
-
print(f"
|
|
63
|
+
print(f"Label submitted offchain with response: {response.text}")
|
|
64
64
|
|
|
65
65
|
# Submit a label as an onchain attestation
|
|
66
66
|
tx_hash, uid = oli.submit_onchain_label(address, chain_id, tags)
|
|
67
|
-
print(f"
|
|
68
|
-
print(f"Attestation UID: {uid}")
|
|
67
|
+
print(f"Label submitted onchain with hash: {tx_hash} and uid: {uid}")
|
|
69
68
|
|
|
70
69
|
# Batch submit multiple labels as one onchain attestation
|
|
71
70
|
labels = [
|
|
@@ -73,14 +72,15 @@ labels = [
|
|
|
73
72
|
{'address': address, 'chain_id': chain_id, 'tags': tags}
|
|
74
73
|
]
|
|
75
74
|
tx_hash, uids = oli.submit_multi_onchain_labels(labels)
|
|
76
|
-
print(f"
|
|
77
|
-
print(f"Attestation UIDs: {uids}")
|
|
75
|
+
print(f"Labels batch submitted onchain with transaction hash: {tx_hash} and uids: {uids}")
|
|
78
76
|
|
|
79
77
|
# Revoke an attestation (revoking onchain attestations here)
|
|
80
78
|
trx_hash = oli.revoke_attestation(uid, onchain=True)
|
|
79
|
+
print(f"Label {uid} revoked with hash: {trx_hash}")
|
|
81
80
|
|
|
82
81
|
# Revoke multiple attestations (revoking onchain attestations here)
|
|
83
82
|
trx_hash, count = oli.multi_revoke_attestations(uids, onchain=True)
|
|
83
|
+
print(f"Labels batch revoked with hash: {trx_hash}")
|
|
84
84
|
|
|
85
85
|
```
|
|
86
86
|
|
|
@@ -90,8 +90,8 @@ trx_hash, count = oli.multi_revoke_attestations(uids, onchain=True)
|
|
|
90
90
|
from oli import OLI
|
|
91
91
|
import os
|
|
92
92
|
|
|
93
|
-
# Initialize the client (read only
|
|
94
|
-
oli = OLI(
|
|
93
|
+
# Initialize the client (read mode only doesn't require a private key)
|
|
94
|
+
oli = OLI()
|
|
95
95
|
|
|
96
96
|
# Query attestations for a specific address
|
|
97
97
|
result = oli.graphql_query_attestations(address=address)
|
|
@@ -18,7 +18,7 @@ import os
|
|
|
18
18
|
# Make sure to pull in your private key from an .env file
|
|
19
19
|
oli = OLI(private_key=os.environ['OLI_PRIVATE_KEY'], is_production=True)
|
|
20
20
|
|
|
21
|
-
# Create
|
|
21
|
+
# Create a label
|
|
22
22
|
address = "0x9438b8B447179740cD97869997a2FCc9b4AA63a2"
|
|
23
23
|
chain_id = "eip155:1" # Ethereum Mainnet
|
|
24
24
|
tags = {
|
|
@@ -33,12 +33,11 @@ print(f"You can attest your label: {possible_to_attest}")
|
|
|
33
33
|
|
|
34
34
|
# Submit a label as an offchain attestation
|
|
35
35
|
response = oli.submit_offchain_label(address, chain_id, tags)
|
|
36
|
-
print(f"
|
|
36
|
+
print(f"Label submitted offchain with response: {response.text}")
|
|
37
37
|
|
|
38
38
|
# Submit a label as an onchain attestation
|
|
39
39
|
tx_hash, uid = oli.submit_onchain_label(address, chain_id, tags)
|
|
40
|
-
print(f"
|
|
41
|
-
print(f"Attestation UID: {uid}")
|
|
40
|
+
print(f"Label submitted onchain with hash: {tx_hash} and uid: {uid}")
|
|
42
41
|
|
|
43
42
|
# Batch submit multiple labels as one onchain attestation
|
|
44
43
|
labels = [
|
|
@@ -46,14 +45,15 @@ labels = [
|
|
|
46
45
|
{'address': address, 'chain_id': chain_id, 'tags': tags}
|
|
47
46
|
]
|
|
48
47
|
tx_hash, uids = oli.submit_multi_onchain_labels(labels)
|
|
49
|
-
print(f"
|
|
50
|
-
print(f"Attestation UIDs: {uids}")
|
|
48
|
+
print(f"Labels batch submitted onchain with transaction hash: {tx_hash} and uids: {uids}")
|
|
51
49
|
|
|
52
50
|
# Revoke an attestation (revoking onchain attestations here)
|
|
53
51
|
trx_hash = oli.revoke_attestation(uid, onchain=True)
|
|
52
|
+
print(f"Label {uid} revoked with hash: {trx_hash}")
|
|
54
53
|
|
|
55
54
|
# Revoke multiple attestations (revoking onchain attestations here)
|
|
56
55
|
trx_hash, count = oli.multi_revoke_attestations(uids, onchain=True)
|
|
56
|
+
print(f"Labels batch revoked with hash: {trx_hash}")
|
|
57
57
|
|
|
58
58
|
```
|
|
59
59
|
|
|
@@ -63,8 +63,8 @@ trx_hash, count = oli.multi_revoke_attestations(uids, onchain=True)
|
|
|
63
63
|
from oli import OLI
|
|
64
64
|
import os
|
|
65
65
|
|
|
66
|
-
# Initialize the client (read only
|
|
67
|
-
oli = OLI(
|
|
66
|
+
# Initialize the client (read mode only doesn't require a private key)
|
|
67
|
+
oli = OLI()
|
|
68
68
|
|
|
69
69
|
# Query attestations for a specific address
|
|
70
70
|
result = oli.graphql_query_attestations(address=address)
|
|
@@ -32,7 +32,7 @@ class OffchainAttestations:
|
|
|
32
32
|
tags = self.oli.validator.fix_simple_tags_formatting(tags)
|
|
33
33
|
|
|
34
34
|
# Check all necessary input parameters
|
|
35
|
-
self.oli.validator.
|
|
35
|
+
self.oli.validator.validate_label_correctness(address, chain_id, tags, ref_uid, auto_fix=False)
|
|
36
36
|
|
|
37
37
|
# Encode the label data
|
|
38
38
|
data = self.oli.utils_other.encode_label_data(chain_id, tags)
|
|
@@ -27,7 +27,7 @@ class OnchainAttestations:
|
|
|
27
27
|
tags = self.oli.validator.fix_simple_tags_formatting(tags)
|
|
28
28
|
|
|
29
29
|
# Check all necessary input parameters
|
|
30
|
-
self.oli.validator.
|
|
30
|
+
self.oli.validator.validate_label_correctness(address, chain_id, tags, ref_uid, auto_fix=False)
|
|
31
31
|
|
|
32
32
|
# Encode the label data
|
|
33
33
|
data = self.oli.utils_other.encode_label_data(chain_id, tags)
|
|
@@ -107,13 +107,13 @@ class OnchainAttestations:
|
|
|
107
107
|
label['tags'] = self.oli.validator.fix_simple_tags_formatting(label['tags'])
|
|
108
108
|
|
|
109
109
|
# run checks on each label
|
|
110
|
-
self.oli.validator.
|
|
110
|
+
self.oli.validator.validate_label_correctness(label['address'], label['chain_id'], label['tags'], auto_fix=False)
|
|
111
111
|
|
|
112
112
|
# check if ref_uid is provided
|
|
113
113
|
if 'ref_uid' not in label:
|
|
114
114
|
label['ref_uid'] = "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
115
115
|
else:
|
|
116
|
-
self.oli.validator.
|
|
116
|
+
self.oli.validator.validate_ref_uid(label['ref_uid'])
|
|
117
117
|
|
|
118
118
|
# ABI encode data for each attestation
|
|
119
119
|
data = self.oli.utils_other.encode_label_data(label['chain_id'], label['tags'])
|
|
@@ -69,7 +69,7 @@ class UtilsValidator:
|
|
|
69
69
|
self.validate_address(address)
|
|
70
70
|
self.validate_chain_id(chain_id)
|
|
71
71
|
self.validate_tags(tags, auto_fix=auto_fix)
|
|
72
|
-
self.
|
|
72
|
+
self.validate_ref_uid(ref_uid)
|
|
73
73
|
return True
|
|
74
74
|
|
|
75
75
|
def validate_chain_id(self, chain_id: str) -> bool:
|
|
@@ -12,7 +12,7 @@ from oli.data.fetcher import DataFetcher
|
|
|
12
12
|
from oli.data.graphql import GraphQLClient
|
|
13
13
|
|
|
14
14
|
class OLI:
|
|
15
|
-
def __init__(self, private_key: str, is_production: bool=True, custom_rpc_url: str=None) -> None:
|
|
15
|
+
def __init__(self, private_key: str=None, is_production: bool=True, custom_rpc_url: str=None) -> None:
|
|
16
16
|
"""
|
|
17
17
|
Initialize the OLI API client.
|
|
18
18
|
|
|
@@ -51,18 +51,19 @@ class OLI:
|
|
|
51
51
|
private_key = os.environ.get('OLI_PRIVATE_KEY')
|
|
52
52
|
if not private_key:
|
|
53
53
|
print("WARNING: Private key not provided. Please set the OLI_PRIVATE_KEY environment variable in case you plan to submit labels.")
|
|
54
|
-
|
|
55
|
-
# Convert the hex private key to the proper key object
|
|
56
|
-
self.private_key = private_key
|
|
57
|
-
if private_key.startswith('0x'):
|
|
58
|
-
private_key_bytes = private_key[2:]
|
|
59
|
-
else:
|
|
60
|
-
private_key_bytes = private_key
|
|
61
|
-
private_key_obj = keys.PrivateKey(bytes.fromhex(private_key_bytes))
|
|
54
|
+
print("WARNING: OLI client in read mode only.")
|
|
62
55
|
|
|
63
|
-
|
|
64
|
-
self.
|
|
65
|
-
|
|
56
|
+
self.private_key = private_key
|
|
57
|
+
if self.private_key:
|
|
58
|
+
# Convert the hex private key to the proper key object
|
|
59
|
+
if private_key.startswith('0x'):
|
|
60
|
+
private_key_bytes = private_key[2:]
|
|
61
|
+
else:
|
|
62
|
+
private_key_bytes = private_key
|
|
63
|
+
# Create account from private key
|
|
64
|
+
private_key_obj = keys.PrivateKey(bytes.fromhex(private_key_bytes))
|
|
65
|
+
self.account = eth_account.Account.from_key(private_key_obj)
|
|
66
|
+
self.address = self.account.address
|
|
66
67
|
|
|
67
68
|
# Label Pool Schema for OLI
|
|
68
69
|
self.oli_label_pool_schema = '0xb763e62d940bed6f527dd82418e146a904e62a297b8fa765c9b3e1f0bc6fdd68'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: oli-python
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: Python SDK for interacting with the Open Labels Initiative; A framework for address labels in the blockchain space. Read & write labels into the OLI Label Pool, check your labels for OLI compliance.
|
|
5
5
|
Home-page: https://github.com/openlabelsinitiative/oli-python
|
|
6
6
|
Author: Lorenz Lehmann
|
|
@@ -45,7 +45,7 @@ import os
|
|
|
45
45
|
# Make sure to pull in your private key from an .env file
|
|
46
46
|
oli = OLI(private_key=os.environ['OLI_PRIVATE_KEY'], is_production=True)
|
|
47
47
|
|
|
48
|
-
# Create
|
|
48
|
+
# Create a label
|
|
49
49
|
address = "0x9438b8B447179740cD97869997a2FCc9b4AA63a2"
|
|
50
50
|
chain_id = "eip155:1" # Ethereum Mainnet
|
|
51
51
|
tags = {
|
|
@@ -60,12 +60,11 @@ print(f"You can attest your label: {possible_to_attest}")
|
|
|
60
60
|
|
|
61
61
|
# Submit a label as an offchain attestation
|
|
62
62
|
response = oli.submit_offchain_label(address, chain_id, tags)
|
|
63
|
-
print(f"
|
|
63
|
+
print(f"Label submitted offchain with response: {response.text}")
|
|
64
64
|
|
|
65
65
|
# Submit a label as an onchain attestation
|
|
66
66
|
tx_hash, uid = oli.submit_onchain_label(address, chain_id, tags)
|
|
67
|
-
print(f"
|
|
68
|
-
print(f"Attestation UID: {uid}")
|
|
67
|
+
print(f"Label submitted onchain with hash: {tx_hash} and uid: {uid}")
|
|
69
68
|
|
|
70
69
|
# Batch submit multiple labels as one onchain attestation
|
|
71
70
|
labels = [
|
|
@@ -73,14 +72,15 @@ labels = [
|
|
|
73
72
|
{'address': address, 'chain_id': chain_id, 'tags': tags}
|
|
74
73
|
]
|
|
75
74
|
tx_hash, uids = oli.submit_multi_onchain_labels(labels)
|
|
76
|
-
print(f"
|
|
77
|
-
print(f"Attestation UIDs: {uids}")
|
|
75
|
+
print(f"Labels batch submitted onchain with transaction hash: {tx_hash} and uids: {uids}")
|
|
78
76
|
|
|
79
77
|
# Revoke an attestation (revoking onchain attestations here)
|
|
80
78
|
trx_hash = oli.revoke_attestation(uid, onchain=True)
|
|
79
|
+
print(f"Label {uid} revoked with hash: {trx_hash}")
|
|
81
80
|
|
|
82
81
|
# Revoke multiple attestations (revoking onchain attestations here)
|
|
83
82
|
trx_hash, count = oli.multi_revoke_attestations(uids, onchain=True)
|
|
83
|
+
print(f"Labels batch revoked with hash: {trx_hash}")
|
|
84
84
|
|
|
85
85
|
```
|
|
86
86
|
|
|
@@ -90,8 +90,8 @@ trx_hash, count = oli.multi_revoke_attestations(uids, onchain=True)
|
|
|
90
90
|
from oli import OLI
|
|
91
91
|
import os
|
|
92
92
|
|
|
93
|
-
# Initialize the client (read only
|
|
94
|
-
oli = OLI(
|
|
93
|
+
# Initialize the client (read mode only doesn't require a private key)
|
|
94
|
+
oli = OLI()
|
|
95
95
|
|
|
96
96
|
# Query attestations for a specific address
|
|
97
97
|
result = oli.graphql_query_attestations(address=address)
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="oli-python",
|
|
8
|
-
version="1.0.
|
|
8
|
+
version="1.0.2",
|
|
9
9
|
author="Lorenz Lehmann",
|
|
10
10
|
author_email="lorenz@growthepie.xyz",
|
|
11
11
|
description="Python SDK for interacting with the Open Labels Initiative; A framework for address labels in the blockchain space. Read & write labels into the OLI Label Pool, check your labels for OLI compliance.",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|