Skip to content
This repository was archived by the owner on Jan 13, 2023. It is now read-only.

Commit 5bde653

Browse files
committed
Merge branch 'develop' of github:iotaledger/iota.lib.py into develop
2 parents dae0b7b + f344e16 commit 5bde653

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

examples/routingwrapper_pow.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# coding=utf-8
2+
"""
3+
Simple example using the RoutingWrapper to route API requests to different nodes.
4+
See: https://github.com/iotaledger/documentation/blob/iota.lib.py/1.2.x/source/includes/_adapters.md#routingwrapper
5+
"""
6+
from iota import *
7+
from iota.adapter.wrappers import RoutingWrapper
8+
9+
api =\
10+
Iota(
11+
# Send PoW requests to local node.
12+
# All other requests go to light wallet node.
13+
RoutingWrapper('http://service.iotasupport.com:14265')
14+
.add_route('attachToTangle', 'http://localhost:14265'),
15+
16+
# Seed used for cryptographic functions.
17+
seed = b'SEED9GOES9HERE'
18+
)
19+
20+
# Example of sending a transfer using the adapter.
21+
bundle = api.send_transfer(
22+
depth = 100,
23+
transfers = [
24+
ProposedTransaction(
25+
# Recipient of the transfer.
26+
address =
27+
Address(
28+
#b'TESTVALUE9DONTUSEINPRODUCTION99999FBFFTG'
29+
#b'QFWEHEL9KCAFXBJBXGE9HID9XCOHFIDABHDG9AHDR'
30+
),
31+
32+
# Amount of IOTA to transfer.
33+
# This value may be zero.
34+
value = 1,
35+
36+
# Optional tag to attach to the transfer.
37+
tag = Tag(b'ADAPT'),
38+
39+
# Optional message to include with the transfer.
40+
message = TryteString.from_string('Hello!'),
41+
),
42+
],
43+
)

0 commit comments

Comments
 (0)