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.2.tar.gz (3.6 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: aodotpy-0.2.2.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.2.tar.gz
Algorithm Hash digest
SHA256 11e7ad13858559780d7a51228ca89ad38401f1944a7035c3fff61fd5390686fc
MD5 a3028473548e5fcf13a6d96b2a1073b3
BLAKE2b-256 e5490575e3997d91ab9c5888e57e36a3c76bc24f53ce69fd076e4e557e56f7f8

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