Can you tell me how to use InvokeScriptTransaction

141 views Asked by At

This is an example of the WAVES IDE. Please tell me how to use InvokeScriptTransaction to execute ‘func divideAmount ()’.

# waves IDE example
let Alice = Address(base58'3NBVqYXrapgJP9atQccdBPAgJPwHDKkh6A8')
let Bob = Address(base58'3N78bNBYhT6pt6nugc6ay1uW1nLEfnRWkJd')

@Callable(i)
func divideAmount() = {

    let transferAmount = wavesBalance(this) / 2

    TransferSet([
                ScriptTransfer(Alice, transferAmount, unit),
                ScriptTransfer(Bob, transferAmount, unit)
    ])
}

I set a script for my account on the test net. However, I do not understand that it calls with InvokeScriptTransaction.

1

There are 1 answers

0
Nazim Faour On BEST ANSWER

If you use IDE you can run in the console. It is also available in the JS library (waves-transactions).

broadcast(invokeScript({contractAddress: {CONTRACT_ADDRESS_HERE}), call:{function:"divideAmount",args:[]}, payment: []}))