Skip to content

Commit a688e48

Browse files
committed
Updates get_payment_info to include all the params of the underlying create_signed_extrinsic
1 parent 3445e5f commit a688e48

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
lines changed

async_substrate_interface/async_substrate.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3500,7 +3500,13 @@ async def get_constant(
35003500
return None
35013501

35023502
async def get_payment_info(
3503-
self, call: GenericCall, keypair: Keypair
3503+
self,
3504+
call: GenericCall,
3505+
keypair: Keypair,
3506+
era: Optional[Union[dict, str]] = None,
3507+
nonce: Optional[int] = None,
3508+
tip: int = 0,
3509+
tip_asset_id: Optional[int] = None,
35043510
) -> dict[str, Any]:
35053511
"""
35063512
Retrieves fee estimation via RPC for given extrinsic
@@ -3509,6 +3515,11 @@ async def get_payment_info(
35093515
call: Call object to estimate fees for
35103516
keypair: Keypair of the sender, does not have to include private key because no valid signature is
35113517
required
3518+
era: Specify mortality in blocks in follow format:
3519+
{'period': [amount_blocks]} If omitted the extrinsic is immortal
3520+
nonce: nonce to include in extrinsics, if omitted the current nonce is retrieved on-chain
3521+
tip: The tip for the block author to gain priority during network congestion
3522+
tip_asset_id: Optional asset ID with which to pay the tip
35123523
35133524
Returns:
35143525
Dict with payment info
@@ -3528,7 +3539,13 @@ async def get_payment_info(
35283539

35293540
# Create extrinsic
35303541
extrinsic = await self.create_signed_extrinsic(
3531-
call=call, keypair=keypair, signature=signature
3542+
call=call,
3543+
keypair=keypair,
3544+
era=era,
3545+
nonce=nonce,
3546+
tip=tip,
3547+
tip_asset_id=tip_asset_id,
3548+
signature=signature,
35323549
)
35333550
extrinsic_len = len(extrinsic.data)
35343551

async_substrate_interface/sync_substrate.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2779,14 +2779,27 @@ def get_constant(
27792779
else:
27802780
return None
27812781

2782-
def get_payment_info(self, call: GenericCall, keypair: Keypair) -> dict[str, Any]:
2782+
def get_payment_info(
2783+
self,
2784+
call: GenericCall,
2785+
keypair: Keypair,
2786+
era: Optional[Union[dict, str]] = None,
2787+
nonce: Optional[int] = None,
2788+
tip: int = 0,
2789+
tip_asset_id: Optional[int] = None,
2790+
) -> dict[str, Any]:
27832791
"""
27842792
Retrieves fee estimation via RPC for given extrinsic
27852793
27862794
Args:
27872795
call: Call object to estimate fees for
27882796
keypair: Keypair of the sender, does not have to include private key because no valid signature is
27892797
required
2798+
era: Specify mortality in blocks in follow format:
2799+
{'period': [amount_blocks]} If omitted the extrinsic is immortal
2800+
nonce: nonce to include in extrinsics, if omitted the current nonce is retrieved on-chain
2801+
tip: The tip for the block author to gain priority during network congestion
2802+
tip_asset_id: Optional asset ID with which to pay the tip
27902803
27912804
Returns:
27922805
Dict with payment info
@@ -2806,7 +2819,13 @@ def get_payment_info(self, call: GenericCall, keypair: Keypair) -> dict[str, Any
28062819

28072820
# Create extrinsic
28082821
extrinsic = self.create_signed_extrinsic(
2809-
call=call, keypair=keypair, signature=signature
2822+
call=call,
2823+
keypair=keypair,
2824+
era=era,
2825+
nonce=nonce,
2826+
tip=tip,
2827+
tip_asset_id=tip_asset_id,
2828+
signature=signature,
28102829
)
28112830
extrinsic_len = len(extrinsic.data)
28122831

0 commit comments

Comments
 (0)