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(signer, 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(signer, 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.1.tar.gz (3.4 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for aodotpy-0.2.1.tar.gz
Algorithm Hash digest
SHA256 eacae228ef439c5078f9e2817900631f435be37276337490d312cd3ba0b91d1b
MD5 aa3ddfa6550c2d3235be9712e5dff1fc
BLAKE2b-256 c54aca44a0aba37c9f4b497678aa0f74ad18ce39f210330ae970ca3d2d3205c0

See more details on using hashes here.

Supported by

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