).then(resp => checkForError(resp))
},
+ buildChain: (builderBlock, cb) => {
+ const builder = new TransactionBuilder()
+
+ try {
+ builderBlock(builder)
+ } catch (err) {
+ return Promise.reject(err)
+ }
+
+ return shared.tryCallback(
+ client.request('/build-chain-transactions', builder),
+ cb
+ ).then(resp => checkForError(resp)).catch(errors => {throw checkForError(errors)})
+ },
+
buildBatch: (builderBlocks, cb) => {
const builders = []
for (let i in builderBlocks) {
cb
),
- signBatch: (templates, cb) => finalizeBatch(templates)
- // TODO: merge batch errors from finalizeBatch
- .then(finalized => client.signer.signBatch(finalized.successes, cb)),
+ signBatch: (template, cb) => finalize(template)
+ .then(finalized => client.request('/sign-transactions', finalized ).then(resp => checkForError(resp)).catch(errors => {throw checkForError(errors)}),
+ cb
+ ),
submit: (signed, cb) => shared.tryCallback(
client.request('/submit-transaction', {'raw_transaction': signed}).then(resp => checkForError(resp)),
),
submitBatch: (signed, cb) => shared.tryCallback(
- client.request('/submit-transaction', {transactions: signed})
- .then(resp => new shared.BatchResponse(resp)),
+ client.request('/submit-transactions', {'raw_transactions': signed}).then(resp => checkForError(resp))
+ .catch(errors => {throw checkForError(errors)}),
cb
),