mech-client 0.8.0__py3-none-any.whl → 0.8.2__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.
- mech_client/__init__.py +1 -1
- {mech_client-0.8.0.dist-info → mech_client-0.8.2.dist-info}/METADATA +1 -1
- {mech_client-0.8.0.dist-info → mech_client-0.8.2.dist-info}/RECORD +28 -6
- scripts/__init__.py +1 -0
- scripts/benchmark.sh +32 -0
- scripts/bump.py +316 -0
- scripts/deposit_native.py +118 -0
- scripts/deposit_token.py +187 -0
- scripts/nvm_subscribe.py +51 -0
- scripts/nvm_subscription/contracts/agreement_manager.py +44 -0
- scripts/nvm_subscription/contracts/base_contract.py +75 -0
- scripts/nvm_subscription/contracts/did_registry.py +91 -0
- scripts/nvm_subscription/contracts/escrow_payment.py +85 -0
- scripts/nvm_subscription/contracts/lock_payment.py +76 -0
- scripts/nvm_subscription/contracts/nft.py +47 -0
- scripts/nvm_subscription/contracts/nft_sales.py +119 -0
- scripts/nvm_subscription/contracts/subscription_provider.py +107 -0
- scripts/nvm_subscription/contracts/token.py +87 -0
- scripts/nvm_subscription/contracts/transfer_nft.py +81 -0
- scripts/nvm_subscription/envs/base.env +10 -0
- scripts/nvm_subscription/envs/gnosis.env +10 -0
- scripts/nvm_subscription/manager.py +265 -0
- scripts/nvm_subscription/resources/networks.json +56 -0
- scripts/utils.py +127 -0
- scripts/whitelist.py +5 -0
- {mech_client-0.8.0.dist-info → mech_client-0.8.2.dist-info}/LICENSE +0 -0
- {mech_client-0.8.0.dist-info → mech_client-0.8.2.dist-info}/WHEEL +0 -0
- {mech_client-0.8.0.dist-info → mech_client-0.8.2.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"BASE": {
|
|
3
|
+
"envDescription": "The Base production environment where users can interact with Nevermined protocol.",
|
|
4
|
+
"envUrl": "https://base.nevermined.app/",
|
|
5
|
+
"envName": "Base",
|
|
6
|
+
"isProduction": true,
|
|
7
|
+
"nvm": {
|
|
8
|
+
"chainId": 8453,
|
|
9
|
+
"appUrl": "https://base.nevermined.app",
|
|
10
|
+
"web3ProviderUri": "https://1rpc.io/base",
|
|
11
|
+
"marketplaceUri": "https://marketplace-api.base.nevermined.app",
|
|
12
|
+
"graphHttpUri": "https://api.thegraph.com/subgraphs/name/nevermined-io/public",
|
|
13
|
+
"neverminedNodeUri": "https://node.base.nevermined.app",
|
|
14
|
+
"neverminedNodeAddress": "0x824dbcE5E9C96C5b8ce2A35a25a5ab87eD1D00b1",
|
|
15
|
+
"neverminedBackendUri": "https://one-backend.base.nevermined.app",
|
|
16
|
+
"subscription_id": "50413016362950485991271150743187499870906117744058208429036668344255336389082",
|
|
17
|
+
"verbose": true
|
|
18
|
+
},
|
|
19
|
+
"nativeToken": "ETH",
|
|
20
|
+
"networkName": "base",
|
|
21
|
+
"contractsVersion": "3.5.7",
|
|
22
|
+
"tagName": "public",
|
|
23
|
+
"etherscanUrl": "https://basescan.org",
|
|
24
|
+
"erc20TokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
25
|
+
"gasMultiplier": 0,
|
|
26
|
+
"gasPriceMultiplier": 0,
|
|
27
|
+
"externalNetwork": true
|
|
28
|
+
},
|
|
29
|
+
"GNOSIS": {
|
|
30
|
+
"envDescription": "The Gnosis production environment where users can interact with Nevermined protocol.",
|
|
31
|
+
"envUrl": "https://gnosis.nevermined.app/",
|
|
32
|
+
"envName": "Gnosis",
|
|
33
|
+
"isProduction": true,
|
|
34
|
+
"nvm": {
|
|
35
|
+
"chainId": 100,
|
|
36
|
+
"appUrl": "https://gnosis.nevermined.app",
|
|
37
|
+
"web3ProviderUri": "https://rpc.gnosischain.com/",
|
|
38
|
+
"marketplaceUri": "https://marketplace-api.gnosis.nevermined.app",
|
|
39
|
+
"graphHttpUri": "https://api.thegraph.com/subgraphs/name/nevermined-io/public",
|
|
40
|
+
"neverminedNodeUri": "https://node.gnosis.nevermined.app",
|
|
41
|
+
"neverminedNodeAddress": "0x824dbcE5E9C96C5b8ce2A35a25a5ab87eD1D00b1",
|
|
42
|
+
"neverminedBackendUri": "https://one-backend.gnosis.nevermined.app",
|
|
43
|
+
"subscription_id": "79922471236808376650579296325311587488574799199590951702510416090224804407991",
|
|
44
|
+
"verbose": true
|
|
45
|
+
},
|
|
46
|
+
"nativeToken": "xDAI",
|
|
47
|
+
"networkName": "gnosis",
|
|
48
|
+
"contractsVersion": "3.5.7",
|
|
49
|
+
"tagName": "public",
|
|
50
|
+
"etherscanUrl": "https://gnosisscan.io",
|
|
51
|
+
"erc20TokenAddress": "0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83",
|
|
52
|
+
"gasMultiplier": 1.1,
|
|
53
|
+
"gasPriceMultiplier": 0,
|
|
54
|
+
"externalNetwork": true
|
|
55
|
+
}
|
|
56
|
+
}
|
scripts/utils.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from aea_ledger_ethereum import EthereumApi
|
|
4
|
+
from web3.contract import Contract as Web3Contract
|
|
5
|
+
from mech_client.marketplace_interact import get_contract, CHAIN_TO_PRICE_TOKEN
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# based on mech configs
|
|
9
|
+
VALID_CHAINS = [
|
|
10
|
+
"gnosis",
|
|
11
|
+
"arbitrum",
|
|
12
|
+
"polygon",
|
|
13
|
+
"base",
|
|
14
|
+
"celo",
|
|
15
|
+
"optimism",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
CHAIN_TO_NATIVE_BALANCE_TRACKER = {
|
|
19
|
+
100: "0x21cE6799A22A3Da84B7c44a814a9c79ab1d2A50D",
|
|
20
|
+
42161: "",
|
|
21
|
+
137: "",
|
|
22
|
+
8453: "0xB3921F8D8215603f0Bd521341Ac45eA8f2d274c1",
|
|
23
|
+
42220: "",
|
|
24
|
+
10: "",
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
CHAIN_TO_TOKEN_BALANCE_TRACKER = {
|
|
28
|
+
100: "0x53Bd432516707a5212A70216284a99A563aAC1D1",
|
|
29
|
+
42161: "",
|
|
30
|
+
137: "",
|
|
31
|
+
8453: "0x43fB32f25dce34EB76c78C7A42C8F40F84BCD237",
|
|
32
|
+
42220: "",
|
|
33
|
+
10: "",
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def print_box(text: str, margin: int = 1, character: str = "=") -> None:
|
|
38
|
+
"""Print text centered within a box."""
|
|
39
|
+
|
|
40
|
+
lines = text.split("\n")
|
|
41
|
+
text_length = max(len(line) for line in lines)
|
|
42
|
+
length = text_length + 2 * margin
|
|
43
|
+
|
|
44
|
+
border = character * length
|
|
45
|
+
margin_str = " " * margin
|
|
46
|
+
|
|
47
|
+
print(border)
|
|
48
|
+
print(f"{margin_str}{text}{margin_str}")
|
|
49
|
+
print(border)
|
|
50
|
+
print()
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def print_title(text: str) -> None:
|
|
54
|
+
"""Print title."""
|
|
55
|
+
print()
|
|
56
|
+
print_box(text, 4, "=")
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def input_with_default_value(prompt: str, default_value: str) -> str:
|
|
60
|
+
user_input = input(f"{prompt} [{default_value}]: ")
|
|
61
|
+
return str(user_input) if user_input else default_value
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def input_select_chain() -> str:
|
|
65
|
+
"""Chose a single option from the offered ones"""
|
|
66
|
+
user_input = input(f"Chose one of the following options {VALID_CHAINS}: ").lower()
|
|
67
|
+
if user_input in VALID_CHAINS:
|
|
68
|
+
return user_input
|
|
69
|
+
else:
|
|
70
|
+
print("Invalid option selected. Please try again.")
|
|
71
|
+
return input_select_chain()
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def get_native_balance_tracker_contract(
|
|
75
|
+
ledger_api: EthereumApi, chain_id: int
|
|
76
|
+
) -> Web3Contract:
|
|
77
|
+
with open(
|
|
78
|
+
Path(__file__).parent.parent
|
|
79
|
+
/ "mech_client"
|
|
80
|
+
/ "abis"
|
|
81
|
+
/ "BalanceTrackerFixedPriceNative.json",
|
|
82
|
+
encoding="utf-8",
|
|
83
|
+
) as f:
|
|
84
|
+
abi = json.load(f)
|
|
85
|
+
|
|
86
|
+
native_balance_tracker_contract = get_contract(
|
|
87
|
+
contract_address=CHAIN_TO_NATIVE_BALANCE_TRACKER[chain_id],
|
|
88
|
+
abi=abi,
|
|
89
|
+
ledger_api=ledger_api,
|
|
90
|
+
)
|
|
91
|
+
return native_balance_tracker_contract
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def get_token_balance_tracker_contract(
|
|
95
|
+
ledger_api: EthereumApi, chain_id: int
|
|
96
|
+
) -> Web3Contract:
|
|
97
|
+
with open(
|
|
98
|
+
Path(__file__).parent.parent
|
|
99
|
+
/ "mech_client"
|
|
100
|
+
/ "abis"
|
|
101
|
+
/ "BalanceTrackerFixedPriceToken.json",
|
|
102
|
+
encoding="utf-8",
|
|
103
|
+
) as f:
|
|
104
|
+
abi = json.load(f)
|
|
105
|
+
|
|
106
|
+
token_balance_tracker_contract = get_contract(
|
|
107
|
+
contract_address=CHAIN_TO_TOKEN_BALANCE_TRACKER[chain_id],
|
|
108
|
+
abi=abi,
|
|
109
|
+
ledger_api=ledger_api,
|
|
110
|
+
)
|
|
111
|
+
return token_balance_tracker_contract
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def get_token_contract(ledger_api: EthereumApi, chain_id: int) -> Web3Contract:
|
|
115
|
+
with open(
|
|
116
|
+
Path(__file__).parent.parent / "mech_client" / "abis" / "IToken.json",
|
|
117
|
+
encoding="utf-8",
|
|
118
|
+
) as f:
|
|
119
|
+
abi = json.load(f)
|
|
120
|
+
|
|
121
|
+
token_contract = get_contract(
|
|
122
|
+
contract_address=CHAIN_TO_PRICE_TOKEN[chain_id],
|
|
123
|
+
abi=abi,
|
|
124
|
+
ledger_api=ledger_api,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
return token_contract
|
scripts/whitelist.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
directory # unused attribute (mech_client/acn.py:85)
|
|
2
|
+
directory # unused attribute (mech_client/acn.py:100)
|
|
3
|
+
directory # unused attribute (mech_client/acn.py:116)
|
|
4
|
+
payment_data # unused variable (mech_client/interact.py:111)
|
|
5
|
+
AGENT_QUERY_TEMPLATE # unused variable (mech_client/subgraph.py:30)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|