Skip to main content

Ambisafe client

Install

Use pip

pip install ambisafe

Usage

Create client

Import Client and create client object

from ambisafe import Client

client = Client(ambisafe_server_url, secret, api_key, api_secret)

You can set prefix for account id

client = Client(ambisafe_server_url, secret, api_key, api_secret, account_id_prefix='prefix')

You can provide read and connect timeout (in seconds)

client = Client(ambisafe_server_url, secret, api_key, api_secret, connect_timeout=2.5, read_timeout=5)

Create account

Simple security schema

account = client.create_simple_account(account_id, currency='BTC')

Wallet4 security schema

Generate operator container using secret and create user container from public_key, data (encrypted private key), iv and salt

from ambisafe import Container

operator_container = Container.generate(client.secret)
user_container = Container(public_key, data, iv, salt)

Create account for security schema “Wallet4” and “BTC” currency

account = client.create_wallet4_account(account_id, user_container=user_container,
                                        operator_container=operator_container,
                                        currency='BTC')

Update Wallet4 account

Create new containers and update account

account = client.update_wallet4_account(account_id, user_container=user_container,
                                        operator_container=operator_container,
                                        currency='BTC')

Get balance

Get balance in float

balance = client.get_balance(account_id, 'BTC')

Get account

account = client.get_account(account_id, 'BTC')

Make payment

For Simple account

Build and submit transaction

transaction = client.build_transaction(account_id, 'BTC', address, amount)
result = client.submit(account_id, transaction, 'BTC')

For Wallet4 accounts

Build transaction

transaction = client.build_transaction(account_id, 'BTC', address, amount)

Sign this transaction by user, then sing by operator and submit it

transaction = client.sign_wallet4_transaction(transaction, account_id, 'BTC')
client.submit(account_id, transaction, 'BTC')

# or

result = client.cosign_wallet4_and_submit(transaction, account_id, 'BTC')

Build recovery transaction

transaction = client.build_recovery_transaction(account_id, currency, old_address)

Disclaimer

The library still in BETA. There can be changes without backward compatibility.

Release files for ambisafe 0.28.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ambisafe 0.28.2
File Size Uploaded
ambisafe-0.28.2.tar.gz 12.7 kB Details

Release files / ambisafe-0.28.2.tar.gz

Download URL ambisafe-0.28.2.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8bf683b951ebc25d3a7e4cb7c20dfff24f38a2bd9f07c4ced33c3dc9082d39c3
BLAKE2b-256 checksum
How to use checksums
2eba677ca8fe3c33272f0c7aadc7c9eee2283cad4f8341414a3fb82e57a20858
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.15

Release history Release notifications | RSS feed

This release

0.28.2 This release

1 release file

0.28.1

1 release file

0.28.0

1 release file

0.27.0

1 release file

0.26.0

1 release file

0.25.1

1 release file

0.25.0

1 release file

0.24.0

1 release file

0.23.4

1 release file

0.23.3

1 release file

0.23.2

1 release file

0.23.1

1 release file

0.23.0

1 release file

0.22.0

1 release file

0.21.0

1 release file

0.20.0

1 release file

0.19.0

1 release file

0.18.0

1 release file

0.17.0

1 release file

0.16.0

1 release file

0.15.1

1 release file

0.14

1 release file

0.13

1 release file

0.12

1 release file

0.11

1 release file

0.10

1 release file

0.9

1 release file

0.8

1 release file

0.7

1 release file

0.6

1 release file

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page