@@ -49,7 +49,7 @@ async function sendAndProcess (tx, options) {
49
49
const result = await this . getTxInfo ( txData . hash )
50
50
51
51
if ( result . returnType !== 'ok' ) {
52
- await this . handleCallError ( { result, tx : TxObject ( { tx : txData . rawTx } ) , rawTx : txData . rawTx } )
52
+ await this . _handleCallError ( result , txData . rawTx )
53
53
}
54
54
55
55
return { hash : txData . hash , tx : TxObject ( { tx : txData . rawTx } ) , result, txData, rawTx : txData . rawTx }
@@ -58,22 +58,23 @@ async function sendAndProcess (tx, options) {
58
58
/**
59
59
* Handle contract call error
60
60
* @function
61
+ * @private
61
62
* @alias module:@aeternity /aepp-sdk/es/ae/contract
62
63
* @category async
63
64
* @param {Object } result call result object
64
- * @param {Object } tx Unpacked transaction
65
+ * @param {String } rawTx Raw transaction
65
66
* @throws Error Decoded error
66
67
* @return {Promise<void> }
67
68
*/
68
- async function handleCallError ( { result, tx , rawTx } ) {
69
+ async function _handleCallError ( result , rawTx ) {
69
70
const error = Buffer . from ( result . returnValue ) . toString ( )
70
71
const decodedError = isBase64 ( error . slice ( 3 ) )
71
72
? Buffer . from ( error . slice ( 3 ) , 'base64' ) . toString ( )
72
73
: await this . contractDecodeDataAPI ( 'string' , error )
73
74
throw Object . assign (
74
75
new Error ( `Invocation failed: ${ error } . Decoded: ${ decodedError } ` ) , {
75
76
...result ,
76
- tx,
77
+ tx : TxObject ( { tx : rawTx } ) ,
77
78
error,
78
79
rawTx,
79
80
decodedError
@@ -190,7 +191,7 @@ async function dryRunContractTx (tx, callerId, source, name, opt = {}) {
190
191
if ( status !== 'ok' ) throw Object . assign ( new Error ( 'Dry run error, ' + reason ) , { tx : TxObject ( { tx } ) , dryRunParams : { accounts : [ dryRunAccount ] , top } } )
191
192
const { returnType, returnValue } = callObj
192
193
if ( returnType !== 'ok' ) {
193
- await this . handleCallError ( { result : callObj , tx : TxObject ( { tx } ) } )
194
+ await this . _handleCallError ( callObj , tx )
194
195
}
195
196
return {
196
197
tx : TxObject ( { tx } ) ,
@@ -476,7 +477,7 @@ export const ContractAPI = Ae.compose(ContractBase, ContractACI, {
476
477
contractEncodeCall,
477
478
contractDecodeData,
478
479
dryRunContractTx,
479
- handleCallError ,
480
+ _handleCallError ,
480
481
// Delegation for contract
481
482
// AENS
482
483
delegateSignatureCommon,
0 commit comments