MCPcopy Index your code
hub / github.com/raiden-network/raiden / mint_token_for

Method mint_token_for

raiden/api/rest.py:583–611  ·  view source on GitHub ↗
(
        self, token_address: TokenAddress, to: Address, value: TokenAmount
    )

Source from the content-addressed store, hash-verified

581 )
582
583 def mint_token_for(
584 self, token_address: TokenAddress, to: Address, value: TokenAmount
585 ) -> Response:
586 if self.raiden_api.raiden.config.environment_type == Environment.PRODUCTION:
587 return api_error(
588 errors="Minting a token is currently disabled in production mode",
589 status_code=HTTPStatus.NOT_IMPLEMENTED,
590 )
591
592 log.debug(
593 "Minting token",
594 node=self.checksum_address,
595 token_address=to_checksum_address(token_address),
596 to=to_checksum_address(to),
597 value=value,
598 )
599
600 try:
601 transaction_hash = self.raiden_api.mint_token_for(
602 token_address=token_address, to=to, value=value
603 )
604 except MintFailed as e:
605 return api_error(f"Minting failed: {str(e)}", status_code=HTTPStatus.BAD_REQUEST)
606 except InsufficientEth as e:
607 return api_error(errors=str(e), status_code=HTTPStatus.PAYMENT_REQUIRED)
608
609 return api_response(
610 status_code=HTTPStatus.OK, result=dict(transaction_hash=encode_hex(transaction_hash))
611 )
612
613 def open(
614 self,

Callers 1

postMethod · 0.45

Calls 3

api_errorFunction · 0.90
to_checksum_addressFunction · 0.90
api_responseFunction · 0.90

Tested by

no test coverage detected