Skip to content

Commit

Permalink
Merge pull request #102 from CityOfZion/CU-86a51rqn8-1
Browse files Browse the repository at this point in the history
CU-86a51rqn8 - BS Lib - Multi-SEND - Fix issue where the array return…
  • Loading branch information
thiagocbalducci authored Sep 30, 2024
2 parents cd17e1a + bf2b2d2 commit 757888a
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cityofzion/bs-ethereum",
"comment": "Fix issue where the array returned by transfer method is inconsistent",
"type": "patch"
}
],
"packageName": "@cityofzion/bs-ethereum"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cityofzion/bs-neo-legacy",
"comment": "Fix issue where the array returned by transfer method is inconsistent",
"type": "patch"
}
],
"packageName": "@cityofzion/bs-neo-legacy"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cityofzion/bs-neo3",
"comment": "Fix issue where the array returned by transfer method is inconsistent",
"type": "patch"
}
],
"packageName": "@cityofzion/bs-neo3"
}
7 changes: 5 additions & 2 deletions packages/bs-ethereum/src/BSEthereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ export class BSEthereum<BSCustomName extends string = string>
const sentTransactionHashes: string[] = []

for (const intent of param.intents) {
let transactionHash = ''

try {
const { transactionParams, gasPrice } = await this.#buildTransferParams(intent)

Expand All @@ -231,11 +233,12 @@ export class BSEthereum<BSCustomName extends string = string>
maxPriorityFeePerGas: gasPrice,
maxFeePerGas: gasPrice,
})

sentTransactionHashes.push(transaction.hash)
transactionHash = transaction.hash
} catch {
/* empty */
}

sentTransactionHashes.push(transactionHash)
}

return sentTransactionHashes
Expand Down
5 changes: 3 additions & 2 deletions packages/bs-neo-legacy/src/services/BSNeoLegacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export class BSNeoLegacy<BSCustomName extends string = string>
])
}

let response
let response: any

if (nep5ScriptBuilder.isEmpty()) {
response = await api.sendAsset({
Expand All @@ -159,7 +159,8 @@ export class BSNeoLegacy<BSCustomName extends string = string>
}

if (!response.tx) throw new Error('Failed to send transaction')
return [response.tx.hash]

return intents.map(() => response.tx!.hash)
}

async claim(account: Account): Promise<string> {
Expand Down
2 changes: 1 addition & 1 deletion packages/bs-neo3/src/BSNeo3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export class BSNeo3<BSCustomName extends string = string>
signers: [],
})

return [transactionHash]
return param.intents.map(() => transactionHash)
}

async claim(account: Account, isLedger?: boolean): Promise<string> {
Expand Down

0 comments on commit 757888a

Please sign in to comment.