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

Uploaded Source

File details

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

File metadata

  • Download URL: aodotpy-0.2.3.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.3.tar.gz
Algorithm Hash digest
SHA256 1a46644b4093b945adeb9a04bcf58df3ff449a58b8eab3626d72671486d5c542
MD5 1535c45126b72d68f51a59176214ca84
BLAKE2b-256 72e0253eb78ef5faaff1e1cb3c1979be7177a7c7ed6b16d5b76b9ebbb9ec68d8

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