Recommended Posts

NectarFlower and Ecency Points

10 comments

paulmoon410788.8413 days ago2 min read

https://github.com/PaulMoon410/Peake_Collect

https://images.ecency.com/DQmXuwuXHFXKhKF9dtzTgJQcqb6WAnV7YVfM34z59Q2uWLo/396711090_23943742411940459_5435697632382235119_n.jpg

https://images.ecency.com/DQmPkgn65m69BN9GxS7Zk5ZXCbsgk17kXgUFFTQxjyhVuPE/image.png


I was attempting to work on some Ecency Points related projects, and I was curious if anyone had any input on an Ecency API?

Has anyone else done a project like this?

I have been working on this thing for awhile now, and thanks to @thecrazygm and @ecoinstant have aimed me in the correct direction. So now lets get the @Ecency points swap things working...

There's so many users accumulating without a way to actually get to unload those rewards in an effective way to actually get paid for their hard work.



import time
from nectar.hive import Hive
from nectar.account import Account
from nectar.transactionbuilder import TransactionBuilder
from nectarbase.operations import Custom_json

# Hive + Nectar Setup
HIVE_NODES = ["https://api.hive.blog", "https://anyx.io"]
hive = Hive(node=HIVE_NODES)

RECEIVING_ACCOUNT = "peakecoin"  # Your Hive account receiving 
Ecency Points gifts
PEK_TOKEN = "PEK"                     # Token symbol
SWAP_RATE = 0.001                     # 1 Ecency Point = 0.001 PEK

def send_pek(to_account, points_amount):
"""Send PEK tokens based on Ecency Points received."""
pek_amount = points_amount * SWAP_RATE

payload = {
    "contractName": "tokens",
    "contractAction": "transfer",
    "contractPayload": {
        "symbol": PEK_TOKEN,
        "to": to_account,
        "quantity": str(round(pek_amount, 8)),
        "memo": "Ecency Points Swap"
    }
}

tx = TransactionBuilder(blockchain_instance=hive)
op = Custom_json(
    required_auths=[RECEIVING_ACCOUNT],
    required_posting_auths=[],
    id="ssc-mainnet-hive",
    json=payload
)
tx.appendOps(op)
tx.appendSigner(RECEIVING_ACCOUNT, "active")
tx.sign()
tx.broadcast()

print(f"✅ Sent {pek_amount} PEK to {to_account}")

if __name__ == "__main__":
username = input("👤 Enter Hive username: ").strip()
points = int(input("🎯 How many Ecency Points were gifted?: ").strip())

send_pek(username, points)

Comments

Sort byBest