@0xsequence/transactions
Advanced tools
Comparing version 0.41.3 to 0.42.0
@@ -66,14 +66,21 @@ 'use strict'; | ||
function flattenAuxTransactions(txs) { | ||
if (!Array.isArray(txs)) return flattenAuxTransactions([txs]); | ||
return txs.reduce(function (p, c) { | ||
if (Array.isArray(c)) { | ||
return p.concat(flattenAuxTransactions(c)); | ||
} | ||
if (!Array.isArray(txs)) { | ||
if ('auxiliary' in txs) { | ||
const aux = txs.auxiliary; | ||
if (c.auxiliary) { | ||
return p.concat([c, ...flattenAuxTransactions(c.auxiliary)]); | ||
const tx = _extends({}, txs); | ||
delete tx.auxiliary; | ||
if (aux) { | ||
return [tx, ...flattenAuxTransactions(aux)]; | ||
} else { | ||
return [tx]; | ||
} | ||
} else { | ||
return [txs]; | ||
} | ||
} | ||
return p.concat(c); | ||
}, []); | ||
return txs.flatMap(flattenAuxTransactions); | ||
} | ||
@@ -80,0 +87,0 @@ async function toSequenceTransaction(wallet, tx, revertOnError = false, gasLimit = ethers.ethers.constants.Zero, nonce) { |
@@ -66,14 +66,21 @@ 'use strict'; | ||
function flattenAuxTransactions(txs) { | ||
if (!Array.isArray(txs)) return flattenAuxTransactions([txs]); | ||
return txs.reduce(function (p, c) { | ||
if (Array.isArray(c)) { | ||
return p.concat(flattenAuxTransactions(c)); | ||
} | ||
if (!Array.isArray(txs)) { | ||
if ('auxiliary' in txs) { | ||
const aux = txs.auxiliary; | ||
if (c.auxiliary) { | ||
return p.concat([c, ...flattenAuxTransactions(c.auxiliary)]); | ||
const tx = _extends({}, txs); | ||
delete tx.auxiliary; | ||
if (aux) { | ||
return [tx, ...flattenAuxTransactions(aux)]; | ||
} else { | ||
return [tx]; | ||
} | ||
} else { | ||
return [txs]; | ||
} | ||
} | ||
return p.concat(c); | ||
}, []); | ||
return txs.flatMap(flattenAuxTransactions); | ||
} | ||
@@ -80,0 +87,0 @@ async function toSequenceTransaction(wallet, tx, revertOnError = false, gasLimit = ethers.ethers.constants.Zero, nonce) { |
@@ -62,14 +62,21 @@ import { ethers } from 'ethers'; | ||
function flattenAuxTransactions(txs) { | ||
if (!Array.isArray(txs)) return flattenAuxTransactions([txs]); | ||
return txs.reduce(function (p, c) { | ||
if (Array.isArray(c)) { | ||
return p.concat(flattenAuxTransactions(c)); | ||
} | ||
if (!Array.isArray(txs)) { | ||
if ('auxiliary' in txs) { | ||
const aux = txs.auxiliary; | ||
if (c.auxiliary) { | ||
return p.concat([c, ...flattenAuxTransactions(c.auxiliary)]); | ||
const tx = _extends({}, txs); | ||
delete tx.auxiliary; | ||
if (aux) { | ||
return [tx, ...flattenAuxTransactions(aux)]; | ||
} else { | ||
return [tx]; | ||
} | ||
} else { | ||
return [txs]; | ||
} | ||
} | ||
return p.concat(c); | ||
}, []); | ||
return txs.flatMap(flattenAuxTransactions); | ||
} | ||
@@ -76,0 +83,0 @@ async function toSequenceTransaction(wallet, tx, revertOnError = false, gasLimit = ethers.constants.Zero, nonce) { |
@@ -11,3 +11,3 @@ import { Signer, BigNumberish } from 'ethers'; | ||
export declare function toSequenceTransactions(wallet: Signer | string, txs: (Transaction | TransactionRequest)[], revertOnError?: boolean, gasLimit?: BigNumberish): Promise<Transaction[]>; | ||
export declare function flattenAuxTransactions(txs: (Transactionish | Transactionish)[]): (TransactionRequest | Transaction)[]; | ||
export declare function flattenAuxTransactions(txs: Transactionish | Transactionish[]): (TransactionRequest | Transaction)[]; | ||
export declare function toSequenceTransaction(wallet: Signer | string, tx: TransactionRequest | Transaction, revertOnError?: boolean, gasLimit?: BigNumberish, nonce?: BigNumberish): Promise<Transaction>; | ||
@@ -14,0 +14,0 @@ export declare function isAsyncSendable(target: any): any; |
{ | ||
"name": "@0xsequence/transactions", | ||
"version": "0.41.3", | ||
"version": "0.42.0", | ||
"description": "transactions sub-package for Sequence", | ||
@@ -17,5 +17,5 @@ "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/transactions", | ||
"dependencies": { | ||
"@0xsequence/abi": "^0.41.3", | ||
"@0xsequence/network": "^0.41.3", | ||
"@0xsequence/utils": "^0.41.3", | ||
"@0xsequence/abi": "^0.42.0", | ||
"@0xsequence/network": "^0.42.0", | ||
"@0xsequence/utils": "^0.42.0", | ||
"@ethersproject/abi": "^5.5.0", | ||
@@ -22,0 +22,0 @@ "ethers": "^5.5.2" |
@@ -59,15 +59,21 @@ import { ethers, Signer, BigNumberish } from 'ethers' | ||
export function flattenAuxTransactions(txs: (Transactionish | Transactionish)[]): (TransactionRequest | Transaction)[] { | ||
if (!Array.isArray(txs)) return flattenAuxTransactions([txs]) | ||
return txs.reduce(function (p: Transactionish[], c: Transactionish) { | ||
if (Array.isArray(c)) { | ||
return p.concat(flattenAuxTransactions(c)) | ||
} | ||
export function flattenAuxTransactions(txs: Transactionish | Transactionish[]): (TransactionRequest | Transaction)[] { | ||
if (!Array.isArray(txs)) { | ||
if ('auxiliary' in txs) { | ||
const aux = txs.auxiliary | ||
if ((<TransactionRequest>c).auxiliary) { | ||
return p.concat([c, ...flattenAuxTransactions((<TransactionRequest>c).auxiliary!)]) | ||
const tx = { ...txs } | ||
delete tx.auxiliary | ||
if (aux) { | ||
return [tx, ...flattenAuxTransactions(aux)] | ||
} else { | ||
return [tx] | ||
} | ||
} else { | ||
return [txs] | ||
} | ||
} | ||
return p.concat(c) | ||
}, []) as (TransactionRequest | Transaction)[] | ||
return txs.flatMap(flattenAuxTransactions) | ||
} | ||
@@ -74,0 +80,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43159
1058
+ Added@0xsequence/abi@0.42.10(transitive)
+ Added@0xsequence/network@0.42.10(transitive)
+ Added@0xsequence/utils@0.42.10(transitive)
- Removed@0xsequence/abi@0.41.3(transitive)
- Removed@0xsequence/network@0.41.3(transitive)
- Removed@0xsequence/utils@0.41.3(transitive)
Updated@0xsequence/abi@^0.42.0
Updated@0xsequence/network@^0.42.0
Updated@0xsequence/utils@^0.42.0