@magnaflow/merchant-utils 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"tron.d.ts","sourceRoot":"","sources":["../src/tron.ts"],"names":[],"mappings":"AAkDA;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;IACF,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC;IACZ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,sCAAsC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qEAAqE;IACrE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mCAAmC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mCAAmC;IACnC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7C;AAQD;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,GAAG,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,sBAAsB,CAAC,CAkFjC;AAED,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,GAAG,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,sBAAsB,CAAC,CA0HjC;AAED,wBAAsB,8BAA8B,CAClD,OAAO,EAAE,GA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AAC,sBAAsB,CAAC,CAkFjC;AAED,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,GAAG,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,sBAAsB,CAAC,CA0HjC;AAED,wBAAsB,8BAA8B,CAClD,OAAO,EAAE,GAAG,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,GAAE;IACP,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,mCAAmC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mCAAmC;IACnC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CACxC,gBAoDP"}
package/dist/tron.js CHANGED
@@ -40,9 +40,6 @@ function parseContractError(contractResult) {
40
40
  }
41
41
  return 'Unable to parse error information';
42
42
  }
43
- function isTronTransactionSuccessful(transactionReceipt) {
44
- return transactionReceipt?.receipt?.result === 'SUCCESS';
45
- }
46
43
  /**
47
44
  * Poll Tron transaction status, wait for transaction confirmation
48
45
  * @param tronWeb TronWeb instance
@@ -76,7 +73,7 @@ export async function pollTronTransaction(tronWeb, txHash, options = {}) {
76
73
  throw new Error(timeoutMessage);
77
74
  }
78
75
  const contractRet = transactionReceipt?.receipt;
79
- const isSuccess = isTronTransactionSuccessful(transactionReceipt);
76
+ const isSuccess = Boolean(contractRet && transactionReceipt?.blockNumber);
80
77
  if (throwOnFailure && !isSuccess) {
81
78
  let errorDetails = '';
82
79
  let parsedError = '';
@@ -179,7 +176,7 @@ export async function pollTronTransaction2(tronWeb, txHash, options = {}) {
179
176
  throw new Error(timeoutMessage);
180
177
  }
181
178
  const contractRet = transactionReceipt?.receipt;
182
- const isSuccess = isTronTransactionSuccessful(transactionReceipt);
179
+ const isSuccess = Boolean(contractRet && transactionReceipt?.blockNumber);
183
180
  if (throwOnFailure && !isSuccess) {
184
181
  let errorDetails = '';
185
182
  let parsedError = '';
@@ -244,7 +241,7 @@ export async function pollTronTransactionWithBackoff(tronWeb, txHash, options =
244
241
  }
245
242
  const info = await tronWeb.trx.getTransactionInfo(txHash);
246
243
  if (info?.blockNumber) {
247
- if (isTronTransactionSuccessful(info)) {
244
+ if (info.receipt) {
248
245
  return info;
249
246
  }
250
247
  // explicit failure (REVERT / OUT_OF_ENERGY / missing SUCCESS result)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magnaflow/merchant-utils",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Merchant shared utilities",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",