Version 0.1.11
⭐ Automatic Argument Type Resolver
There is always a room for improvement, that's why we have removed requirement to pass argument type for each and every one of them when you execute script or send transaction. Types are automagically inferred from Cadence code passed for each interaction. So now instead of writing:
const args = [
[42, 1337, t. Int],
["Hello, Cadence", t.String],
[ "1.001", t.UFix64]
]
you can simply write:
const args = [ 42, 1337, "Hello, Cadence", 1.001]
That's right - no need to pass fixed point values as string - we got you! ;)
Also, if you mess up and pass value of incorrect type mapper would throw an error failing test and notifying you, where you need to make adjustments.
⭐ Automatic Import Resolver
It's possible to omit addressMap
field, when submitting interaction to network. Import resolver would try to match the name of the contract to deployed contract thus simplifying the amount of code you write. Let's assume you have Cadence template:
import Kibble from 0x01
import FungibleToken from 0x02
pub fun main(account: Address): UFix64{
// some logic for extracting the balance from account address here
}
Before you would need to get the address of account where imported contracts are deployed and then pass them in addressMap
field:
const Kibble = await getContractAddress("Kibble")
const FungibleToken = await getContractAddress("FungibleToken")
const addressMap = { Kibble, FungibleToken }
const result = await executeScript({ name: "getBalance", args: [ Alice ], addressMap })
Now you can do one-liner!
const result = await executeScript({ name: "getBalance", args: [ Alice ] })