This repository was archived by the owner on Jan 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 124
/
Copy pathsandbox.py
53 lines (44 loc) · 1.57 KB
/
sandbox.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# coding=utf-8
from __future__ import absolute_import, division, print_function, \
unicode_literals
from iota import Address, Iota, Tag, TryteString
from iota.adapter.sandbox import SandboxAdapter
from iota.transaction.creation import ProposedTransaction
# Create the API client.
api = Iota(
# To use sandbox mode, inject a ``SandboxAdapter``.
adapter=SandboxAdapter(
# URI of the sandbox node.
uri='https://sandbox.iota.org/api/v1/',
# Access token used to authenticate requests.
# Contact the node maintainer to get an access token.
auth_token='auth token goes here',
),
# Seed used for cryptographic functions.
# If null, a random seed will be generated.
seed=b'SEED9GOES9HERE',
)
# Example of sending a transfer using the sandbox.
# For more information, see :py:meth:`Iota.send_transfer`.
# noinspection SpellCheckingInspection
api.send_transfer(
depth=3,
# One or more :py:class:`ProposedTransaction` objects to add to the
# bundle.
transfers=[
ProposedTransaction(
# Recipient of the transfer.
address=Address(
b'TESTVALUE9DONTUSEINPRODUCTION99999FBFFTG'
b'QFWEHEL9KCAFXBJBXGE9HID9XCOHFIDABHDG9AHDR'
),
# Amount of IOTA to transfer.
# This value may be zero.
value=42,
# Optional tag to attach to the transfer.
tag=Tag(b'EXAMPLE'),
# Optional message to include with the transfer.
message=TryteString.from_string('Hello, Tangle!'),
),
],
)