From 910cb0e2c6d30b759acd42726f262afe7ecefc9a Mon Sep 17 00:00:00 2001 From: AbigailDeng Date: Sun, 29 Sep 2024 14:37:02 +0800 Subject: [PATCH] feat: data null --- src/contract/contractMethod.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/contract/contractMethod.js b/src/contract/contractMethod.js index 49a7719e..569a00d5 100644 --- a/src/contract/contractMethod.js +++ b/src/contract/contractMethod.js @@ -328,26 +328,32 @@ export default class ContractMethod { const url = 'gateway/sendUserSignedMultiTransaction'; if (argsObject.isSync) { const params = this.multiPrepareParameters(args); - const { data } = httpProvider.send({ + const { data, message, code } = httpProvider.send({ url, method: 'POST', params: { RawMultiTransaction: params } }); - return data; + if (data != null && code === 200) { + return data; + } + throw new Error(message); } // eslint-disable-next-line arrow-body-style return this.multiPrepareParametersAsync(args).then(async params => { - const { data } = await httpProvider.sendAsync({ + const { data, message, code } = await httpProvider.sendAsync({ url, method: 'POST', params: { RawMultiTransaction: params } }); - argsObject.callback(data); - return data; + if (data != null && code === 200) { + argsObject.callback(data); + return data; + } + throw new Error(message); }); }