1- import Archethic , { Utils , Crypto , Contract } from "@archethicjs/sdk" ;
2- import { ExtendedTransactionBuilder } from "../../dist/transaction" ;
1+ import Archethic , { Contract , Crypto , Utils } from "@archethicjs/sdk" ;
32import { Contract as ContractCode } from "../../dist/contract" ;
3+ import { ExtendedTransactionBuilder } from "../../dist/transaction" ;
44
55const { parseBigInt, formatBigInt } = Utils ;
66
@@ -250,7 +250,6 @@ window.onClickAddTokenTransfer = async () => {
250250 document . querySelector ( "#token_id" ) . value = "0" ;
251251} ;
252252
253- let namedParams = [ ]
254253let objectParams = { } ;
255254
256255window . onChangeRecipient = async ( ) => {
@@ -273,9 +272,7 @@ window.onChangeRecipient = async () => {
273272 paramsContainer . setAttribute ( "style" , "display: none" ) ;
274273 paramsContainer . setAttribute ( "class" , "namedActionParams" ) ;
275274
276- namedParams = new Array ( action . parameters . length ) . fill ( null )
277-
278- action . parameters . forEach ( ( parameter , index ) => {
275+ action . parameters . forEach ( ( parameter , _ ) => {
279276 const inputId = paramsContainerId + "_param_" + parameter ;
280277 const paramLabel = document . createElement ( "label" ) ;
281278 paramLabel . innerText = parameter ;
@@ -289,26 +286,12 @@ window.onChangeRecipient = async () => {
289286 try {
290287 const json = JSON . parse ( value ) ;
291288 if ( typeof json === "object" ) {
292- if ( contractContext . contract ) {
293- objectParams [ parameter ] = Contract . parseTypedArgument ( json ) ;
294- } else {
295- namedParams [ index ] = Contract . parseTypedArgument ( json ) ;
296- }
289+ objectParams [ parameter ] = Contract . parseTypedArgument ( json ) ;
297290 } else {
298- if ( contractContext . contract ) {
299- objectParams [ parameter ] = Contract . parseTypedArgument ( value ) ;
300- }
301- else {
302- namedParams [ index ] = Contract . parseTypedArgument ( value ) ;
303- }
304- }
305- } catch ( e ) {
306- if ( contractContext . contract ) {
307291 objectParams [ parameter ] = Contract . parseTypedArgument ( value ) ;
308292 }
309- else {
310- namedParams [ index ] = Contract . parseTypedArgument ( value ) ;
311- }
293+ } catch ( e ) {
294+ objectParams [ parameter ] = Contract . parseTypedArgument ( value ) ;
312295 }
313296 } ) ;
314297
@@ -334,11 +317,11 @@ window.onClickAddRecipient = () => {
334317 const recipientList = document . querySelector ( "#recipients" ) ;
335318
336319 if ( namedAction != "" ) {
337- recipients . push ( { address : recipientAddress , action : namedAction , args : Object . keys ( objectParams ) . length > 0 ? objectParams : namedParams } ) ;
320+ recipients . push ( { address : recipientAddress , action : namedAction , args : Object . keys ( objectParams ) . length > 0 ? objectParams : { } } ) ;
338321 if ( recipientList . textContent != "" ) {
339322 recipientList . textContent = recipientList . textContent + "\n" ;
340323 }
341- recipientList . textContent += `${ recipientAddress } - ${ namedAction } - ${ JSON . stringify ( Object . keys ( objectParams ) . length > 0 ? objectParams : namedParams ) } ` ;
324+ recipientList . textContent += `${ recipientAddress } - ${ namedAction } - ${ JSON . stringify ( Object . keys ( objectParams ) . length > 0 ? objectParams : { } ) } ` ;
342325
343326 document . querySelector ( "#namedActionsContainer" ) . style . display = "none" ;
344327 document . querySelector ( "#namedActions" ) . innerHTML = "<option></option>" ;
0 commit comments