Do a transfer with `target` with the given `amount` of `token_address`.
(
self,
registry_address: TokenNetworkRegistryAddress,
token_address: TokenAddress,
amount: PaymentAmount,
target: TargetAddress,
identifier: PaymentID = None,
transfer_timeout: int = None,
secret: Secret = None,
secrethash: SecretHash = None,
lock_timeout: BlockTimeout = None,
route_states: List[RouteState] = None,
)
| 1075 | ) |
| 1076 | |
| 1077 | def transfer_and_wait( |
| 1078 | self, |
| 1079 | registry_address: TokenNetworkRegistryAddress, |
| 1080 | token_address: TokenAddress, |
| 1081 | amount: PaymentAmount, |
| 1082 | target: TargetAddress, |
| 1083 | identifier: PaymentID = None, |
| 1084 | transfer_timeout: int = None, |
| 1085 | secret: Secret = None, |
| 1086 | secrethash: SecretHash = None, |
| 1087 | lock_timeout: BlockTimeout = None, |
| 1088 | route_states: List[RouteState] = None, |
| 1089 | ) -> "PaymentStatus": |
| 1090 | """Do a transfer with `target` with the given `amount` of `token_address`.""" |
| 1091 | # pylint: disable=too-many-arguments |
| 1092 | |
| 1093 | with opentracing.tracer.start_span("transfer_and_wait") as span: |
| 1094 | span.set_tag("token_address", to_checksum_address(token_address)) |
| 1095 | if isinstance(target, bytes): |
| 1096 | span.set_tag("target", to_checksum_address(target)) |
| 1097 | span.set_tag("payment_identifier", identifier) |
| 1098 | payment_status = self.transfer_async( |
| 1099 | registry_address=registry_address, |
| 1100 | token_address=token_address, |
| 1101 | amount=amount, |
| 1102 | target=target, |
| 1103 | identifier=identifier, |
| 1104 | secret=secret, |
| 1105 | secrethash=secrethash, |
| 1106 | lock_timeout=lock_timeout, |
| 1107 | route_states=route_states, |
| 1108 | ) |
| 1109 | payment_status.payment_done.wait(timeout=transfer_timeout) |
| 1110 | return payment_status |
| 1111 | |
| 1112 | def transfer_async( |
| 1113 | self, |