rah
rah

Reputation: 69

Can you tell me how to use InvokeScriptTransaction

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.

Upvotes: 1

Views: 135

Answers (1)

Nazim Faour
Nazim Faour

Reputation: 804

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: []}))

Upvotes: 1

Related Questions