This repository has been archived by the owner on Apr 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
net.gd
50 lines (37 loc) · 1.79 KB
/
net.gd
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
extends Node
# Server signals
signal fast_withdraw_requested(peer : int, amount: float, destination: String)
signal fast_withdraw_invoice_paid(peer : int, txid: String, amount: float, destination: String)
# Client signals
signal fast_withdraw_invoice(amount: float, destination: String)
signal fast_withdraw_complete(txid: String, amount: float, destination: String)
# TODO add params: SC #, MC fee, MC destination
@rpc("any_peer", "call_remote", "reliable")
func request_fast_withdraw(amount : float, destination : String) -> void:
print("Received fast withdrawal request")
print("Amount: ", amount)
print("Destination: ", destination)
print("Peer: ", multiplayer.get_remote_sender_id())
fast_withdraw_requested.emit(multiplayer.get_remote_sender_id(), amount, destination)
@rpc("authority", "call_remote", "reliable")
func receive_fast_withdraw_invoice(amount : float, destination : String) -> void:
print("Received fast withdrawal invoice")
print("Amount: ", amount)
print("Destination: ", destination)
print("Peer: ", multiplayer.get_remote_sender_id())
fast_withdraw_invoice.emit(amount, destination)
@rpc("any_peer", "call_remote", "reliable")
func invoice_paid(txid: String, amount : float, destination : String) -> void:
print("Paid fast withdrawal invoice")
print("Amount: ", amount)
print("Destination: ", destination)
print("Txid: ", txid)
print("Peer: ", multiplayer.get_remote_sender_id())
fast_withdraw_invoice_paid.emit(multiplayer.get_remote_sender_id(), txid, amount, destination)
@rpc("authority", "call_remote", "reliable")
func withdraw_complete(txid: String, amount : float, destination : String) -> void:
print("Fast withdraw completed!")
print("Amount: ", amount)
print("Destination: ", destination)
print("Txid: ", txid)
fast_withdraw_complete.emit(txid, amount, destination)