Skip to content
Snippets Groups Projects
Commit 119a33bd authored by Jakub Ziebinski's avatar Jakub Ziebinski Committed by Jakub Ziebinski
Browse files

Make it possible to install just examples

parent 5de31ba2
No related branches found
No related tags found
1 merge request!278Implementation of the IHiveChainInterface
......@@ -2,6 +2,6 @@
## Visitor
### [visitor_example.py](visitor_example.py)
### [visitor_example.py](examples/visitor_example.py)
In this file you can see how to create and use your custom visitor for given operation types.
\ No newline at end of file
......@@ -4,14 +4,18 @@ import asyncio
from beekeepy import AsyncBeekeeper, AsyncSession, AsyncUnlockedWallet, AsyncWallet, Beekeeper
from wax import IOnlineTransaction, WaxChainOptions, create_hive_chain
from wax.cpp_python_bridge import calculate_public_key
from wax.proto.operations import transfer
PASSWORD = "pass"
WALLET_NAME = "alice"
HIVED_ADDRESS = "https://api.hive.blog"
YOUR_ACCOUNT_NAME = ""
TRANSFER_RECEIVER = ""
YOUR_PRIVATE_KEY = ""
YOUR_PUBLIC_KEY = ""
wax = create_hive_chain(WaxChainOptions(endpoint_url=HIVED_ADDRESS))
keys = wax.suggest_brain_key()
async def create_beekeeper_set() -> tuple[AsyncWallet | AsyncUnlockedWallet, AsyncSession, Beekeeper]:
beekeeper = await AsyncBeekeeper.factory()
......@@ -27,18 +31,18 @@ async def create_tx() -> IOnlineTransaction:
tx = await wax.create_transaction()
tx.push_operation(
transfer(
from_account="guest4test8",
to_account="guest4test8",
from_account=YOUR_ACCOUNT_NAME,
to_account=TRANSFER_RECEIVER,
amount=wax.hive.satoshis(1),
memo="hello from wax!")
)
return tx
async def sign_tx(unlocked_wallet: AsyncUnlockedWallet, tx: IOnlineTransaction) -> IOnlineTransaction:
if keys.associated_public_key not in unlocked_wallet.public_keys:
await unlocked_wallet.import_key(private_key=keys.wif_private_key)
if YOUR_PUBLIC_KEY not in await unlocked_wallet.public_keys:
await unlocked_wallet.import_key(private_key=YOUR_PRIVATE_KEY)
await tx.sign(wallet=unlocked_wallet, public_key=keys.associated_public_key)
await tx.sign(wallet=unlocked_wallet, public_key=YOUR_PUBLIC_KEY)
return tx
async def main() -> None:
......
This diff is collapsed.
[build-system]
requires = ["poetry-core==1.1.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "python_exaples"
version = "0.0.0"
description = "A simple way to run wax examples."
authors = ["Jakub Ziębiński <ziebinskijakub@gmail.com>"]
packages = [
{ include = "examples" },
]
source = [
{ name = "PyPI", priority = "primary" },
{ name = "gitlab-schemas", url = "https://gitlab.syncad.com/api/v4/projects/362/packages/pypi/simple", priority = "supplemental" },
{ name = "gitlab-wax", url = "https://gitlab.syncad.com/api/v4/projects/419/packages/pypi/simple", priority = "supplemental" },
{ name = "gitlab-beekeepy", url = "https://gitlab.syncad.com/api/v4/projects/434/packages/pypi/simple", priority = "supplemental" },
]
[tool.poetry.dependencies]
python = "^3.10"
wax = "0.3.10.dev579+e53b1fe"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment