Sails-JS v0.5.0
·
39 commits
to master
since this release
Breaking Changes
- Implemented
QueryBuilderclass that provides a convenient way to build and run Sails queries.
From now query functions in Sails and in the lib generated by sails-js-cli return QueryBuilder class instead of the result of the query.
Previous way:
const alice = 'kGkLEU3e3XXkJp2WK4eNpVmSab5xUNL9QtmLPh8QfCL2EgotW';
// Query function accepted originAddress, value, atBlock as direct parameters
const result = await sails.services.ServiceName.queries.QueryName(alice, null, null, functionArg1, functionArg2);New way:
const alice = 'kGkLEU3e3XXkJp2WK4eNpVmSab5xUNL9QtmLPh8QfCL2EgotW';
// Query function now accepts only function arguments and returns QueryBuilder
const result = await sails.services.ServiceName.queries.QueryName(functionArg1, functionArg2)
.withAddress(alice)
.call();
// All QueryBuilder methods are optional
const result = await sails.services.ServiceName.queries.QueryName(functionArg1, functionArg2).call();
// Full configuration example
const result = await sails.services.ServiceName.queries.QueryName(functionArg1, functionArg2)
.withAddress(alice)
.withValue(1000000000000n) // 1 VARA
.withGasLimit(50000000000n)
.atBlock('0x1234567890abcdef...')
.call();Changes
- Fixed creating messages with a single argument (#1051)