vordium 0.1.0__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.
- vordium-0.1.0/PKG-INFO +99 -0
- vordium-0.1.0/README.md +67 -0
- vordium-0.1.0/pyproject.toml +42 -0
- vordium-0.1.0/setup.cfg +4 -0
- vordium-0.1.0/setup.py +34 -0
- vordium-0.1.0/vordium/__init__.py +19 -0
- vordium-0.1.0/vordium/agent.py +119 -0
- vordium-0.1.0/vordium/chain.py +37 -0
- vordium-0.1.0/vordium/cli.py +146 -0
- vordium-0.1.0/vordium/config.py +12 -0
- vordium-0.1.0/vordium/wallet.py +51 -0
- vordium-0.1.0/vordium.egg-info/PKG-INFO +99 -0
- vordium-0.1.0/vordium.egg-info/SOURCES.txt +15 -0
- vordium-0.1.0/vordium.egg-info/dependency_links.txt +1 -0
- vordium-0.1.0/vordium.egg-info/entry_points.txt +2 -0
- vordium-0.1.0/vordium.egg-info/requires.txt +3 -0
- vordium-0.1.0/vordium.egg-info/top_level.txt +1 -0
vordium-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vordium
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for AI agents on Vordium Chain — The AI Layer
|
|
5
|
+
Home-page: https://github.com/vordium/vordium-py
|
|
6
|
+
Author: Vordium
|
|
7
|
+
Author-email: Vordium <dev@vordium.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://vordium.com
|
|
10
|
+
Project-URL: Documentation, https://docs.vordium.com
|
|
11
|
+
Project-URL: Repository, https://github.com/Vordium/vordium-py
|
|
12
|
+
Project-URL: Explorer, https://vordscan.io
|
|
13
|
+
Keywords: vordium,blockchain,ai,agents,web3,evm,crypto
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
Requires-Dist: web3>=6.0.0
|
|
27
|
+
Requires-Dist: eth-account>=0.9.0
|
|
28
|
+
Requires-Dist: requests>=2.28.0
|
|
29
|
+
Dynamic: author
|
|
30
|
+
Dynamic: home-page
|
|
31
|
+
Dynamic: requires-python
|
|
32
|
+
|
|
33
|
+
# Vordium Python SDK
|
|
34
|
+
|
|
35
|
+
The AI Layer for Crypto.
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install vordium
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Quick Start
|
|
44
|
+
|
|
45
|
+
### Initialize your agent
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
vordium init
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Python
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from vordium import Agent
|
|
55
|
+
|
|
56
|
+
agent = Agent()
|
|
57
|
+
print(agent.address)
|
|
58
|
+
print(agent.balance)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Run autonomously
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
import asyncio
|
|
65
|
+
from vordium import Agent
|
|
66
|
+
|
|
67
|
+
agent = Agent()
|
|
68
|
+
|
|
69
|
+
async def strategy(agent):
|
|
70
|
+
print(f"Block {agent.block} | {agent.balance} VORD")
|
|
71
|
+
|
|
72
|
+
asyncio.run(agent.run(strategy=strategy))
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## CLI Commands
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
vordium init Create new agent wallet
|
|
79
|
+
vordium status Check chain status
|
|
80
|
+
vordium balance Check VORD balance
|
|
81
|
+
vordium fund Get testnet VORD
|
|
82
|
+
vordium send <to> <amount> Send VORD
|
|
83
|
+
vordium run agent.py Run agent script
|
|
84
|
+
vordium Interactive mode
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Network
|
|
88
|
+
|
|
89
|
+
| | |
|
|
90
|
+
|---|---|
|
|
91
|
+
| Chain ID | 713714 |
|
|
92
|
+
| RPC | https://rpc.vordium.com |
|
|
93
|
+
| Explorer | https://vordscan.io |
|
|
94
|
+
| Faucet | https://faucet.vordium.com |
|
|
95
|
+
|
|
96
|
+
## Links
|
|
97
|
+
|
|
98
|
+
- Docs: https://docs.vordium.com
|
|
99
|
+
- GitHub: https://github.com/vordium/vordium-py
|
vordium-0.1.0/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Vordium Python SDK
|
|
2
|
+
|
|
3
|
+
The AI Layer for Crypto.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install vordium
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
### Initialize your agent
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
vordium init
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Python
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from vordium import Agent
|
|
23
|
+
|
|
24
|
+
agent = Agent()
|
|
25
|
+
print(agent.address)
|
|
26
|
+
print(agent.balance)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Run autonomously
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
import asyncio
|
|
33
|
+
from vordium import Agent
|
|
34
|
+
|
|
35
|
+
agent = Agent()
|
|
36
|
+
|
|
37
|
+
async def strategy(agent):
|
|
38
|
+
print(f"Block {agent.block} | {agent.balance} VORD")
|
|
39
|
+
|
|
40
|
+
asyncio.run(agent.run(strategy=strategy))
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## CLI Commands
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
vordium init Create new agent wallet
|
|
47
|
+
vordium status Check chain status
|
|
48
|
+
vordium balance Check VORD balance
|
|
49
|
+
vordium fund Get testnet VORD
|
|
50
|
+
vordium send <to> <amount> Send VORD
|
|
51
|
+
vordium run agent.py Run agent script
|
|
52
|
+
vordium Interactive mode
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Network
|
|
56
|
+
|
|
57
|
+
| | |
|
|
58
|
+
|---|---|
|
|
59
|
+
| Chain ID | 713714 |
|
|
60
|
+
| RPC | https://rpc.vordium.com |
|
|
61
|
+
| Explorer | https://vordscan.io |
|
|
62
|
+
| Faucet | https://faucet.vordium.com |
|
|
63
|
+
|
|
64
|
+
## Links
|
|
65
|
+
|
|
66
|
+
- Docs: https://docs.vordium.com
|
|
67
|
+
- GitHub: https://github.com/vordium/vordium-py
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "vordium"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python SDK for AI agents on Vordium Chain — The AI Layer"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "Vordium", email = "dev@vordium.com" }]
|
|
13
|
+
keywords = ["vordium", "blockchain", "ai", "agents", "web3", "evm", "crypto"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.8",
|
|
20
|
+
"Programming Language :: Python :: 3.9",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
25
|
+
]
|
|
26
|
+
dependencies = [
|
|
27
|
+
"web3>=6.0.0",
|
|
28
|
+
"eth-account>=0.9.0",
|
|
29
|
+
"requests>=2.28.0",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Homepage = "https://vordium.com"
|
|
34
|
+
Documentation = "https://docs.vordium.com"
|
|
35
|
+
Repository = "https://github.com/Vordium/vordium-py"
|
|
36
|
+
Explorer = "https://vordscan.io"
|
|
37
|
+
|
|
38
|
+
[project.scripts]
|
|
39
|
+
vordium = "vordium.cli:main"
|
|
40
|
+
|
|
41
|
+
[tool.setuptools.packages.find]
|
|
42
|
+
include = ["vordium*"]
|
vordium-0.1.0/setup.cfg
ADDED
vordium-0.1.0/setup.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
readme = Path(__file__).parent / "README.md"
|
|
5
|
+
long_description = readme.read_text() if readme.exists() else ""
|
|
6
|
+
|
|
7
|
+
setup(
|
|
8
|
+
name="vordium",
|
|
9
|
+
version="0.1.0",
|
|
10
|
+
author="Vordium",
|
|
11
|
+
author_email="dev@vordium.com",
|
|
12
|
+
description="Python SDK for AI agents on Vordium Chain - The AI Layer",
|
|
13
|
+
long_description=long_description,
|
|
14
|
+
long_description_content_type="text/markdown",
|
|
15
|
+
url="https://github.com/vordium/vordium-py",
|
|
16
|
+
packages=find_packages(),
|
|
17
|
+
python_requires=">=3.8",
|
|
18
|
+
install_requires=[
|
|
19
|
+
"web3>=6.0.0",
|
|
20
|
+
"eth-account>=0.8.0",
|
|
21
|
+
"requests>=2.28.0",
|
|
22
|
+
"python-dotenv>=0.19.0",
|
|
23
|
+
],
|
|
24
|
+
entry_points={
|
|
25
|
+
"console_scripts": [
|
|
26
|
+
"vordium=vordium.cli:main",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
classifiers=[
|
|
30
|
+
"Programming Language :: Python :: 3",
|
|
31
|
+
"License :: OSI Approved :: MIT License",
|
|
32
|
+
"Operating System :: OS Independent",
|
|
33
|
+
],
|
|
34
|
+
)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Vordium SDK — Python library for AI agents on Vordium Chain.
|
|
3
|
+
|
|
4
|
+
Usage:
|
|
5
|
+
from vordium import Agent
|
|
6
|
+
agent = Agent()
|
|
7
|
+
print(agent.address)
|
|
8
|
+
print(agent.balance)
|
|
9
|
+
|
|
10
|
+
Docs: https://docs.vordium.com
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from .agent import Agent
|
|
14
|
+
from .wallet import Wallet
|
|
15
|
+
from .chain import Chain
|
|
16
|
+
|
|
17
|
+
__version__ = "0.1.0"
|
|
18
|
+
__author__ = "Vordium"
|
|
19
|
+
__all__ = ["Agent", "Wallet", "Chain"]
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import asyncio
|
|
3
|
+
import requests
|
|
4
|
+
from web3 import Web3
|
|
5
|
+
from .config import RPC_URL, CHAIN_ID, FAUCET_URL, EXPLORER_URL
|
|
6
|
+
from .wallet import Wallet
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Agent:
|
|
10
|
+
"""
|
|
11
|
+
Vordium AI Agent
|
|
12
|
+
|
|
13
|
+
Usage:
|
|
14
|
+
agent = Agent()
|
|
15
|
+
print(agent.address)
|
|
16
|
+
print(agent.balance)
|
|
17
|
+
await agent.run()
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
def __init__(self, private_key: str = None):
|
|
21
|
+
self._w3 = Web3(Web3.HTTPProvider(RPC_URL))
|
|
22
|
+
|
|
23
|
+
if private_key:
|
|
24
|
+
self._wallet = Wallet.from_key(private_key)
|
|
25
|
+
elif os.getenv('VORDIUM_PRIVATE_KEY'):
|
|
26
|
+
self._wallet = Wallet.from_key(os.getenv('VORDIUM_PRIVATE_KEY'))
|
|
27
|
+
else:
|
|
28
|
+
self._wallet = Wallet.create()
|
|
29
|
+
print("New agent wallet created!")
|
|
30
|
+
print(f"Address: {self._wallet.address}")
|
|
31
|
+
print(f"Private Key: {self._wallet.private_key}")
|
|
32
|
+
print("Save this to your .env file:")
|
|
33
|
+
print(f"VORDIUM_PRIVATE_KEY={self._wallet.private_key}")
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def address(self) -> str:
|
|
37
|
+
return self._wallet.address
|
|
38
|
+
|
|
39
|
+
@property
|
|
40
|
+
def private_key(self) -> str:
|
|
41
|
+
return self._wallet.private_key
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
def balance(self) -> float:
|
|
45
|
+
raw = self._w3.eth.get_balance(self.address)
|
|
46
|
+
return float(self._w3.from_wei(raw, 'ether'))
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
def block(self) -> int:
|
|
50
|
+
return self._w3.eth.block_number
|
|
51
|
+
|
|
52
|
+
def fund(self) -> bool:
|
|
53
|
+
"""Get free testnet VORD from faucet."""
|
|
54
|
+
try:
|
|
55
|
+
response = requests.post(
|
|
56
|
+
f"{FAUCET_URL}/api/faucet",
|
|
57
|
+
json={"address": self.address},
|
|
58
|
+
timeout=30
|
|
59
|
+
)
|
|
60
|
+
if response.status_code == 200:
|
|
61
|
+
print("Funded with 100 VORD")
|
|
62
|
+
return True
|
|
63
|
+
print(f"Faucet: {response.text}")
|
|
64
|
+
return False
|
|
65
|
+
except Exception as e:
|
|
66
|
+
print(f"Faucet error: {e}")
|
|
67
|
+
return False
|
|
68
|
+
|
|
69
|
+
def send(self, to: str, amount: float) -> str:
|
|
70
|
+
"""Send VORD to an address."""
|
|
71
|
+
nonce = self._w3.eth.get_transaction_count(self.address)
|
|
72
|
+
tx = {
|
|
73
|
+
'to': Web3.to_checksum_address(to),
|
|
74
|
+
'value': self._w3.to_wei(amount, 'ether'),
|
|
75
|
+
'gas': 21000,
|
|
76
|
+
'gasPrice': self._w3.eth.gas_price,
|
|
77
|
+
'nonce': nonce,
|
|
78
|
+
'chainId': CHAIN_ID
|
|
79
|
+
}
|
|
80
|
+
signed = self._w3.eth.account.sign_transaction(tx, self.private_key)
|
|
81
|
+
raw = getattr(signed, 'raw_transaction', None) or signed.rawTransaction
|
|
82
|
+
tx_hash = self._w3.eth.send_raw_transaction(raw)
|
|
83
|
+
tx_hex = tx_hash.hex()
|
|
84
|
+
self._w3.eth.wait_for_transaction_receipt(tx_hash)
|
|
85
|
+
print(f"Sent {amount} VORD")
|
|
86
|
+
print(f"TX: {EXPLORER_URL}/tx/{tx_hex}")
|
|
87
|
+
return tx_hex
|
|
88
|
+
|
|
89
|
+
def is_healthy(self) -> bool:
|
|
90
|
+
try:
|
|
91
|
+
return self._w3.is_connected() and self.block > 0
|
|
92
|
+
except Exception:
|
|
93
|
+
return False
|
|
94
|
+
|
|
95
|
+
async def run(self, strategy=None, interval: float = 1.0):
|
|
96
|
+
"""Run agent autonomously."""
|
|
97
|
+
print(f"\nAgent: {self.address}")
|
|
98
|
+
print(f"Balance: {self.balance} VORD")
|
|
99
|
+
print(f"Block: {self.block:,}")
|
|
100
|
+
status = 'Healthy' if self.is_healthy() else 'Unhealthy'
|
|
101
|
+
print(f"Status: {status}")
|
|
102
|
+
print("\nRunning... (Ctrl+C to stop)\n")
|
|
103
|
+
|
|
104
|
+
while True:
|
|
105
|
+
try:
|
|
106
|
+
if strategy:
|
|
107
|
+
await strategy(self)
|
|
108
|
+
else:
|
|
109
|
+
print(f"Block {self.block:,} | {self.balance:.4f} VORD")
|
|
110
|
+
await asyncio.sleep(interval)
|
|
111
|
+
except KeyboardInterrupt:
|
|
112
|
+
print("\nAgent stopped.")
|
|
113
|
+
break
|
|
114
|
+
except Exception as e:
|
|
115
|
+
print(f"Error: {e}")
|
|
116
|
+
await asyncio.sleep(5)
|
|
117
|
+
|
|
118
|
+
def __repr__(self):
|
|
119
|
+
return f"Agent(address={self.address})"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from web3 import Web3
|
|
2
|
+
from .config import RPC_URL, EXPLORER_URL
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Chain:
|
|
6
|
+
def __init__(self):
|
|
7
|
+
self._w3 = Web3(Web3.HTTPProvider(RPC_URL))
|
|
8
|
+
|
|
9
|
+
@property
|
|
10
|
+
def connected(self) -> bool:
|
|
11
|
+
return self._w3.is_connected()
|
|
12
|
+
|
|
13
|
+
@property
|
|
14
|
+
def block_number(self) -> int:
|
|
15
|
+
return self._w3.eth.block_number
|
|
16
|
+
|
|
17
|
+
@property
|
|
18
|
+
def gas_price(self) -> float:
|
|
19
|
+
return float(self._w3.from_wei(self._w3.eth.gas_price, 'gwei'))
|
|
20
|
+
|
|
21
|
+
def get_balance(self, address: str) -> float:
|
|
22
|
+
raw = self._w3.eth.get_balance(Web3.to_checksum_address(address))
|
|
23
|
+
return float(self._w3.from_wei(raw, 'ether'))
|
|
24
|
+
|
|
25
|
+
def get_transaction(self, tx_hash: str):
|
|
26
|
+
return self._w3.eth.get_transaction(tx_hash)
|
|
27
|
+
|
|
28
|
+
def get_block(self, number: int = None):
|
|
29
|
+
if number is None:
|
|
30
|
+
return self._w3.eth.get_block('latest')
|
|
31
|
+
return self._w3.eth.get_block(number)
|
|
32
|
+
|
|
33
|
+
def explorer_url(self, tx_hash: str) -> str:
|
|
34
|
+
return f"{EXPLORER_URL}/tx/{tx_hash}"
|
|
35
|
+
|
|
36
|
+
def __repr__(self):
|
|
37
|
+
return f"Chain(block={self.block_number}, connected={self.connected})"
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
from .agent import Agent
|
|
3
|
+
from .chain import Chain
|
|
4
|
+
from .config import CHAIN_ID, RPC_URL, EXPLORER_URL, CHAIN_NAME
|
|
5
|
+
|
|
6
|
+
BANNER = """
|
|
7
|
+
==========================================
|
|
8
|
+
VORDIUM AGENT TERMINAL
|
|
9
|
+
The AI Layer for Crypto
|
|
10
|
+
docs.vordium.com
|
|
11
|
+
==========================================
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def main():
|
|
16
|
+
parser = argparse.ArgumentParser(
|
|
17
|
+
prog='vordium',
|
|
18
|
+
description='Vordium Agent CLI - The AI Layer'
|
|
19
|
+
)
|
|
20
|
+
subparsers = parser.add_subparsers(dest='command')
|
|
21
|
+
|
|
22
|
+
subparsers.add_parser('init', help='Create new agent wallet')
|
|
23
|
+
subparsers.add_parser('status', help='Check chain status')
|
|
24
|
+
subparsers.add_parser('fund', help='Get testnet VORD from faucet')
|
|
25
|
+
|
|
26
|
+
bal = subparsers.add_parser('balance', help='Check VORD balance')
|
|
27
|
+
bal.add_argument('address', nargs='?')
|
|
28
|
+
|
|
29
|
+
send = subparsers.add_parser('send', help='Send VORD')
|
|
30
|
+
send.add_argument('to')
|
|
31
|
+
send.add_argument('amount', type=float)
|
|
32
|
+
|
|
33
|
+
run = subparsers.add_parser('run', help='Run agent script')
|
|
34
|
+
run.add_argument('script')
|
|
35
|
+
|
|
36
|
+
args = parser.parse_args()
|
|
37
|
+
print(BANNER)
|
|
38
|
+
|
|
39
|
+
if args.command == 'init':
|
|
40
|
+
cmd_init()
|
|
41
|
+
elif args.command == 'status':
|
|
42
|
+
cmd_status()
|
|
43
|
+
elif args.command == 'fund':
|
|
44
|
+
cmd_fund()
|
|
45
|
+
elif args.command == 'balance':
|
|
46
|
+
cmd_balance(args)
|
|
47
|
+
elif args.command == 'send':
|
|
48
|
+
cmd_send(args)
|
|
49
|
+
elif args.command == 'run':
|
|
50
|
+
cmd_run(args)
|
|
51
|
+
else:
|
|
52
|
+
cmd_interactive()
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def cmd_init():
|
|
56
|
+
print("Initializing new agent...\n")
|
|
57
|
+
agent = Agent()
|
|
58
|
+
print(f"\n{'='*50}")
|
|
59
|
+
print(f"Address: {agent.address}")
|
|
60
|
+
print(f"Private Key: {agent.private_key}")
|
|
61
|
+
print(f"{'='*50}")
|
|
62
|
+
print("\nSave your private key to .env:")
|
|
63
|
+
print(f"VORDIUM_PRIVATE_KEY={agent.private_key}\n")
|
|
64
|
+
print("Getting testnet VORD...")
|
|
65
|
+
agent.fund()
|
|
66
|
+
print(f"Balance: {agent.balance} VORD")
|
|
67
|
+
print(f"Explorer: {EXPLORER_URL}/address/{agent.address}")
|
|
68
|
+
print("\nAgent ready to trade.")
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def cmd_status():
|
|
72
|
+
chain = Chain()
|
|
73
|
+
status = 'Online' if chain.connected else 'Offline'
|
|
74
|
+
print(f"Chain: {CHAIN_NAME}")
|
|
75
|
+
print(f"Chain ID: {CHAIN_ID}")
|
|
76
|
+
print(f"RPC: {RPC_URL}")
|
|
77
|
+
print(f"Block: {chain.block_number:,}")
|
|
78
|
+
print(f"Gas Price: {chain.gas_price:.2f} gwei")
|
|
79
|
+
print(f"Status: {status}")
|
|
80
|
+
print(f"Explorer: {EXPLORER_URL}")
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def cmd_fund():
|
|
84
|
+
agent = Agent()
|
|
85
|
+
print(f"Requesting VORD for {agent.address}...")
|
|
86
|
+
agent.fund()
|
|
87
|
+
print(f"Balance: {agent.balance} VORD")
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def cmd_balance(args):
|
|
91
|
+
chain = Chain()
|
|
92
|
+
addr = args.address if args.address else Agent().address
|
|
93
|
+
print(f"Address: {addr}")
|
|
94
|
+
print(f"Balance: {chain.get_balance(addr)} VORD")
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def cmd_send(args):
|
|
98
|
+
agent = Agent()
|
|
99
|
+
print(f"Sending {args.amount} VORD to {args.to}...")
|
|
100
|
+
agent.send(args.to, args.amount)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def cmd_run(args):
|
|
104
|
+
print(f"Running {args.script}...\n")
|
|
105
|
+
with open(args.script) as f:
|
|
106
|
+
exec(f.read())
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def cmd_interactive():
|
|
110
|
+
chain = Chain()
|
|
111
|
+
agent = Agent()
|
|
112
|
+
print(f"Connected: {CHAIN_NAME}")
|
|
113
|
+
print(f"Block: {chain.block_number:,}")
|
|
114
|
+
print(f"Address: {agent.address}")
|
|
115
|
+
print(f"Balance: {agent.balance} VORD")
|
|
116
|
+
print("\nCommands: status, balance, fund, send <to> <amount>, exit\n")
|
|
117
|
+
|
|
118
|
+
while True:
|
|
119
|
+
try:
|
|
120
|
+
cmd = input("vordium> ").strip()
|
|
121
|
+
if not cmd:
|
|
122
|
+
continue
|
|
123
|
+
if cmd == 'status':
|
|
124
|
+
print(f"Block: {chain.block_number:,} | Gas: {chain.gas_price:.2f} gwei")
|
|
125
|
+
elif cmd == 'balance':
|
|
126
|
+
print(f"{agent.balance} VORD")
|
|
127
|
+
elif cmd == 'fund':
|
|
128
|
+
agent.fund()
|
|
129
|
+
elif cmd.startswith('send '):
|
|
130
|
+
parts = cmd.split()
|
|
131
|
+
if len(parts) == 3:
|
|
132
|
+
agent.send(parts[1], float(parts[2]))
|
|
133
|
+
elif cmd in ('exit', 'quit'):
|
|
134
|
+
print("Goodbye.")
|
|
135
|
+
break
|
|
136
|
+
else:
|
|
137
|
+
print("Commands: status, balance, fund, send <to> <amount>, exit")
|
|
138
|
+
except KeyboardInterrupt:
|
|
139
|
+
print("\nGoodbye.")
|
|
140
|
+
break
|
|
141
|
+
except Exception as e:
|
|
142
|
+
print(f"Error: {e}")
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
if __name__ == '__main__':
|
|
146
|
+
main()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
CHAIN_ID = 713714
|
|
2
|
+
CHAIN_ID_HEX = "0xae3f2"
|
|
3
|
+
CHAIN_NAME = "Vordium Chain"
|
|
4
|
+
RPC_URL = "https://rpc.vordium.com"
|
|
5
|
+
WS_URL = "wss://ws.vordium.com"
|
|
6
|
+
EXPLORER_URL = "https://vordscan.io"
|
|
7
|
+
FAUCET_URL = "https://faucet.vordium.com"
|
|
8
|
+
NATIVE_TOKEN = "VORD"
|
|
9
|
+
NATIVE_DECIMALS = 18
|
|
10
|
+
VRC20_STANDARD = "0xF924975Cc9d401cd5a6bD1171DEDaEc0bD301B20"
|
|
11
|
+
VRC721_STANDARD = "0xD75c82c33c8642150d0485fCE330fD9FE44b9dC0"
|
|
12
|
+
VRC1155_STANDARD = "0x90811A8D1e19BE8030D18B9C61b566A676d82f1A"
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from eth_account import Account
|
|
3
|
+
from web3 import Web3
|
|
4
|
+
from .config import RPC_URL
|
|
5
|
+
|
|
6
|
+
Account.enable_unaudited_hdwallet_features()
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Wallet:
|
|
10
|
+
def __init__(self, private_key: str = None):
|
|
11
|
+
self._w3 = Web3(Web3.HTTPProvider(RPC_URL))
|
|
12
|
+
if private_key:
|
|
13
|
+
self._account = Account.from_key(private_key)
|
|
14
|
+
else:
|
|
15
|
+
self._account = Account.create()
|
|
16
|
+
|
|
17
|
+
@classmethod
|
|
18
|
+
def create(cls) -> 'Wallet':
|
|
19
|
+
return cls()
|
|
20
|
+
|
|
21
|
+
@classmethod
|
|
22
|
+
def from_key(cls, private_key: str) -> 'Wallet':
|
|
23
|
+
return cls(private_key=private_key)
|
|
24
|
+
|
|
25
|
+
@classmethod
|
|
26
|
+
def from_mnemonic(cls, mnemonic: str) -> 'Wallet':
|
|
27
|
+
account = Account.from_mnemonic(mnemonic)
|
|
28
|
+
return cls(private_key=account.key.hex())
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def address(self) -> str:
|
|
32
|
+
return self._account.address
|
|
33
|
+
|
|
34
|
+
@property
|
|
35
|
+
def private_key(self) -> str:
|
|
36
|
+
return self._account.key.hex()
|
|
37
|
+
|
|
38
|
+
def balance(self) -> float:
|
|
39
|
+
raw = self._w3.eth.get_balance(self.address)
|
|
40
|
+
return float(self._w3.from_wei(raw, 'ether'))
|
|
41
|
+
|
|
42
|
+
def save(self, path: str):
|
|
43
|
+
with open(path, 'w') as f:
|
|
44
|
+
json.dump({
|
|
45
|
+
'address': self.address,
|
|
46
|
+
'private_key': self.private_key
|
|
47
|
+
}, f, indent=2)
|
|
48
|
+
print(f"Wallet saved to {path}")
|
|
49
|
+
|
|
50
|
+
def __repr__(self):
|
|
51
|
+
return f"Wallet(address={self.address})"
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vordium
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for AI agents on Vordium Chain — The AI Layer
|
|
5
|
+
Home-page: https://github.com/vordium/vordium-py
|
|
6
|
+
Author: Vordium
|
|
7
|
+
Author-email: Vordium <dev@vordium.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://vordium.com
|
|
10
|
+
Project-URL: Documentation, https://docs.vordium.com
|
|
11
|
+
Project-URL: Repository, https://github.com/Vordium/vordium-py
|
|
12
|
+
Project-URL: Explorer, https://vordscan.io
|
|
13
|
+
Keywords: vordium,blockchain,ai,agents,web3,evm,crypto
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
Requires-Dist: web3>=6.0.0
|
|
27
|
+
Requires-Dist: eth-account>=0.9.0
|
|
28
|
+
Requires-Dist: requests>=2.28.0
|
|
29
|
+
Dynamic: author
|
|
30
|
+
Dynamic: home-page
|
|
31
|
+
Dynamic: requires-python
|
|
32
|
+
|
|
33
|
+
# Vordium Python SDK
|
|
34
|
+
|
|
35
|
+
The AI Layer for Crypto.
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install vordium
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Quick Start
|
|
44
|
+
|
|
45
|
+
### Initialize your agent
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
vordium init
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Python
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from vordium import Agent
|
|
55
|
+
|
|
56
|
+
agent = Agent()
|
|
57
|
+
print(agent.address)
|
|
58
|
+
print(agent.balance)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Run autonomously
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
import asyncio
|
|
65
|
+
from vordium import Agent
|
|
66
|
+
|
|
67
|
+
agent = Agent()
|
|
68
|
+
|
|
69
|
+
async def strategy(agent):
|
|
70
|
+
print(f"Block {agent.block} | {agent.balance} VORD")
|
|
71
|
+
|
|
72
|
+
asyncio.run(agent.run(strategy=strategy))
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## CLI Commands
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
vordium init Create new agent wallet
|
|
79
|
+
vordium status Check chain status
|
|
80
|
+
vordium balance Check VORD balance
|
|
81
|
+
vordium fund Get testnet VORD
|
|
82
|
+
vordium send <to> <amount> Send VORD
|
|
83
|
+
vordium run agent.py Run agent script
|
|
84
|
+
vordium Interactive mode
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Network
|
|
88
|
+
|
|
89
|
+
| | |
|
|
90
|
+
|---|---|
|
|
91
|
+
| Chain ID | 713714 |
|
|
92
|
+
| RPC | https://rpc.vordium.com |
|
|
93
|
+
| Explorer | https://vordscan.io |
|
|
94
|
+
| Faucet | https://faucet.vordium.com |
|
|
95
|
+
|
|
96
|
+
## Links
|
|
97
|
+
|
|
98
|
+
- Docs: https://docs.vordium.com
|
|
99
|
+
- GitHub: https://github.com/vordium/vordium-py
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
setup.py
|
|
4
|
+
vordium/__init__.py
|
|
5
|
+
vordium/agent.py
|
|
6
|
+
vordium/chain.py
|
|
7
|
+
vordium/cli.py
|
|
8
|
+
vordium/config.py
|
|
9
|
+
vordium/wallet.py
|
|
10
|
+
vordium.egg-info/PKG-INFO
|
|
11
|
+
vordium.egg-info/SOURCES.txt
|
|
12
|
+
vordium.egg-info/dependency_links.txt
|
|
13
|
+
vordium.egg-info/entry_points.txt
|
|
14
|
+
vordium.egg-info/requires.txt
|
|
15
|
+
vordium.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vordium
|