From 3330917c8f84d155ea443cd2dc02fc8350a38aa6 Mon Sep 17 00:00:00 2001 From: Leonardo Custodio Date: Fri, 12 Jan 2024 21:31:25 -0300 Subject: [PATCH] Fixes issue with extrinsics named "call" (#392) fix --- packages/polkadart_cli/lib/src/generator/pallet.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/polkadart_cli/lib/src/generator/pallet.dart b/packages/polkadart_cli/lib/src/generator/pallet.dart index 4fd53174..0628eba3 100644 --- a/packages/polkadart_cli/lib/src/generator/pallet.dart +++ b/packages/polkadart_cli/lib/src/generator/pallet.dart @@ -526,7 +526,7 @@ Class createPalletTxs( ..name = 'Txs' ..constructors.add(Constructor((b) => b..constant = true)) ..methods.addAll(generator.txs.map((tx) => Method((builder) { - final txName = ReCase(tx.name).camelCase; + var txName = ReCase(tx.name).camelCase; final Reference primitive = tx.codec.primitive(dirname); final Reference runtimePrimitive = generator.runtimeCall.primitive(dirname); @@ -546,6 +546,11 @@ Class createPalletTxs( ..named = true ..name = field.sanitizedName))) ..body = Block((b) { + if (sanitize(txName) == + sanitize(primitive.symbol.toString())) { + txName = '${txName}Variant'; + } + Expression expression = declareFinal('_call').assign(primitive);