plata-sdk 0.2.0__py3-none-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
plata_sdk/__init__.py ADDED
@@ -0,0 +1,58 @@
1
+ """Plata for programs and AI agents.
2
+
3
+ import plata_sdk as plata
4
+ with plata.devnet("devnet") as net: # or plata.connect("network")
5
+ me = net.wallet("agent.wallet")
6
+ net.faucet(me.address, "10")
7
+ p = me.pay("plata1...", "0.05")
8
+ p.wait_final() # about 2 s
9
+
10
+ Post-quantum (Falcon-1024 keys made on this computer, no sign-up), private
11
+ (the real network only through Tor, built in), and a payment is never sent
12
+ twice, even after a crash. Every call runs the same Rust code as the Plata
13
+ app, in the ``plata-wallet engine`` process.
14
+ """
15
+
16
+ from .client import (
17
+ Balance,
18
+ Final,
19
+ Invoice,
20
+ Network,
21
+ Order,
22
+ OrderState,
23
+ Payment,
24
+ Record,
25
+ Shop,
26
+ Sweep,
27
+ Wallet,
28
+ connect,
29
+ devnet,
30
+ )
31
+ from .errors import (
32
+ BadAddress,
33
+ BadAmount,
34
+ BadCall,
35
+ EngineStopped,
36
+ Expired,
37
+ NetworkError,
38
+ NotConnected,
39
+ NotEnough,
40
+ NotFinalYet,
41
+ OrderError,
42
+ PlataError,
43
+ Replaced,
44
+ TooManyPending,
45
+ WalletError,
46
+ )
47
+
48
+ ORDER_HEADER = "Plata-Order"
49
+ """The header a caller sends the order id back in, after paying."""
50
+
51
+ __version__ = "0.2.0"
52
+
53
+ __all__ = [
54
+ "Balance", "Final", "Invoice", "Network", "Order", "OrderState", "Payment", "Record", "Shop", "Sweep",
55
+ "Wallet", "connect", "devnet", "ORDER_HEADER",
56
+ "BadAddress", "BadAmount", "BadCall", "EngineStopped", "Expired", "NetworkError", "NotConnected",
57
+ "NotEnough", "NotFinalYet", "OrderError", "PlataError", "Replaced", "TooManyPending", "WalletError",
58
+ ]
plata_sdk/_engine.py ADDED
@@ -0,0 +1,142 @@
1
+ """The engine: ``plata-wallet engine``, the Rust core, in a process of its
2
+ own. Calls go as JSON lines on its input, answers come back on its output,
3
+ in any order; several threads may call at once."""
4
+
5
+ import json
6
+ import os
7
+ import shutil
8
+ import subprocess
9
+ import threading
10
+ from collections import deque
11
+
12
+ from .errors import EngineStopped, from_engine
13
+
14
+ PROTOCOL = 1
15
+
16
+
17
+ def program(name):
18
+ """A program's file name on this system."""
19
+ return name + ".exe" if os.name == "nt" else name
20
+
21
+
22
+ def find_engine(path=None):
23
+ """The ``plata-wallet`` program: ``path``, else ``$PLATA_ENGINE``, else
24
+ the one shipped inside this package (``plata_sdk/bin``), else on
25
+ ``PATH``."""
26
+ here = os.path.join(os.path.dirname(__file__), "bin", program("plata-wallet"))
27
+ for candidate in (path, os.environ.get("PLATA_ENGINE"), here):
28
+ if candidate and os.path.isfile(candidate) and os.access(candidate, os.X_OK):
29
+ return candidate
30
+ found = shutil.which("plata-wallet")
31
+ if found:
32
+ return found
33
+ raise EngineStopped(
34
+ "plata-wallet not found: set PLATA_ENGINE to its path, or put it on PATH "
35
+ "(the SDK's download holds it)"
36
+ )
37
+
38
+
39
+ class Engine:
40
+ def __init__(self, path=None):
41
+ self._proc = subprocess.Popen(
42
+ [find_engine(path), "engine"],
43
+ stdin=subprocess.PIPE,
44
+ stdout=subprocess.PIPE,
45
+ stderr=subprocess.PIPE,
46
+ text=True,
47
+ encoding="utf-8",
48
+ bufsize=1,
49
+ )
50
+ self._lock = threading.Lock()
51
+ self._next = 0
52
+ self._waiting = {}
53
+ self._said = deque(maxlen=20)
54
+ self._closed = False
55
+ hello = self._proc.stdout.readline()
56
+ try:
57
+ hello = json.loads(hello)
58
+ except ValueError:
59
+ self._proc.kill()
60
+ raise EngineStopped("the engine did not start: " + (hello or self._last_words()))
61
+ if hello.get("engine") != "plata" or hello.get("protocol") != PROTOCOL:
62
+ self._proc.kill()
63
+ raise EngineStopped(
64
+ "this plata-wallet speaks protocol %r, this package %d: use matching versions"
65
+ % (hello.get("protocol"), PROTOCOL)
66
+ )
67
+ self.version = hello.get("version")
68
+ threading.Thread(target=self._read, name="plata-engine", daemon=True).start()
69
+ threading.Thread(target=self._drain, name="plata-engine-err", daemon=True).start()
70
+
71
+ def call(self, name, **args):
72
+ """Calls the engine and waits for its answer (raises its error)."""
73
+ done = threading.Event()
74
+ slot = [done, None]
75
+ with self._lock:
76
+ if self._closed:
77
+ raise EngineStopped("the engine is closed")
78
+ self._next += 1
79
+ ident = self._next
80
+ self._waiting[ident] = slot
81
+ try:
82
+ self._proc.stdin.write(json.dumps({"id": ident, "call": name, "args": args}) + "\n")
83
+ self._proc.stdin.flush()
84
+ except (BrokenPipeError, OSError):
85
+ self._waiting.pop(ident, None)
86
+ raise EngineStopped("the engine stopped: " + self._last_words())
87
+ done.wait()
88
+ reply = slot[1]
89
+ if "error" in reply:
90
+ err = reply["error"]
91
+ if err.get("kind") == "engine_stopped":
92
+ raise EngineStopped(err.get("message", "the engine stopped"))
93
+ raise from_engine(err)
94
+ return reply.get("ok")
95
+
96
+ def close(self):
97
+ """Stops the engine (and the devnet it runs: its partners save first)."""
98
+ with self._lock:
99
+ if self._closed:
100
+ return
101
+ self._closed = True
102
+ try:
103
+ self._proc.stdin.close()
104
+ except OSError:
105
+ pass
106
+ try:
107
+ self._proc.wait(timeout=60)
108
+ except subprocess.TimeoutExpired:
109
+ self._proc.kill()
110
+ self._proc.wait()
111
+ for pipe in (self._proc.stdout, self._proc.stderr):
112
+ try:
113
+ pipe.close()
114
+ except (OSError, ValueError):
115
+ pass
116
+
117
+ def _read(self):
118
+ for line in self._proc.stdout:
119
+ try:
120
+ msg = json.loads(line)
121
+ except ValueError:
122
+ continue
123
+ with self._lock:
124
+ slot = self._waiting.pop(msg.get("id"), None)
125
+ if slot is not None:
126
+ slot[1] = msg
127
+ slot[0].set()
128
+ # The engine is gone: every call still waiting gets told why.
129
+ stopped = {"error": {"kind": "engine_stopped", "message": "the engine stopped: " + self._last_words()}}
130
+ with self._lock:
131
+ self._closed = True
132
+ waiting, self._waiting = self._waiting, {}
133
+ for slot in waiting.values():
134
+ slot[1] = stopped
135
+ slot[0].set()
136
+
137
+ def _drain(self):
138
+ for line in self._proc.stderr:
139
+ self._said.append(line.rstrip())
140
+
141
+ def _last_words(self):
142
+ return " | ".join(self._said) or "no message"
plata_sdk/_launch.py ADDED
@@ -0,0 +1,52 @@
1
+ """The commands ``plata-wallet`` and ``plata-mcp`` of an installed package:
2
+ each starts the ready-made program inside it. With no ``--network`` and no
3
+ ``PLATA_NETWORK`` the live network is used, from a folder of its own in the
4
+ user's home (``~/.plata/network``): the private connection keeps its state
5
+ there, so it survives updates."""
6
+
7
+ import filecmp
8
+ import os
9
+ import shutil
10
+ import subprocess
11
+ import sys
12
+
13
+ from ._engine import program
14
+
15
+ _HERE = os.path.dirname(__file__)
16
+
17
+
18
+ def live_network():
19
+ """The live network's folder in the user's home, with this version's
20
+ two files."""
21
+ folder = os.path.join(os.path.expanduser("~"), ".plata", "network")
22
+ os.makedirs(folder, exist_ok=True)
23
+ for name in ("genesis.json", "relays.txt"):
24
+ src, dst = os.path.join(_HERE, "network", name), os.path.join(folder, name)
25
+ if not os.path.exists(dst) or not filecmp.cmp(src, dst, shallow=False):
26
+ shutil.copyfile(src, dst)
27
+ return folder
28
+
29
+
30
+ def run(name):
31
+ path = os.path.join(_HERE, "bin", program(name))
32
+ if not os.path.isfile(path):
33
+ sys.exit(
34
+ f"{name}: this package holds no program for this system "
35
+ "(Linux x64 and Windows x64 today)"
36
+ )
37
+ args = sys.argv[1:]
38
+ env = dict(os.environ)
39
+ if "--network" not in args and not env.get("PLATA_NETWORK"):
40
+ env["PLATA_NETWORK"] = live_network()
41
+ try:
42
+ sys.exit(subprocess.call([path, *args], env=env))
43
+ except KeyboardInterrupt:
44
+ sys.exit(130)
45
+
46
+
47
+ def wallet():
48
+ run("plata-wallet")
49
+
50
+
51
+ def mcp():
52
+ run("plata-mcp")
plata_sdk/asgi.py ADDED
@@ -0,0 +1,65 @@
1
+ """Pay to use for ASGI apps (FastAPI, Starlette, ...):
2
+
3
+ from plata_sdk.asgi import PayToUse
4
+ app = PayToUse(app, shop, price="0.05")
5
+
6
+ ``price``: an amount, or a function of the request's ``scope`` giving an
7
+ amount, or None for free requests. A served request finds its order id in
8
+ ``scope["plata.order"]``. Shop calls run on a worker thread, never on the
9
+ event loop.
10
+
11
+ ``invoices_per_minute``: new invoices one visitor may ask a minute (10;
12
+ None for no limit); past it the answer is 429. ``visitor``: a function of
13
+ ``scope`` naming the visitor (its address by default: behind a proxy, give
14
+ the header your proxy sets).
15
+ """
16
+
17
+ import asyncio
18
+ import json
19
+
20
+ from .errors import NotConnected
21
+ from .paywall import Visitors, decide
22
+
23
+
24
+ def _client(scope):
25
+ client = scope.get("client")
26
+ return client[0] if client else ""
27
+
28
+
29
+ class PayToUse:
30
+ def __init__(self, app, shop, price, valid_for=600, invoices_per_minute=10, visitor=None):
31
+ self.app = app
32
+ self.shop = shop
33
+ self.price = price
34
+ self.valid_for = valid_for
35
+ self.visitors = Visitors(invoices_per_minute) if invoices_per_minute else None
36
+ self.visitor = visitor or _client
37
+
38
+ async def __call__(self, scope, receive, send):
39
+ if scope.get("type") != "http":
40
+ return await self.app(scope, receive, send)
41
+ price = self.price(scope) if callable(self.price) else self.price
42
+ if price is None:
43
+ return await self.app(scope, receive, send)
44
+ order = ""
45
+ for k, v in scope.get("headers", []):
46
+ if k.decode("latin-1").lower() == "plata-order":
47
+ order = v.decode("latin-1").strip()
48
+ allow = (lambda: self.visitors.allow(self.visitor(scope))) if self.visitors else None
49
+ try:
50
+ answer = await asyncio.to_thread(decide, self.shop, price, order, self.valid_for, allow)
51
+ except NotConnected as e:
52
+ return await _json(send, 503, {"error": e.message}, [(b"retry-after", b"5")])
53
+ if answer is None:
54
+ scope["plata.order"] = order
55
+ return await self.app(scope, receive, send)
56
+ status, body = answer
57
+ extra = [(b"retry-after", str(body["retry_after"]).encode())] if "retry_after" in body else []
58
+ return await _json(send, status, body, extra)
59
+
60
+
61
+ async def _json(send, status, body, extra=()):
62
+ data = json.dumps(body).encode()
63
+ headers = [(b"content-type", b"application/json"), (b"content-length", str(len(data)).encode())] + list(extra)
64
+ await send({"type": "http.response.start", "status": status, "headers": headers})
65
+ await send({"type": "http.response.body", "body": data})
Binary file
Binary file
plata_sdk/client.py ADDED
@@ -0,0 +1,352 @@
1
+ """Plata in Python: a network, wallets on it, payments, and a shop.
2
+
3
+ Every call blocks until done and is safe from several threads at once.
4
+ Amounts are ``Decimal`` (1 PLATA = 1,000,000 units); pass them as ``str``,
5
+ ``int`` or ``Decimal`` ("0.05"), never rounded floating point.
6
+ """
7
+
8
+ import json
9
+ import time
10
+ from dataclasses import dataclass, field
11
+ from decimal import Decimal, InvalidOperation
12
+
13
+ from ._engine import Engine
14
+ from .errors import BadAmount
15
+
16
+
17
+ def _amount(value):
18
+ """An amount as the engine reads it: text with a dot, up to 6 decimals."""
19
+ if isinstance(value, bool):
20
+ raise BadAmount("Amount not valid: %r is not an amount." % (value,))
21
+ if isinstance(value, float):
22
+ # A float's shortest exact text ("0.05"), never its binary noise.
23
+ value = Decimal(repr(value))
24
+ if isinstance(value, int):
25
+ return str(value)
26
+ if isinstance(value, Decimal):
27
+ if not value.is_finite():
28
+ raise BadAmount("Amount not valid: %s." % value)
29
+ return format(value.normalize(), "f")
30
+ if isinstance(value, str):
31
+ return value.strip()
32
+ raise BadAmount("Amount not valid: %r is not an amount." % (value,))
33
+
34
+
35
+ def _dec(text):
36
+ try:
37
+ return Decimal(text)
38
+ except (InvalidOperation, TypeError):
39
+ return Decimal(0)
40
+
41
+
42
+ def _ms(seconds):
43
+ return None if seconds is None else int(round(seconds * 1000))
44
+
45
+
46
+ @dataclass(frozen=True)
47
+ class Balance:
48
+ """What a wallet holds: ``amount`` as the network says, ``on_its_way``
49
+ (its payments not final yet, with fees), ``spendable`` (what can still be
50
+ paid), ``nonce`` (payments made so far), ``block`` (newest final block)."""
51
+
52
+ amount: Decimal
53
+ on_its_way: Decimal
54
+ spendable: Decimal
55
+ nonce: int
56
+ block: int
57
+
58
+
59
+ @dataclass(frozen=True)
60
+ class Final:
61
+ """A payment the network made final: in ``block``, ``waited_ms`` after the call."""
62
+
63
+ block: int
64
+ waited_ms: int
65
+
66
+
67
+ @dataclass(frozen=True)
68
+ class Record:
69
+ """One line of a wallet's last 30 days."""
70
+
71
+ block: int
72
+ received: bool
73
+ other: str
74
+ amount: Decimal
75
+ fee: Decimal
76
+ id: str
77
+
78
+
79
+ @dataclass(frozen=True)
80
+ class Invoice:
81
+ """What a shop asks for: ``amount`` to ``pay`` (an address made for this
82
+ order alone), ``order`` (a secret id, given back once paid), payable
83
+ until ``valid_until_ms`` (ms since 1970). Its JSON is the body of a
84
+ "402 Payment Required" answer."""
85
+
86
+ pay: str
87
+ amount: Decimal
88
+ order: str
89
+ valid_until_ms: int
90
+
91
+ def to_dict(self):
92
+ return {"pay": self.pay, "amount": _amount(self.amount), "order": self.order, "valid_until_ms": self.valid_until_ms}
93
+
94
+ def to_json(self):
95
+ return json.dumps(self.to_dict())
96
+
97
+ @staticmethod
98
+ def from_dict(d):
99
+ return Invoice(d["pay"], _dec(d["amount"]), d["order"], int(d["valid_until_ms"]))
100
+
101
+ @staticmethod
102
+ def from_json(text):
103
+ return Invoice.from_dict(json.loads(text))
104
+
105
+ def expired(self, now_ms=None):
106
+ return (time.time() * 1000 if now_ms is None else now_ms) > self.valid_until_ms
107
+
108
+
109
+ @dataclass(frozen=True)
110
+ class OrderState:
111
+ """Where an order stands: ``state`` is "waiting", "paid", "served" or
112
+ "expired"; ``received`` what its address got (paid ones count once moved
113
+ home too)."""
114
+
115
+ state: str
116
+ received: Decimal
117
+
118
+ @property
119
+ def paid(self):
120
+ return self.state == "paid"
121
+
122
+
123
+ @dataclass(frozen=True)
124
+ class Order:
125
+ order: str
126
+ pay: str
127
+ amount: Decimal
128
+ created_ms: int
129
+ valid_until_ms: int
130
+ paid: bool
131
+ served: bool
132
+ moved: Decimal
133
+
134
+
135
+ @dataclass(frozen=True)
136
+ class Sweep:
137
+ """What a sweep did: moves sent now or still on their way, and what
138
+ arrived in the main wallet during it (after fees)."""
139
+
140
+ on_their_way: int
141
+ arrived: Decimal
142
+
143
+
144
+ @dataclass(frozen=True)
145
+ class Payment:
146
+ """A payment this wallet signed and saved: on its way until final.
147
+ ``nonce`` is its place among the wallet's payments; ``id`` its id on the
148
+ network; ``sent`` whether the first sending went out (if not, the next
149
+ call that reaches the network sends it, the same bytes)."""
150
+
151
+ nonce: int
152
+ to: str
153
+ amount: Decimal
154
+ fee: Decimal
155
+ id: str
156
+ sent: bool
157
+ _raw: dict = field(repr=False, compare=False)
158
+ _wallet: "Wallet" = field(repr=False, compare=False)
159
+
160
+ def wait_final(self, timeout=60):
161
+ """Waits until final (about 2 s); ``NotFinalYet`` after ``timeout``
162
+ seconds: wait again, never pay again."""
163
+ return self._wallet.wait_final(self, timeout)
164
+
165
+
166
+ class Wallet:
167
+ """A wallet file on a network. Open it with ``Network.wallet``."""
168
+
169
+ def __init__(self, network, path, address):
170
+ self.network = network
171
+ self.path = path
172
+ self.address = address
173
+
174
+ def __repr__(self):
175
+ return "Wallet(%r, %s)" % (self.path, self.address)
176
+
177
+ def _call(self, name, **args):
178
+ return self.network._engine.call(name, wallet=self.path, **args)
179
+
180
+ def balance(self):
181
+ b = self._call("wallet.balance")
182
+ return Balance(_dec(b["amount"]), _dec(b["on_its_way"]), _dec(b["spendable"]), b["nonce"], b["block"])
183
+
184
+ def pay(self, to, amount):
185
+ """Pays ``amount`` to ``to`` (a ``plata1...`` address or a ``plata:``
186
+ request). Returns once signed, saved and sent; ``wait_final`` tells
187
+ when it is final."""
188
+ return self._payment(self._call("wallet.pay", to=to, amount=_amount(amount)))
189
+
190
+ def pay_invoice(self, invoice):
191
+ """Pays a shop's invoice (an ``Invoice``, its dict or its JSON);
192
+ refused once it has expired (``Expired``). Give the shop the
193
+ invoice's ``order`` back once the payment is final."""
194
+ if isinstance(invoice, str):
195
+ invoice = json.loads(invoice)
196
+ if isinstance(invoice, Invoice):
197
+ invoice = invoice.to_dict()
198
+ invoice = {k: invoice[k] for k in ("pay", "amount", "order", "valid_until_ms")}
199
+ invoice["amount"] = _amount(invoice["amount"])
200
+ return self._payment(self._call("wallet.pay_invoice", invoice=invoice))
201
+
202
+ def wait_final(self, payment, timeout=60):
203
+ f = self._call("wallet.wait_final", payment=payment._raw, timeout_ms=_ms(timeout))
204
+ return Final(f["block"], f["waited_ms"])
205
+
206
+ def wait_received(self, amount, timeout=60):
207
+ """Waits until this wallet received at least ``amount`` since the
208
+ call; returns how much."""
209
+ return _dec(self._call("wallet.wait_received", amount=_amount(amount), timeout_ms=_ms(timeout))["received"])
210
+
211
+ def history(self, limit=50):
212
+ """The last 30 days, newest first."""
213
+ return [
214
+ Record(r["block"], r["received"], r["other"], _dec(r["amount"]), _dec(r["fee"]), r["id"])
215
+ for r in self._call("wallet.history", limit=limit)
216
+ ]
217
+
218
+ def on_its_way(self):
219
+ """Payments signed and not yet final, oldest first."""
220
+ return [self._payment(p) for p in self._call("wallet.on_its_way")]
221
+
222
+ def request(self, amount):
223
+ """A ``plata:`` payment request for this wallet."""
224
+ return self._call("wallet.request", amount=_amount(amount))["request"]
225
+
226
+ def words(self):
227
+ """The 24 secret words that make this wallet again. Keep them secret."""
228
+ return self._call("wallet.words")["words"]
229
+
230
+ def shop(self):
231
+ """Selling with this wallet: invoices, checks, moving takings home."""
232
+ return Shop(self)
233
+
234
+ def _payment(self, p):
235
+ return Payment(p["nonce"], p["to"], _dec(p["amount"]), _dec(p["fee"]), p["id"], p["sent"], p, self)
236
+
237
+
238
+ class Shop:
239
+ """"Pay to use": each order gets an address of its own (made from the
240
+ wallet's 24 words) and a secret order id; a paid order is served once.
241
+ ``plata_sdk.wsgi`` and ``plata_sdk.asgi`` put this in front of a web app."""
242
+
243
+ def __init__(self, wallet):
244
+ self.wallet = wallet
245
+
246
+ def invoice(self, amount, valid_for=600):
247
+ """A new order for ``amount``, payable for ``valid_for`` seconds."""
248
+ return Invoice.from_dict(self.wallet._call("shop.invoice", amount=_amount(amount), valid_for_ms=_ms(valid_for)))
249
+
250
+ def invoice_for(self, order):
251
+ """The invoice of an order made earlier, or None if unknown here."""
252
+ d = self.wallet._call("shop.invoice_for", order=order)
253
+ return None if d is None else Invoice.from_dict(d)
254
+
255
+ def check(self, order):
256
+ """Where an order stands, asked of the network (final payments only)."""
257
+ s = self.wallet._call("shop.check", order=order)
258
+ return OrderState(s["state"], _dec(s.get("received", "0")))
259
+
260
+ def redeem(self, order):
261
+ """Marks a paid order served: once, never twice, even from several
262
+ threads; ``OrderError`` if not paid in full or served already."""
263
+ self.wallet._call("shop.redeem", order=order)
264
+
265
+ def orders(self):
266
+ return [
267
+ Order(o["order"], o["pay"], _dec(o["amount"]), o["created_ms"], o["valid_until_ms"], o["paid"], o["served"], _dec(o["moved"]))
268
+ for o in self.wallet._call("shop.orders")
269
+ ]
270
+
271
+ def sweep(self):
272
+ """Moves what the order addresses hold to the main wallet (one fee
273
+ each); call again to finish moves on their way. Never sends twice."""
274
+ s = self.wallet._call("shop.sweep")
275
+ return Sweep(s["on_their_way"], _dec(s["arrived"]))
276
+
277
+
278
+ class Network:
279
+ """One network, and the engine that reaches it. Use ``plata_sdk.devnet`` or
280
+ ``plata_sdk.connect``; close it (or use ``with``) to stop the engine."""
281
+
282
+ def __init__(self, info, engine):
283
+ self._engine = engine
284
+ self.dir = info["dir"]
285
+ self.chain_id = info["chain_id"]
286
+ self.fee = _dec(info["fee"])
287
+ self.is_devnet = info["devnet"]
288
+
289
+ def __repr__(self):
290
+ return "Network(%r%s)" % (self.dir, ", devnet" if self.is_devnet else "")
291
+
292
+ def __enter__(self):
293
+ return self
294
+
295
+ def __exit__(self, *_):
296
+ self.close()
297
+
298
+ def close(self):
299
+ """Stops the engine, and the devnet if it runs one."""
300
+ self._engine.close()
301
+
302
+ def wallet(self, path):
303
+ """The wallet at ``path``, made first if there is none."""
304
+ return self._open("wallet.open_or_create", path=str(path))
305
+
306
+ def create_wallet(self, path):
307
+ """A new wallet at ``path`` (``WalletError`` if a file is there)."""
308
+ return self._open("wallet.create", path=str(path))
309
+
310
+ def open_wallet(self, path):
311
+ return self._open("wallet.open", path=str(path))
312
+
313
+ def restore_wallet(self, path, words):
314
+ """The wallet made again from its 24 words, saved at ``path``."""
315
+ return self._open("wallet.restore", path=str(path), words=words)
316
+
317
+ def faucet(self, to, amount, timeout=60):
318
+ """Devnet only: test PLATA from the devnet's test wallet, final when
319
+ this returns."""
320
+ r = self._engine.call("faucet", to=to, amount=_amount(amount), timeout_ms=_ms(timeout))
321
+ return Final(r["final"]["block"], r["final"]["waited_ms"])
322
+
323
+ def private_connection(self):
324
+ """Where the private connection stands: "not started", "starting: 40%", "ready"."""
325
+ return self._engine.call("private_connection")["status"]
326
+
327
+ def _open(self, call, **args):
328
+ w = self._engine.call(call, **args)
329
+ return Wallet(self, w["path"], w["address"])
330
+
331
+
332
+ def _start(call, dir, engine):
333
+ e = Engine(engine)
334
+ try:
335
+ return Network(e.call(call, dir=str(dir)), e)
336
+ except BaseException:
337
+ e.close()
338
+ raise
339
+
340
+
341
+ def devnet(dir, engine=None):
342
+ """A whole Plata network on this computer, kept in ``dir``: four
343
+ partners and a test wallet with 1,000 test PLATA (``Network.faucet``).
344
+ Test coins only; it never talks to the real network."""
345
+ return _start("devnet", dir, engine)
346
+
347
+
348
+ def connect(dir, engine=None):
349
+ """The network described in ``dir`` (``genesis.json`` and ``relays.txt``,
350
+ the two files the Plata app carries), reached through the private
351
+ connection built into the engine."""
352
+ return _start("open", dir, engine)
plata_sdk/errors.py ADDED
@@ -0,0 +1,126 @@
1
+ """What went wrong, in plain words: one exception class per kind.
2
+
3
+ Every error the engine reports carries ``kind`` (the engine's word) and a
4
+ message that says what to do. ``NotFinalYet`` is not a failure: the payment
5
+ may still go through, and it is never sent twice.
6
+ """
7
+
8
+ from decimal import Decimal
9
+
10
+
11
+ class PlataError(Exception):
12
+ """Any Plata error: ``kind`` and the plain-words message."""
13
+
14
+ kind = "plata"
15
+
16
+ def __init__(self, message, **fields):
17
+ super().__init__(message)
18
+ self.message = message
19
+ for k, v in fields.items():
20
+ setattr(self, k, v)
21
+
22
+
23
+ class NotConnected(PlataError):
24
+ """The network could not be reached; try again in a moment."""
25
+
26
+ kind = "not_connected"
27
+
28
+
29
+ class NotEnough(PlataError):
30
+ """The wallet holds less than the payment and its fee (``have``, ``need``)."""
31
+
32
+ kind = "not_enough"
33
+
34
+
35
+ class BadAddress(PlataError):
36
+ kind = "bad_address"
37
+
38
+
39
+ class BadAmount(PlataError):
40
+ kind = "bad_amount"
41
+
42
+
43
+ class WalletError(PlataError):
44
+ """The wallet file: missing, already there, or unreadable."""
45
+
46
+ kind = "wallet"
47
+
48
+
49
+ class NetworkError(PlataError):
50
+ """The network files: missing or unreadable."""
51
+
52
+ kind = "network"
53
+
54
+
55
+ class NotFinalYet(PlataError):
56
+ """Waited ``waited_ms``; the payment may still go through. Wait again,
57
+ never pay again: it is never sent twice."""
58
+
59
+ kind = "timeout"
60
+
61
+
62
+ class TooManyPending(PlataError):
63
+ """16 payments of this wallet are on their way; wait until one is final."""
64
+
65
+ kind = "too_many_pending"
66
+
67
+
68
+ class Expired(PlataError):
69
+ """An invoice past its time (``order``): nothing was paid."""
70
+
71
+ kind = "expired"
72
+
73
+
74
+ class OrderError(PlataError):
75
+ """A shop's order: unknown here, not paid in full yet, or served already."""
76
+
77
+ kind = "order"
78
+
79
+
80
+ class Replaced(PlataError):
81
+ """This payment's place (``payment``, its number in the wallet) went to
82
+ another payment: the same wallet was used elsewhere at the same moment.
83
+ This one was NOT paid. Look at the history before paying again."""
84
+
85
+ kind = "replaced"
86
+
87
+
88
+ class BadCall(PlataError):
89
+ """This package asked the engine something it does not know: a version mismatch."""
90
+
91
+ kind = "bad_call"
92
+
93
+
94
+ class EngineStopped(PlataError):
95
+ """The engine process ended (its last words are in the message)."""
96
+
97
+ kind = "engine_stopped"
98
+
99
+
100
+ _KINDS = {
101
+ c.kind: c
102
+ for c in (
103
+ NotConnected,
104
+ NotEnough,
105
+ BadAddress,
106
+ BadAmount,
107
+ WalletError,
108
+ NetworkError,
109
+ NotFinalYet,
110
+ TooManyPending,
111
+ Expired,
112
+ OrderError,
113
+ Replaced,
114
+ BadCall,
115
+ )
116
+ }
117
+
118
+
119
+ def from_engine(err):
120
+ """The exception for an engine's ``{"kind", "message", ...}``."""
121
+ fields = {k: v for k, v in err.items() if k not in ("kind", "message")}
122
+ for k in ("have", "need"):
123
+ if k in fields:
124
+ fields[k] = Decimal(fields[k])
125
+ cls = _KINDS.get(err.get("kind"), PlataError)
126
+ return cls(err.get("message", "unknown error"), **fields)
@@ -0,0 +1,79 @@
1
+ {
2
+ "chain_id": 1347833678,
3
+ "genesis_seed": "02cfad214be652b92af6d4e5930f42a145cd67c7fc95d99b47b3f8c5a712e6e4",
4
+ "seats": [
5
+ {
6
+ "seat": 0,
7
+ "weight": 1000,
8
+ "public_key": "0a6f663b9b9421537ac558e9cca6229c2c58a8dc6704466a31e475c8ed653deebbd1a68db7126e500695aab990ff6117665fb706dc18bf80dd5b6ef150680d9224ea7d05d223b1a24aca844ad8b73c2d4113fb8f135ed502c81d270519fa9d09496acd0f55f50abe5787793a297a3f84738a95a4448b901309f9bf825981d477040b715f91c7004db920311cb789f9ad11e9c09a9cec97e8f32c70a14d3799ca4e28163d227ad455d24d70e392e55a7382a5a620fb16080de18d23996df82bf8e5f6b804e13340ddcbc2eb9b2f2a153872dcb715563dcb1b80c5703c5d2024ea416d4da4978ce79b441d37b6eb2fe609a4256533455b47a570ab1a9e626f74aa67259603b4f516e8224487bed5028a379af932dc7729e5a30d65408d1b5f90bf53f215509d90761b79864a50156048c814b376c4f7af1c94e9bc2245b8dd7e01898ec41faa7754ab51fea0e81f36849394b598c1802a4b2c856870c995e9a34a149342b1acc38029ec2786673e9499a48019cae8111c6bc1fa53155512c157662de122d025706e59ea3086cbd1b7937e13f48163bfef2194792ad0fe54288e95edc0a9c3024d127233ec66d9330d6bb33acee4b208c3ea002b452c6dbf34bb49b15a80bdb721922b88d275e774a8059aa47343b21e398a2603aaf100545e6d0235f59b5f7de068139a6daf7ddd05e577592ab5601308655e6098e802e68095fe83dadf191ed1138ee92b556edb7620de4d33cdec67370c5395b40ca86bc8e4f5bda5e6b52def705261ed776224a7a9e192697e7e770b667d271e9f181ad9e378c14b468281a50226cb54a2ac999c397f760fce79495db522b7a8637de6dd05925755ad889bd9ecac9417fdfdfa08e878686a875b9ec5cb97bc4ec62e597fa3f6767898258373e0b3da47a1835226c04b31a793a14e0b016f4332757eb677b4e5e99162c586bfd1ee995241689ea884a7e27198bcd8d35b9ee0325b49618e397ac6b90e44951d129a17633c96de78e54f12392e5e4c10cecd88b02823eb8a40b13ed85556c9989d80608789575ca611e924e11296cb8895872147a8c95ce850354e071e9b0417da5e6345b7dc3455bd098807e09222f4e65926742e179398066de0b8b35ac7a58b04acb871d0512a067092c1e5b3bc62ca64ef8b19a811e0088840680c19b107ce9ea63b583f3832420f913d8ea54d5f2a03baf94190adc502aee79859814b1b8dd2b92354cf09a49288ba6a5270b270db00adaea31a11a65b11e225708c36405080930044ba1ae5452e791ec57acece0d9e05a68ec3dd88f0efebf82a3b06befb623904e3041c2fc3aa9f24abba91228bdac33bb0dd020ecd51695dc9265e47cb0d5d3882ee92f715a40b080608d66619620b9f17b077682824b96ca95a84fe790cede4439e8389e92f590300218a5cd7441f249a2088d7051a084ac0e86f138f2aacb684116683609ef4351111613d6dfa7c449339c1e4b154547900f5984b8759a794721ccb69841413a23bc9910a5100be7b5491d94c9dd070cb194da201163fc04bc7b94e1a6b6a68dca56dea1cc980c50e9fd5f9b80643484b7c5f937f863d6074adb06928ba504e471b5d5a3e811156119691471e6e0d66c7db366b6466d89c13c0378d5fb8af094659614b6309287b86f842972f2d4c9890a1058b88935aaa8bf132dd1f9b32928b1c18c2980c2f732e1339748c0aa700a509aecc0a7bccc1e443cd455a83959408181ea554c9a7b198895a998106a4997f49c2d906147e4b2150923c75a2beea54ea7719ae1e70f32baca1c8d5906f0bdb021029f0c818b7617cb3d8bb267093c6e82bcd97e99cb6e4cafe05d8b736d7fb2c99a163c013ebfaa3561a9032a6f99b199200cdd549a2e7803a1539471a18517549135f1873b8850e517e91fb0824055188138c59bcafd3e910ea4b76b76b7a040100366b32c88eaf8d3d09027a6e5cbade8373bdc74d587a1469710d98b7104d6b71a46a152d6342f9500b2ebc90f15d56242f46e4c7fd9cda826c2d76a909b200050614afab1d10ad4eb31f4d3c5081aadad791b74f117163539458731cb5c9fbedcd3a85ed16dbe073a0a5cde26d078859caac45acec9b3ea6c2d31c05038d86687ac2e29db0a2d8b1cdc18326dd2866086e5e9018e1c1acc2cd21deb571a8193b4396926131e36814d971f4921eed2a2cff9707a2313bc9a0618d2438bd824e2a89ce50393053547c54c1b39555e7932c6470b8f652b956a07f4286d70e9a3243f5c2d4d9aca74d8925ab52d941171dc9593015284d06eef507c7b0955a5021e1244954a2c992ee218490b27578ce28cd858d84820827705f55ddbb20e0611ec48218682c939acc9717742be22bb1a299c5aae283ade391f7095527fd63c4a9ae249ae80e366b024ca4f4e11675ef2076366e0aa51ba76934f5a061240b79a20d92f60a8d5d5ccd33b8a32a5b2837b110675b91e83e9b25cb369368f82b12a1cabef0a4a85bae03b54a1f4a3025096ee26456900f2bb6d5ea817b2f05",
9
+ "ticket_root": "8f255b05ec3e22808c73bf81fa5b1be562484e1ebf8faa80e5b624dd10e655c4",
10
+ "ticket_first_epoch": 0,
11
+ "ticket_bits": 17,
12
+ "reward_account": "4ed2de2fd9d55a5398747567b05f370c5a6c7ec36c651fb98f318f6f317945f9"
13
+ },
14
+ {
15
+ "seat": 1,
16
+ "weight": 1000,
17
+ "public_key": "0a17917b4693e5faba8448552185deb6f4dc0909672a091e214253d5b9a398c768fd9b6b2fdad16578d1bab6fa5cb7db98991082a8e5c08d7c879d74d1bba8d8343578051a1f0e0e48aa76a3ee948ad83d782f99bea6aec605f88a0b666893d746dcf51651b734b46e923932de70a125679d4ea46353e65c6db654167e28cb4812adb9e66e95b82e0f8088a21ab64e1f7b456b3bb5bac7b004e2acbf11a0fa0e4b6b9e507480fb0d2d44a8e7cbc38b4403bc46e98502e14a8a40a23ad42a3c0186f2d8d88b6ab83c72c013310fb0a435146ce58a82265276a673abe00ec786513d0e687b73751a4010f13848688f494c69c0f497046b59ac51501885dd95ea02e862e28e7ea9172405e2e925ad24f94ec74882e4c4f2176611b5e88ca197e99aba040ec3d6c60eaa7a5a558587d07901484ba41dcf8d696a580da73e201c3468015a0e29d2ed95334e4606ce85d21e52fb7530dcaa8c1acf92b0cfa55b09ab0f193ef786e96748c95002326f6e19b60582d12e4abda1bdb8e88e4f3f8a3eb2fa0497396e520417e4712e5c4cd7e5a62687960c5a58295f6cad6cb11189378ea9a805fc5bf343f5392271eb57bf9043c2fea3d5084c4547ceef3e25656f480fc9036d9e117418a79f5fb5497abc0a9507c4e6269c4d7e6f821a761590a340fde57040c3e70bbc8762ae8a5f28deca313aaebf11a4cea70f2d470d728022dc857a44cc9d455f19d625dacce5f78ec66f25038476498640882d16421c10a201e3486389cc46540857561b2011740cd83a645553a55f84416e614524a91b16201c6522d8e438de42b795ce9623e7e53b45c1368767542b953e1337ea1ba90cb2e18f560e67424dc47e4559171aa5ead4062b29e514a816272a327234fb008be10bb252963226af001a5644225eceb05d8b2bd725e54669f47083cd39bfa117533c5ce61b067107f12f2f28fa34c6b2ad87a9b04ef2bf156d41c2200b1617498325409b08a216b79a8335cb24d924aa95270e4d5f0176949a26eb3b1adc79d87410833879736196a5732020cc92dcce148462fac300e68f75a66eb45a193869e4237510024242caf41b93d8a143d9c414fc477910fa1596d7954a7d162462890e6d4f1445f9ea6ec65605b156df114a413245b8ed495bb72eaf762c89b66ace325bf063a3aece378075dfd33c25f1f41c062cadce230426c587a9b1c18470d8ac59eca199df5cf4a67239c47ee9f338b694ca4c83c8a2515ac85252a05924ba7a1e2894a9f2adc06687178c6e68f79b1975ad05ad47d88a0a4950085500ae156f5e67562747cf3d8999c2f79ad010ec76b268422ea2e9345aee2eb17c51538b656ef74dfd785151a31c92c5569bb3cfa09edc2ab7da90fb24b15555b5c4ef1a101317a32cb3171827b2e0ae09562d9f56f163daa6b63c77dae2f6334d2a003c02a6856977fb350436b45d31a13e183f9d4cee9457e6cd9a76e472dee0ccb7aec4c9fbe7af7cc81c6a8e51521a06e5f5c118568d8cbe04f52cb773fa49d80e402aab8a1bb3a3c2fe25c03538189c455e3092a1da0ab261a0362295028e4959c2928e44a319f087544947bc14022584bce37b07a4dadb0026835676e4c5189e463a6150302251e26bee77c0f216cc81b89e296060647d221f415f05adab34e577b2d2ea4d869f07ee203f16f2c8183ca19fbe6465c661cd10b518605a1a4e7bb6f2fbe2b05b0e2138e2d76d5532a1c48be21d5265be40db89d4acacbb2af0a073c4b6210cc85519cae68166a85077151f667e4dd0d693a643e2b12a2b55340f3a8292dde9bd95168df2310e15154e9797dda03079d8d5b2154ebd2b5cbb29ec6c430c3d869b0d6e820d8271e1c99ed02718de1b075fd77908e917ba2836aff0ad61ec09142d48d087e12ea8581d45f3f89406698d317731cc4c8e7d4a58b964d2b50e07033e5166be9da34889eb3354e2ac04919dca18ace1b09eaf3ebaacb218521c7a591565d4e9539e5cd2264165c9830ea9b498c5817736a24a59d424272c6426a6a8c94aad063091a460f54db67b3aff58a9398e083b19608c93c216fa694c1344601583806d7b0c060a345ec9b399d856b6fa9fe04564a6336a2ac64edad5535e69902088d1e92de69e9dc62e1ae58d8eb75eb8db1617ed1c3c08b3d596d1a2953277a89a245c481dda6e9946872da2fb19cca2288a8a84c1e93043e4488853ee081839dab83fa203a4a65999e8408ca74e344b518530715eed7824582112a6daa9db8cc3a71d30182453e671e0d5995c9c851cec0e340fe0bf8b06c58a17673246b1a8c5616bc95f2cf2d8e85f834012f236039147b12a5853b5249faa987f984a02cd81a57da15f4ec8632ca4b9936a55205ae7023f51ab0664077bc9a5a1871d55d5c0a88b1e411e31009c441658fa513f0adfaa75965485e2f3a54d2c31dccc4210e8b0034d6b1e49cddca49387e2b9f6a8d03061212ea126c9ce602385b5bd5934ac595051a214a82b217ca579e75317d70091a3c0636a89ba8c2d82b5c01f",
18
+ "ticket_root": "e0da0ab7e83c4d1d8cec41f5d3a342d9f01e039a3f3f6a48d2e45b6362dfb7d8",
19
+ "ticket_first_epoch": 0,
20
+ "ticket_bits": 17,
21
+ "reward_account": "833e376e7548336184a4254e0cb850768bc8efe07998a12b133b95e366b817be"
22
+ },
23
+ {
24
+ "seat": 2,
25
+ "weight": 1000,
26
+ "public_key": "0aaf769b1801eb0eb0d4011b4368c832ea1c7099e1501061ea818fd60c503e82125ecc63a502e0f100a633af8ceb215987eb7d6ec916e6202a062d65c93292de31f0ab24daa8f9bb5ee5e3a9801b917e636b78eb4325e57d7c002952a3c065b35949255badcc9a61accf985e5078a692eab744e866e3afd49801ec1969e64a900a53bbc15274225685577109ce258cdab5831f2b7efc6fa1bb5e3072d1829868645f6e345429400836453237642ad8e38fde793b5caf431b7932e7eea6396808b8a64482a519ccf6b7b3ce7e5e2a7006d7a85b2df0ee726953960ac409e013e2ac6b1ee7b9cc6fff7248dee3c615103c767555c5472eab729f7552dbf709b12f9bc387a492726c33e690ee2998208219e5757c65a550af5954565a35a4ee85060c500f97ce4389b0e61905e68faa825e9119bc93f29404fd912b222e81f68b47da9c1d90f52dda59ede043aacd36830754b756cfcb13496e509e829ad71d88350e719a35ad7c61b65833e0d0e169fe70fb4fd6079fc1dc3355646e50b0dcf93c9cc67ae1e9cba21d753f42a89b099401287dc1d5195b545fc2a62ae3230e6df0aa6562637aa2f8c910b15cdba23618941f94a8830454bb231d20ad05f3ca5a53da778e03533f2e827cb843845a21051d0e20fb269efcab620d988c9ea49106c1b3fa50a1010cf2d4e9a34179dc75039d1b5a5f114ea461cfe1237abe2156635b95d004c95567ad9cec009bfe823d97802a5af5d41aa971ed3813cbbc7bc84c1934432ebe109daa5b093ba256d9b72de71c54b0c8a19fa42e014472e7b81f89a73243f68cd41a382d7ceb55ae000314dd5a9f9c752d7a9053d68920743831d1e80bc456785876c581d119257626fa04de320040ea7388913ae2c7b6f6c94d797c3f62e4e4261b0822803ceef2531570a9465b583afa859a9768fea34cdae21d5ea90460f92751ede501f1db388124dda226b07ae4e27e503c5fe1e1057bab61ccc2d56b826241aa9a6895fd3abcfe1a6eae07ba50051aedcb2590c1aa058069cab88a075aa11e97979daf284d9c4a446ab0ab0a668394c5455bbc18013a440c64ad83e845dca061476f4c606a3726301586073834782fcaada668dd17860f5ba0720fe222d04d380aa1835a008fab291844d6de200706ce91b8d883a0ba7b470fc1c220e187b730c19d0cb4419282cb9f6b2964331969aa3c12c468f3608a3e1e7d9971a6c1a72d58125fd6e72004051a40184e9089db461761c25c4e7f769785123df444566707373d780eaa57c3d56762e359d2266d8c4ad654da41cd1098d0054d92852275c2520f891fa4b801e7b398812ac8cc91916e4c1e7ec6c8a968436e64d6d943880394e14bf625e42d14215149c32f196c921b4100c7f3731edcc013a67b939601c7f4155151324dc73dc74a8521bed13122990c8cbc0a075c453a14b20ba3a0561d75dd18bf1de6a8a56709c960cf823a9486f190a76e3dfee46d4e6eb9befc92ea4da47f4ea932519b7a44a4d9627e6f7dac21b480185c2f9c653674870b547f6e4f541560acb881eb398d697586de25f80a54d4941df9a6ea29a750e2ffa16cd54ab8e93b2adfa59414d27c7135d50a2051328133614c65203236f366c091aa355adb18da587e3641919d011341ddb5724c6906e9ced50e022e395e7ac8eb5f870b901f427443c2a1d18c193b6c2ba64a84d25b82edb5e18eb384c1ce5e91f2d53f05a4b26036743d2c4e5ea9b767ee535b2c9d11d37118a39bca87273f0606b71590d9099662a4acbdf1b71940712571a5460cdc2274a1f6f6690122705f87a51bc291ed36b774965547be2fe57a51a2958e6469eb93fe82ca49966e60df0cbda359c29ae4336ca86b7fc0a9687dc6411be6905b627c11bac224332a1b242917ca8a9d0f199d874fa668db38fe8c26606ae2166e0298877a3a424ade474e11cd2a1fa9ff7c9a1197220e615ea84066b1a4a496c0bf9b3ae67008d64ff7a11d0b51fe36a4f0869870a5c361a7824d6d7549f83ee7f9bb209ad4e841734f46a0247e94d843498315a8834615d03cf46590478ace9e2b31e96fafd937169fe32b93b888ebbd82236492b67aefa0010d061e46afd9d64e886ab48456c904f4830215a57426d556525fa90772e83b3a765b2ca9de25b203c21a2b228e36cd4e1e2b0166973eaa5194c24e93a55ac5392994c9c89c479316d7531c568a8d8268f57758747bb40060ce8ced068d9c2b195fe97a443b285cda1f9eae45237117e2a3726518368afbae3e9107538bd8897e90a126018e5a7ae539795c47a13e0a6830193ba7c5800499520930e2856705c553092d16e22fcbe0371ab983a097e542ed8905c0926993ae59e765cc101eb5759776f0004d119382a162d517d9a54576cffa50ada529ec68d06af9c7ea27478315d88698182fa29e3d5ce73d0bc786a08597e6c2514df59cfb30c93272c4cb778344cc43de3634252a881e82c887ac260ea03276d7fb5f7151568ab50ee94db8e912b52bdb240154688b70e7f2",
27
+ "ticket_root": "7e486d0beedf26b4130a2982aa09831d7a921da89b608c3385761322e3c0fa3f",
28
+ "ticket_first_epoch": 0,
29
+ "ticket_bits": 17,
30
+ "reward_account": "a9b97d1bdde65674467cea9a8486a4034da666a38f0e2d7a6f421236b47398bd"
31
+ },
32
+ {
33
+ "seat": 3,
34
+ "weight": 1000,
35
+ "public_key": "0a5f9d18358a9dbcb12d1136fc82db119187ca1bde1f23424a3ba48d820f711d2afc837a5cb4da65aca6d02854c8f2510b8343f54722a921117e49e7b171d1087a9a7c5915e2e24e9e89ea8f587068d1e6c134a88609981038ab18842625e22325cca25b8da777356078706a92c675df7509d2fcf3328cec1d05259731ab8c0a05291890c7d758aec947594bebb7c089a960204e9ff20917829a185acad9447a56377bb590d183841550608a0bba10ee3366cc74b4d0222f1402279cd69f32596008228394ab599d8a421ea0a6fded6917c42760e12b55df12c72dce05491edf6b1fbe18882c40ec297ea5534c6d40bf3e69b28d1720901915fae8929326f921d0c28a819eb85507796aa491b8a3b30697639e8aa060470ee5245ebac79ec331bf54cfd0a3c1a2af7655f9ef645173f11fab4b2af69286f29838e7ee9120455bad87793f5e223596afbd7c7e69a88116f14d21fa73e1506c26c5a28a7d6a43ba00c2f474241813ad58a5645f181e09288196cf9c202d2090b0582a960478417cc10f53cce8f4aeac2193d043a2c7ca79675c916692940d1d12a21154a8a9922cef659b92480cfd3b9aa3ec34b1e571ba428eb83776a41225d8803bd4182893652617b4e1c040abc761168f53be00e31ffa7a740f96d06b5cf0417cac3863d02c92f700cc2e416a60c85333bb1e369a6206ee349dca70b065842ae8d9fbd85bcd10f94ad28441645d2eeed71653728ff2e0ebd119e26b1e32ea58e4070ef03566e1e57249e654e8a39a1772bc6bc4aee3639b96e6b3ba43ff842492a53f00ab4aee2d9bba852e583819e55e68d0ba8544c5fe9cfb96443452bcce3d0ea8cae4744c68652a0f6af081b210b93fd0f0851fb23cb927aa4207a1f221a06068885fb483a57357c2bd8866b3ff5f0386a841f2abe7e77148682a465fc12cae8bc4cfc9b75fe2c35b61aea114321952ca975d6794c0d27c0c33acd1abc9691ce79db262426853dd8c5010e20bc1dc4dc832813a62035c1490975999898ad03018a3aa066a6de5f7e142b73d45520bcfac3f5a86b3630088370a0dcc7264cbc5a574e051209b84ac79e1a0a5a0393a7efed2259e396055bafaa2cca1451838b17864a91088a7f0501e7d940ccf7bdb21958444b84b04e6e52e6e19858f28be177a1474d4e05586520bfb570c90a3585eda58d435a40445a4814fe82aad986afbd85b9d89c62698a315368de5a0f10d53385c2bea060b3eb4f60819e6d9c23bbe6d71129f960d407d59f4ca83709c1cf01d80d4bb8ed8e76e8dabb8c269011d6cbf1dfdc545540d9ea9c6020a62e3dd13a9e889f42815a4c26b49bc159e426586d588d30047a803655d0ce4192e90f5a362580c0a6a75b546f465a87569b509918a5cee15a6c6b0a2fc65aa8705719ab2c54ad46af89945d591a292eda6a45e234689716031c129c0c6c8830ac2520d42282101da941b02dd36b1c3198a4bbe5c169283d10781b3e46c98852d9b39ce7f68f0138b4dae79849093cdb449dbd5e8428c52a4d588d39bf011828297795c41403e0d014d07a598d80fd7b984db697ea39a64821515dd90ca5f9183b04dd4a1ff4a81869d48d5dfc232a41ae2c6b8caf9608cdb55a01f078bb966901622dc6d6889e1a75ba9a241f8853b42eb193cc99b6cd5cc3516f5b2b692871df85241c50e55b00e7130b16bf68fe874998deff824228e1a2063cb7bc283a652536e804684e1fb65e7b4c975d2e8c2473c12aab846ce4886785ffab89ea49f6dbd66e66a9d9ea06788f7e53f5ade60e9ca6a9d9909d0c6c5273055c509ab06af8318627aab876fbbb9a47199261d1e8d699a6728675b23527e4b80d7082ad5ca24a4e7bf5c012c8a8f6b723fbd41c0a611a14bd8cb03bcd2bb7a721764e99e264eaa7c754693b9452561190813ea42789370d151495bf64195512f94895e40aa7e1562444da7883ccb4e246a595a9d1f971fe8c6d4320cf79945f06a375f88b564eb13415ec0b2aa5c654faa8c56e038852040f812f982695606641a0001c3e5830394da96c290ab0b5db6b5403a0f2216f222e7dccff747750c590867231d8af11630103602583a90224d5b6ab4faa271ee7e9b417111cb24a595f14718fa27a8a504a6e0c58e484e705f117d6ea65ebc75032ea724a2468c5ab1af350f251d414d0b1917314ce454ca28a278511a41dafa3188a62af0d0f397699c9bf7d08687f00d6572160d9ed55444fd16770bf226121b4b1051c05549b840817c6a2d21fb80e05f6401a7a95d1f64bccd06501dd065327d07d8c9a2466ce380c6135040d0c124b9eba25080cf53d40b3e75acb8aad02b9540ae2d9af38ff54b94e4d6832117b122d0907088b304cee3c8b7d98d06ad451b3be6ab3111d051aa50b740f01483371e6e65a577d78d580e71326c956f8562706cb1f98d18634978b7288e0e6dbd199971b6d26f70d62ef6ec136a6d5a53969160105c2c60955b0fea29b63dcb7429fcbde2460324d45e55043be3ee40c5504956f64e1409",
36
+ "ticket_root": "4e124f239d0ee9181cd2aa65c62e9f007086be852e6d6ce2f8b089352a33e688",
37
+ "ticket_first_epoch": 0,
38
+ "ticket_bits": 17,
39
+ "reward_account": "e5b82955763496ad709bd9dc327cf52507f9ea549ff7f55f8ee8e03f426013ad"
40
+ }
41
+ ],
42
+ "genesis_committee": [
43
+ 0,
44
+ 1,
45
+ 2,
46
+ 3
47
+ ],
48
+ "max_committee": 100,
49
+ "epoch_slots": 120,
50
+ "balances": [],
51
+ "min_slot_ms": 2500,
52
+ "ticket_wait_ms": 2000,
53
+ "propose_wait_ms": 4000,
54
+ "min_propose_wait_ms": 500,
55
+ "slot_timeout_ms": 15000,
56
+ "expected_proposers": 3,
57
+ "min_fee": 1000,
58
+ "max_payments_per_block": 1000,
59
+ "seat_rules": {
60
+ "bond": 10000000,
61
+ "vouches_required": 3,
62
+ "vouch_quota_per_year": 5,
63
+ "year_epochs": 52560,
64
+ "maturity_epochs": 8640,
65
+ "senior_epochs": 105120,
66
+ "ramp_epochs": 12960,
67
+ "unbond_epochs": 0,
68
+ "start_weight": 100,
69
+ "candidate_expiry_epochs": 1008,
70
+ "free_joins_per_epoch": 20
71
+ },
72
+ "keep_blocks": 1000,
73
+ "snapshot_chunk": 262144,
74
+ "dev_fund": {
75
+ "address": "plata1kqrwj9dcvzqha8r6vukmrh757xqqe02yk394yh5ahhpf2dmh500s9g83e7",
76
+ "share_bps": 1000
77
+ },
78
+ "release_key": "0a3409e2256b0076b4a658ab258bd08ad297e15141d956c9b7ba58231b59f545b989ae8e03042394ad476d39b60ba479a652afa6bb630a29bb086151f8fad6a29b0866a9e254400bfe8167e1a657638038f0b30a419654b12bf064fd6512ffc6cd1b0e61e0cd16f32e72767e91b916014854bc0d2751e32384a51e1987d68ab1705137d26767404e64323363d82db6e928e3659a5965eab88f0f63632a7f00078eac61301fc50bd05707e61d886ed51806fa1b97fb919e2b9cf045fdae249249a4287aaabb0ea26f8a4a0e4a222da904fa5c62384165bb0254d73af4b914cc872921fac6b8fa0f332e2e8c33cfe9484e7a31cb4d20765f388c755565e99b3d17d117c31b90d0b7285345623e60b29878c0cea6f68dd1244b6e53548ea52947cd29f6f02066139554fa50388edb269fd4140892216b07c252220799a7430939654ecd1383de8e42f1230b499c5bb94609f35ab19ba9d910185289a39a9308f12b9ddcc04ee30c3ca55ed561a0bc3e4a36a7e2016e267280e28600749741ac9163693b401576ba1ed3b705d4a5d87028192f8d4dd76b15bd4f11d62a7da43873c4dbe844446b33e1b384a36d240ee57eb816d3a93815d0fb75229eb2ae7cb6b68e1fa6bc3de79b47e80a84e79b11d7b3521ef1d55706960c11030b890ba97b203615a39c3c6b626e06a3c8c92b7ad4e8cfc1ad2150ee14115a794b74c7987bc2a26d1ebbc426af526131ad31e3c0fba70652f48e2b240fd984010e5013be08c1d3cbc92e691195198a8e16a12c159b5b258e462c079a962ad62d3c578092c28016f0c82b110b0e024c9692be5b2d723855a7e70e6f02369e523ce7755cf82b47d013be07811779945207a41c62e77514bf7155cfe6361467174077275f41d74fa61aa4bbdafb26461035b7ea78360597130fab217beab428a080812aeeef421c1a1a2369aa46a18b203dda26d33282273a804fd7f20df941be6714c41223622511e21c542c498dd1fb5dd637a47c88b3f1d6bb517c5e0531d65316d298796b0c679f0c8df2dc0c038274c071a64593948945e63e54f145666fc81d06e48f516ad5cacfd99a810f99949e53668012d0fdc74e0bb65188cce21bb915c28b318bcd0e414e338957102639b076c1e4bfb12aeaeb2f82f745404894616a0b82865508208f9c514de389f36d97a93ea2465ce2fb8d84c5bb6a690f44816cf94a1a24707648bb1bc76811ddc4c71d2f314da927005d2a7130f625634980fc0652d6c5e55937900675119e6394b3c456213c1d7c50ccbd605e62ff874eabd4e09e04240040fa061b74a48e372631cd396f685d45ceeff1a9796147f74f5420d97796faae8a8e497db27b929b6fa00723cc84c114568e65a0414444e8918be62c1c92902d2628484e5e6cadcbd0aade46746a953e045e425afcd8a3990fbfe67cd065c5551fc2fdea77e3d3be06e98b124f57702979bb5d2a307886c3a36680d28974bfeb2c8e9862324080595bb826896f0b28e7729a868237a89b876a50be27292aac7876fc40446f8e27066c4379c6e30e0890f37196779dcce615d382857ff49212c95e158dfefffbb295255de5ffcad45a2212e95c656c89354054aee44cc5f597caa2308502da4dbdf3b18c4f440a90c8d656ee1494c606769cebd28d2a5ec2d846a1684126b9f549a25650e0498e207242818ae0e3d45fa67ef2d16b4fce2032f464cc4ed34a21942be36dbeb691c292692f2453a813e4b9158a55c1fba2834ec233fe1b270f567a026cdf2ae927839f487814366ce48a462aaab02214166d1910402da216a40f734bae50493a67f068d82a7580afba91c86d26e589db96884d01b1c93b2f2a319cfe31643b6a337214c633a597fcac6279533acfb33d32d0d1f6ee288f7ccb02fd5f076ab697baabd2172b457c3b3b293b23820671451fd4652066c8bf690837a6428b0b939314114f970f56355f9ada4b0d8c4d68dae714f019594b5065563b0e453ca574d0069ccb64564b2330987e42a686838ca2ed1c658eb120c0ea8110a392c8141c558cd7626dd838227a78f43c655362a6946911d1e23cd1e9575884027c2820426ba7385ad27105db539c90982e479f65ad879db7e3d828ed68219ff9c293c27b995c147527d39611c7802bd8f95f4ccaa9e8a0995b368d47bd43e71de15ee2e3d2eb05d67c87fe83e68cd6cb02c8ee2b4732d121ec0630041c1aa30e072b409d56a26a0f9f314a8cd1491eea404d79926d180b364cd0780209da66eea387b0e49cba4210e65a866675909bf6eb196354965c3272addc4a42225b7b0755a466ad76e59967bb46f191f3aa106cb1edd0ca07fab8f87c4531d0bb8132cff61f1ade01f0cccb2fa8aa26dec41464cc1d53a19dc2b5ef46887a4b862f695118d54098085dc915e0abe8ef0cc8750a73e09d53a801dd335746c38f01b666f7bc133c5d204ae3e35b17a4f87098feebac2ae9213868cd490224d345f7e9844acd322baa297802445fdb5bab499d2c79a44f98c384b81a84f314db"
79
+ }
@@ -0,0 +1 @@
1
+ 25dbfqk6yidyngb7pdiuieaidcwgrmtdqb22cw6r45a5sadp4tpuaeyd.onion:7700
plata_sdk/paywall.py ADDED
@@ -0,0 +1,94 @@
1
+ """"Pay to use" in front of any web app (the HTTP 402 pattern): the rule
2
+ both ``plata_sdk.wsgi`` and ``plata_sdk.asgi`` follow, usable on its own.
3
+
4
+ A request without an order id gets "402 Payment Required" and an invoice
5
+ (JSON: pay, amount, order, valid_until_ms). The caller pays it and asks
6
+ again with the order id in the ``Plata-Order`` header: served once, then the
7
+ order is used. An order for less than the price, unknown here, used or
8
+ expired gets a new invoice; one not paid yet gets its own invoice again
9
+ (pay once, wait until final, ask again), never a new one to pay twice.
10
+
11
+ Asking for an invoice costs a caller nothing, so each visitor gets a
12
+ bounded number of new ones a minute (``Visitors``; past it: 429), and the
13
+ shop itself keeps a bounded number waiting to be paid (past it: 503).
14
+ """
15
+
16
+ import threading
17
+ import time
18
+ from decimal import Decimal
19
+
20
+ from .client import _amount
21
+ from .errors import OrderError
22
+
23
+ TOO_MANY = "Too many invoices asked from here. Pay one you already have, or ask again in a minute."
24
+
25
+
26
+ class Visitors:
27
+ """At most ``per_minute`` new invoices a minute for one visitor (a
28
+ burst of that many, then one every 60/per_minute seconds). Kept in this
29
+ process's memory: several workers each count on their own. At most
30
+ ``remembered`` visitors are kept; the ones longest unseen go first."""
31
+
32
+ def __init__(self, per_minute=10, remembered=10000):
33
+ self.per_minute = float(per_minute)
34
+ self.remembered = remembered
35
+ self._seen = {}
36
+ self._lock = threading.Lock()
37
+
38
+ def allow(self, who, now=None):
39
+ """True, and one invoice counted, if ``who`` may have a new one."""
40
+ now = time.monotonic() if now is None else now
41
+ with self._lock:
42
+ left, at = self._seen.pop(who, (self.per_minute, now))
43
+ left = min(self.per_minute, left + (now - at) * self.per_minute / 60.0)
44
+ ok = left >= 1.0
45
+ # Put back last: the dict's order is "longest unseen first".
46
+ self._seen[who] = (left - 1.0 if ok else left, now)
47
+ while len(self._seen) > self.remembered:
48
+ del self._seen[next(iter(self._seen))]
49
+ return ok
50
+
51
+
52
+ def decide(shop, price, order, valid_for=600, allow=None):
53
+ """None: serve (the order was paid and is now used). Otherwise
54
+ ``(status, body)``: 402 and an invoice as a dict, with ``error`` saying
55
+ why when an order was given; 429 when ``allow`` (a function with no
56
+ argument, asked before each new invoice) says this visitor has had too
57
+ many; 503 when the shop keeps as many unpaid orders as it may.
58
+ ``NotConnected`` is raised as it is: answer 503, the caller tries
59
+ again."""
60
+ need = Decimal(_amount(price))
61
+
62
+ def new(why=None):
63
+ if allow is not None and not allow():
64
+ return 429, {"error": TOO_MANY, "retry_after": 60}
65
+ try:
66
+ body = shop.invoice(price, valid_for).to_dict()
67
+ except OrderError as e:
68
+ return 503, {"error": e.message, "retry_after": 30}
69
+ if why:
70
+ body["error"] = why
71
+ return 402, body
72
+
73
+ if not order:
74
+ return new()
75
+
76
+ known = shop.invoice_for(order)
77
+ if known is None:
78
+ return new("Unknown order: pay this invoice.")
79
+ if known.amount < need:
80
+ return new("That order was for %s PLATA; this costs %s." % (known.amount, need))
81
+ try:
82
+ shop.redeem(order)
83
+ return None
84
+ except OrderError as e:
85
+ state = shop.check(order).state
86
+ if state == "waiting":
87
+ body = known.to_dict()
88
+ body["error"] = "Not paid in full yet: if you paid, wait until final (about 2 s) and ask again. Do not pay again."
89
+ return 402, body
90
+ if state == "served":
91
+ return new("That order was used already.")
92
+ if state == "expired":
93
+ return new("That order expired unpaid.")
94
+ return new(e.message)
plata_sdk/py.typed ADDED
File without changes
plata_sdk/wsgi.py ADDED
@@ -0,0 +1,55 @@
1
+ """Pay to use for WSGI apps (Flask, Django, Bottle, ...):
2
+
3
+ from plata_sdk.wsgi import PayToUse
4
+ app.wsgi_app = PayToUse(app.wsgi_app, shop, price="0.05")
5
+
6
+ ``price``: an amount, or a function of the request's ``environ`` giving an
7
+ amount, or None for free requests. A served request finds its order id in
8
+ ``environ["plata.order"]``. Shop calls block (a network question each, about
9
+ a second over Tor): run the app with several threads.
10
+
11
+ ``invoices_per_minute``: new invoices one visitor may ask a minute (10;
12
+ None for no limit); past it the answer is 429. ``visitor``: a function of
13
+ ``environ`` naming the visitor (its address by default: behind a proxy,
14
+ give the header your proxy sets).
15
+ """
16
+
17
+ import json
18
+
19
+ from .errors import NotConnected
20
+ from .paywall import Visitors, decide
21
+
22
+ _STATUS = {402: "402 Payment Required", 429: "429 Too Many Requests", 503: "503 Service Unavailable"}
23
+
24
+
25
+ class PayToUse:
26
+ def __init__(self, app, shop, price, valid_for=600, invoices_per_minute=10, visitor=None):
27
+ self.app = app
28
+ self.shop = shop
29
+ self.price = price
30
+ self.valid_for = valid_for
31
+ self.visitors = Visitors(invoices_per_minute) if invoices_per_minute else None
32
+ self.visitor = visitor or (lambda environ: environ.get("REMOTE_ADDR", ""))
33
+
34
+ def __call__(self, environ, start_response):
35
+ price = self.price(environ) if callable(self.price) else self.price
36
+ if price is None:
37
+ return self.app(environ, start_response)
38
+ order = environ.get("HTTP_PLATA_ORDER", "").strip()
39
+ allow = (lambda: self.visitors.allow(self.visitor(environ))) if self.visitors else None
40
+ try:
41
+ answer = decide(self.shop, price, order, self.valid_for, allow)
42
+ except NotConnected as e:
43
+ return _json(start_response, "503 Service Unavailable", {"error": e.message}, [("Retry-After", "5")])
44
+ if answer is None:
45
+ environ["plata.order"] = order
46
+ return self.app(environ, start_response)
47
+ status, body = answer
48
+ extra = [("Retry-After", str(body["retry_after"]))] if "retry_after" in body else []
49
+ return _json(start_response, _STATUS[status], body, extra)
50
+
51
+
52
+ def _json(start_response, status, body, extra=()):
53
+ data = json.dumps(body).encode()
54
+ start_response(status, [("Content-Type", "application/json"), ("Content-Length", str(len(data)))] + list(extra))
55
+ return [data]
@@ -0,0 +1,8 @@
1
+ Plata SDK
2
+
3
+ Copyright (c) 2026 the Plata developers. All rights reserved.
4
+
5
+ Free to use. The code is not public: these are ready-made programs.
6
+
7
+ Provided as it is, with no promise of any kind. PLATA has no promised
8
+ value. This is not an investment.
@@ -0,0 +1,70 @@
1
+ Metadata-Version: 2.1
2
+ Name: plata-sdk
3
+ Version: 0.2.0
4
+ Summary: Plata for programs and AI assistants: post-quantum payments, final in seconds, never sent twice
5
+ Home-page: https://plata.pablo-plata1.workers.dev/sdk
6
+ License: Free to use. Code not public. All rights reserved.
7
+ Keywords: plata,payments,post-quantum,wallet,mcp,ai-agents
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Operating System :: POSIX :: Linux
10
+ Classifier: Operating System :: Microsoft :: Windows
11
+ Classifier: Operating System :: MacOS
12
+ Classifier: License :: Other/Proprietary License
13
+ Requires-Python: >=3.9
14
+ Description-Content-Type: text/markdown
15
+
16
+ # plata-sdk
17
+
18
+ Plata for programs and AI assistants: post-quantum payments (Falcon-1024),
19
+ final in seconds, never sent twice. Keys are made on your computer; no
20
+ sign-up. The live network is reached only through a private connection,
21
+ built in. No other package needed.
22
+
23
+ ```
24
+ pip install plata-sdk
25
+ ```
26
+
27
+ ```python
28
+ import plata_sdk as plata
29
+
30
+ with plata.devnet("devnet") as net: # a test network on this computer
31
+ me = net.wallet("agent.wallet")
32
+ net.faucet(me.address, "10") # test PLATA
33
+ p = me.pay("plata1...", "0.05") # signed, saved, then sent
34
+ p.wait_final()
35
+ ```
36
+
37
+ `plata.connect()` in place of `plata.devnet()` uses the live network. Two
38
+ commands come with it: `plata-wallet` (a wallet, a payment, a whole test
39
+ network from the command line) and `plata-mcp`, a wallet for an AI
40
+ assistant (an MCP server) that pays within limits its owner sets:
41
+
42
+ ```
43
+ plata-wallet new agent.wallet
44
+ plata-mcp --wallet agent.wallet --per-payment 1 --per-day 5 --ask-above 0.5
45
+ ```
46
+
47
+ Getting paid ("pay to use", HTTP 402):
48
+
49
+ ```python
50
+ from plata_sdk.wsgi import PayToUse # plata_sdk.asgi for FastAPI, Starlette
51
+ app.wsgi_app = PayToUse(app.wsgi_app, me.shop(), price="0.05")
52
+ ```
53
+
54
+ ## Said plainly
55
+
56
+ - First release. It paid on the live network from a phone (13 November
57
+ 2026: sent in 1.0 second, final 2.3 seconds later); the Linux and
58
+ Windows programs were tested on test networks.
59
+ - Linux (x64). Windows (x64) and Mac are previews: the Mac programs
60
+ have not yet run on a Mac.
61
+ - Its code is not public: the package holds ready-made programs.
62
+ - A wallet is a file and its 24 words. Nobody can give them back to you.
63
+ - Plata is young: a small network run by its partners' phones. Its
64
+ founder is anonymous, and 10% of every payout goes to a development
65
+ fund.
66
+ - PLATA has no promised value. This is not an investment.
67
+
68
+ More: https://plata.pablo-plata1.workers.dev/sdk
69
+
70
+ <!-- mcp-name: dev.workers.pablo-plata1.plata/plata-mcp -->
@@ -0,0 +1,18 @@
1
+ plata_sdk/__init__.py,sha256=zQkFiuP2eqoCM3bdxEt1qhPZGsiBgm3_I_q4BNKwJHo,1537
2
+ plata_sdk/_engine.py,sha256=SHEPrebWgG-V2gEkCE-A58f-gcKCEms-2wBjeBfqEro,5027
3
+ plata_sdk/_launch.py,sha256=HAT3mthU7Ma5oPVcMP4GD-n1xEDT9NklMtNv4hdCLDI,1566
4
+ plata_sdk/asgi.py,sha256=Cb-XOdfUNPGQPeLUjZCFt7EAxiNMgRPGCQcLZYjxzCc,2649
5
+ plata_sdk/client.py,sha256=GVd4ujXya1HFssUXALwSUgjCPOB5Pt0vyx7j7N7R9Yk,11966
6
+ plata_sdk/errors.py,sha256=yATHFmhLfGFu3No5GJedg4kUeLnROzgHhb4w2s8oNI0,2998
7
+ plata_sdk/paywall.py,sha256=c10l9l7RkFSKTvtg_jTpDRwuZ3ZwXoKI9nUK7D6iMds,3901
8
+ plata_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ plata_sdk/wsgi.py,sha256=uF2kel9KjUApAzRDyoUUMIPrbbeaCzfC43VzT94OV4A,2416
10
+ plata_sdk/bin/plata-wallet.exe,sha256=D82Isrdsaz6EqeH9RHMmd32VqrtSP7dk457BVABbGvo,30630912
11
+ plata_sdk/bin/plata-mcp.exe,sha256=Zvg0TzjUdyVDRE-PUzDKmhSm8Uxu9LAUzCFxN_LLmTE,30644224
12
+ plata_sdk/network/genesis.json,sha256=yVkbcriECFxsN4ggx_LoVXcSBvjH_VfvktA1I2POcvA,20172
13
+ plata_sdk/network/relays.txt,sha256=fGp6hsm0Jx_o5y0ObBHa0uM5AlyL3DLmWwkZUP8x9_g,68
14
+ plata_sdk-0.2.0.dist-info/METADATA,sha256=iHSqwM-9CuFcyXMeIHKl_CJW53aMTTuSjll1xh3BhAQ,2587
15
+ plata_sdk-0.2.0.dist-info/WHEEL,sha256=lWPqxuv-KY_YE8pqs1qzzeCVbI5qH59GDCm7hRsUHE0,96
16
+ plata_sdk-0.2.0.dist-info/entry_points.txt,sha256=AVFjoyHdOyTr7kRVhiv1g2PYaDBuk56sl_vFtAftepA,92
17
+ plata_sdk-0.2.0.dist-info/LICENSE,sha256=fPoiuYnu9yRXSTv6_I4lcgfWeOK09aiEGJ4UNDg9mms,247
18
+ plata_sdk-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: plata build-wheels
3
+ Root-Is-Purelib: false
4
+ Tag: py3-none-win_amd64
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ plata-mcp = plata_sdk._launch:mcp
3
+ plata-wallet = plata_sdk._launch:wallet