Skip to main content

Python wrappers for ao

Project description

ao.py

python sdk for ao https://ao.arweave.dev/

install

pip install aodotpy

Example

import ao

# ao cred process id
ar = 'xU9zFkq3X2ZQ6olwNVvr1vUWIjc3kXTWr7xKQD6dh10'
signer = ao.ARSigner('your ar wallet json file')

# use dry run to get your cred balance
result = ao.dry_run(ar, '', {'Action':'Balance'})
print(result)

# transfer
recipient = 'your recipient ar address'
message_id, result = ao.send_and_get(signer, ar, '', {'Action':'Transfer', 'Recipient':recipient, 'Quantity':'1000000000000'})
print(message_id)
print(result)

# swap on permaswap(ao)

# ar-llama pool, 
pool = 'aGF7BWB_9B924sBXoirHy4KOceoCX72B77yh1nllMPA'

# swap 0.01 ar for llama
message_id, result = ao.send_and_get(signer, ar, '', 
    {'Action':'Transfer', 'Recipient':pool, 'Quantity':'10000000000', 'X-PS-For':'Swap', 'X-PS-MinAmountOut':'1000000000000'}
)

# checkout out swap result, permaswap use message_id as order_id.
result = ao.dry_run(pool, '', {'Action':'GetOrder', 'OrderId':message_id})
print(result)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aodotpy-0.2.4.tar.gz (3.6 kB view details)

Uploaded Source

File details

Details for the file aodotpy-0.2.4.tar.gz.

File metadata

  • Download URL: aodotpy-0.2.4.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.16

File hashes

Hashes for aodotpy-0.2.4.tar.gz
Algorithm Hash digest
SHA256 7deb62a482d15e3ea9add0aabb35794b45fb6d85f2ca83067536d5c1e2e3799d
MD5 48265eff30b9d95e0fe8b44bf2dac609
BLAKE2b-256 e34091f9c7b3f983ae2835c433abc7ae7f7ac62c423cd1df4c41bbbc86d0a4e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page