From bff2ba622bd8efd0879f2f96d21139d24a2a99a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Torres?= <30977845+Torres-ssf@users.noreply.github.com> Date: Fri, 15 Dec 2023 16:40:43 -0300 Subject: [PATCH 01/12] fix param name --- packages/providers/src/provider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/providers/src/provider.ts b/packages/providers/src/provider.ts index eb0ac793da7..f85cfe3756a 100644 --- a/packages/providers/src/provider.ts +++ b/packages/providers/src/provider.ts @@ -871,7 +871,7 @@ export default class Provider { excludedIds?: ExcludeResourcesOption ): Promise { const excludeInput = { - messages: excludedIds?.messages?.map((id) => hexlify(id)) || [], + messages: excludedIds?.messages?.map((nonce) => hexlify(nonce)) || [], utxos: excludedIds?.utxos?.map((id) => hexlify(id)) || [], }; From e5de5ed9db0fa08c9e00e4885ce511a1de203950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Torres?= <30977845+Torres-ssf@users.noreply.github.com> Date: Fri, 15 Dec 2023 16:41:41 -0300 Subject: [PATCH 02/12] ensure no inputs are removed on fundWithFakeUtxos --- .../transaction-request.ts | 75 ++++++++++--------- 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/packages/providers/src/transaction-request/transaction-request.ts b/packages/providers/src/transaction-request/transaction-request.ts index 83092b4de8a..411814b434c 100644 --- a/packages/providers/src/transaction-request/transaction-request.ts +++ b/packages/providers/src/transaction-request/transaction-request.ts @@ -1,4 +1,4 @@ -import { Address, addressify, getRandomB256 } from '@fuel-ts/address'; +import { Address, addressify } from '@fuel-ts/address'; import { BaseAssetId, ZeroBytes32 } from '@fuel-ts/address/configs'; import type { AddressLike, AbstractAddress, AbstractPredicate } from '@fuel-ts/interfaces'; import type { BN, BigNumberish } from '@fuel-ts/math'; @@ -25,7 +25,6 @@ import { isCoin } from '../resource'; import { normalizeJSON } from '../utils'; import { getMaxGas, getMinGas } from '../utils/gas'; -import type { CoinTransactionRequestOutput } from '.'; import { NoWitnessAtIndexError } from './errors'; import type { TransactionRequestInput, @@ -33,7 +32,11 @@ import type { MessageTransactionRequestInput, } from './input'; import { inputify } from './input'; -import type { TransactionRequestOutput, ChangeTransactionRequestOutput } from './output'; +import type { + TransactionRequestOutput, + ChangeTransactionRequestOutput, + CoinTransactionRequestOutput, +} from './output'; import { outputify } from './output'; import type { TransactionRequestWitness } from './witness'; import { witnessify } from './witness'; @@ -559,42 +562,44 @@ export abstract class BaseTransactionRequest implements BaseTransactionRequestLi * @param quantities - CoinQuantity Array. */ fundWithFakeUtxos(quantities: CoinQuantity[]) { - const hasBaseAssetId = quantities.some(({ assetId }) => assetId === BaseAssetId); - - if (!hasBaseAssetId) { - quantities.push({ assetId: BaseAssetId, amount: bn(1) }); - } - - const owner = getRandomB256(); + let idCounter = 0; + const generateId = (): string => { + const counterString = String(idCounter++); + const id = ZeroBytes32.slice(0, -counterString.length).concat(counterString); + return id; + }; - const witnessToRemove = this.inputs.reduce( - (acc, input) => { - if (input.type === InputType.Coin || input.type === InputType.Message) { - if (!acc[input.witnessIndex]) { - acc[input.witnessIndex] = true; - } + const findAssetInput = (assetId: string) => + this.inputs.find((input) => { + if ('assetId' in input) { + return input.assetId === assetId; } + return false; + }); - return acc; - }, - {} as Record - ); - - this.witnesses = this.witnesses.filter((_, idx) => !witnessToRemove[idx]); - this.inputs = this.inputs.filter((input) => input.type === InputType.Contract); - this.outputs = this.outputs.filter((output) => output.type !== OutputType.Change); - - const fakeResources = quantities.map(({ assetId, amount }, idx) => ({ - id: `${ZeroBytes32}0${idx}`, - amount, - assetId, - owner: Address.fromB256(owner), - maturity: 0, - blockCreated: bn(1), - txCreatedIdx: bn(1), - })); + const updateAssetInput = (assetId: string, quantity: BN) => { + const assetInput = findAssetInput(assetId); + + if (assetInput && 'assetId' in assetInput) { + assetInput.id = generateId(); + assetInput.amount = quantity; + } else { + this.addResources([ + { + id: generateId(), + amount: quantity, + assetId, + owner: Address.fromRandom(), + maturity: 0, + blockCreated: bn(1), + txCreatedIdx: bn(1), + }, + ]); + } + }; - this.addResources(fakeResources); + updateAssetInput(BaseAssetId, bn(100_000_000_000)); + quantities.forEach((q) => updateAssetInput(q.assetId, q.amount)); } /** From 3c63f1b114f0a30000eedc861d575e17e93f52e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Torres?= <30977845+Torres-ssf@users.noreply.github.com> Date: Fri, 15 Dec 2023 16:43:05 -0300 Subject: [PATCH 03/12] made Account fund considers existent resources on tx request --- packages/wallet/src/account.ts | 59 ++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/packages/wallet/src/account.ts b/packages/wallet/src/account.ts index 5f008351ab9..04169fe2445 100644 --- a/packages/wallet/src/account.ts +++ b/packages/wallet/src/account.ts @@ -222,8 +222,63 @@ export class Account extends AbstractAccount { coinQuantities, }); - const resources = await this.getResourcesToSpend(updatedQuantities); - request.addResources(resources); + const quantitiesDict: Record = {}; + + updatedQuantities.forEach(({ amount, assetId }) => { + quantitiesDict[assetId] = { + required: amount, + owned: bn(0), + }; + }); + + const cachedUtxos: BytesLike[] = []; + const cachedMessages: BytesLike[] = []; + + const owner = this.address.toB256(); + + request.inputs.forEach((input) => { + const isResource = 'amount' in input; + + if (isResource) { + const isCoin = 'owner' in input; + + if (isCoin) { + const assetId = String(input.assetId); + if (input.owner === owner && quantitiesDict[assetId]) { + const amount = bn(input.amount); + quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount); + + // caching this utxo to avoid fetching it again if requests needs to be funded + cachedUtxos.push(input.id); + } + } else if (input.recipient === owner && quantitiesDict[BaseAssetId]) { + quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount); + + // caching this message to avoid fetching it again if requests needs to be funded + cachedMessages.push(input.nonce); + } + } + }); + + const missingQuantities: CoinQuantity[] = []; + Object.entries(quantitiesDict).forEach(([assetId, { owned, required }]) => { + if (owned.lt(required)) { + missingQuantities.push({ + assetId, + amount: required.sub(owned), + }); + } + }); + + const needsToBeFunded = missingQuantities.length; + + if (needsToBeFunded) { + const resources = await this.getResourcesToSpend(missingQuantities, { + messages: cachedMessages, + utxos: cachedUtxos, + }); + request.addResources(resources); + } } /** From 328cee7ed8e386cb8cc6cf1a13b4ca41a40a0c4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Torres?= <30977845+Torres-ssf@users.noreply.github.com> Date: Fri, 15 Dec 2023 16:49:51 -0300 Subject: [PATCH 04/12] release PR --- .github/workflows/pr-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-release.yaml b/.github/workflows/pr-release.yaml index 9b48fc2352a..34ad25146b1 100644 --- a/.github/workflows/pr-release.yaml +++ b/.github/workflows/pr-release.yaml @@ -8,7 +8,7 @@ jobs: name: "Release PR to npm" runs-on: ubuntu-latest # comment out if:false to enable release PR to npm - if: false + # if: false permissions: write-all steps: - name: Checkout From fe7bb57250058072364f2436f94696580d1a457b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Torres?= <30977845+Torres-ssf@users.noreply.github.com> Date: Fri, 15 Dec 2023 17:07:35 -0300 Subject: [PATCH 05/12] remove deprecated tests --- .../transaction-request.test.ts | 60 ------------------- 1 file changed, 60 deletions(-) diff --git a/packages/providers/src/transaction-request/transaction-request.test.ts b/packages/providers/src/transaction-request/transaction-request.test.ts index 7b41e2e444c..9771620ca4b 100644 --- a/packages/providers/src/transaction-request/transaction-request.test.ts +++ b/packages/providers/src/transaction-request/transaction-request.test.ts @@ -128,65 +128,5 @@ describe('TransactionRequest', () => { expect(inputB?.amount).toEqual(bn(300)); expect(inputBase?.amount).toEqual(bn(500)); }); - - it('should add BaseAssetId with amount bn(1) if not present in quantities', () => { - const transactionRequest = new ScriptTransactionRequest(); - - const quantities: CoinQuantity[] = [{ assetId: assetIdB, amount: bn(10) }]; - - transactionRequest.fundWithFakeUtxos(quantities); - - const baseAssetEntry = quantities.find((q) => q.assetId === BaseAssetId); - expect(baseAssetEntry).not.toBeNull(); - expect(baseAssetEntry?.amount).toEqual(bn(1)); - }); - - it('should not add BaseAssetId if it is already present in quantities', () => { - const transactionRequest = new ScriptTransactionRequest(); - - const quantities = [{ assetId: BaseAssetId, amount: bn(10) }]; - transactionRequest.fundWithFakeUtxos(quantities); - const baseAssetEntries = quantities.filter((q) => q.assetId === BaseAssetId); - expect(baseAssetEntries.length).toBe(1); - }); - - it('should filter inputs and outputs accordingly', () => { - const transactionRequest = new ScriptTransactionRequest(); - - transactionRequest.inputs = [ - MOCK_REQUEST_COIN_INPUT, - MOCK_REQUEST_MESSAGE_INPUT, - MOCK_REQUEST_CONTRACT_INPUT, - ]; - transactionRequest.outputs = [ - MOCK_REQUEST_COIN_OUTPUT, - MOCK_REQUEST_CONTRACT_OUTPUT, - MOCK_REQUEST_CHANGE_OUTPUT, - ]; - - transactionRequest.fundWithFakeUtxos([]); - - const contractInput = transactionRequest.inputs.find((i) => i.type === InputType.Contract); - const coinInput = transactionRequest.inputs.find((i) => i.type === InputType.Coin); - const messageInput = transactionRequest.inputs.find((i) => i.type === InputType.Message); - - // Contract inputs should not be filtered out - expect(contractInput).toBe(MOCK_REQUEST_CONTRACT_INPUT); - - // Coin and Message inputs should be filtered out - expect(coinInput).not.toBe(MOCK_REQUEST_COIN_INPUT); - expect(messageInput).not.toBe(MOCK_REQUEST_MESSAGE_INPUT); - - const coinOutput = transactionRequest.outputs.find((o) => o.type === OutputType.Coin); - const contractOutput = transactionRequest.outputs.find((o) => o.type === OutputType.Contract); - const changeOutput = transactionRequest.outputs.find((o) => o.type === OutputType.Change); - - // Coin and Contract outputs should not be filtered out - expect(coinOutput).toBe(MOCK_REQUEST_COIN_OUTPUT); - expect(contractOutput).toBe(MOCK_REQUEST_CONTRACT_OUTPUT); - - // Change output should be filtered out - expect(changeOutput).not.toBe(MOCK_REQUEST_CHANGE_OUTPUT); - }); }); }); From 4205f4268855e67950110f6b5ea02de1aa3250d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Torres?= <30977845+Torres-ssf@users.noreply.github.com> Date: Fri, 15 Dec 2023 17:07:47 -0300 Subject: [PATCH 06/12] ajusting unit test --- packages/wallet/src/account.test.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/wallet/src/account.test.ts b/packages/wallet/src/account.test.ts index e8f4f985c55..7f126c6257e 100644 --- a/packages/wallet/src/account.test.ts +++ b/packages/wallet/src/account.test.ts @@ -238,9 +238,15 @@ describe('Account', () => { coinQuantities: quantities, }); - const expectedTotalResources = [quantities[0], { amount: bn(fee), assetId: BaseAssetId }]; + const expectedTotalResources = [ + { amount: bn(quantities[0].amount), assetId: quantities[0].assetId }, + { amount: bn(fee), assetId: BaseAssetId }, + ]; expect(getResourcesToSpendSpy).toBeCalledTimes(1); - expect(getResourcesToSpendSpy).toBeCalledWith(expectedTotalResources); + expect(getResourcesToSpendSpy).toBeCalledWith(expectedTotalResources, { + messages: [], + utxos: [], + }); expect(addResourcesSpy).toBeCalledTimes(1); expect(addResourcesSpy).toHaveBeenCalledWith(resourcesToSpend); From 702c20e20f507438ad9ee8eda6a540e4b191516d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Torres?= <30977845+Torres-ssf@users.noreply.github.com> Date: Fri, 15 Dec 2023 17:15:19 -0300 Subject: [PATCH 07/12] add changeset --- .changeset/sour-apples-prove.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/sour-apples-prove.md diff --git a/.changeset/sour-apples-prove.md b/.changeset/sour-apples-prove.md new file mode 100644 index 00000000000..348182ab0b5 --- /dev/null +++ b/.changeset/sour-apples-prove.md @@ -0,0 +1,6 @@ +--- +"@fuel-ts/providers": minor +"@fuel-ts/wallet": minor +--- + +fix Account fund and Provider fundWithFakeUtxos From f6c52faadbeccbe56cda05d7992921dff1951352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Torres?= <30977845+Torres-ssf@users.noreply.github.com> Date: Fri, 15 Dec 2023 17:16:24 -0300 Subject: [PATCH 08/12] linting --- .../transaction-request/transaction-request.test.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/packages/providers/src/transaction-request/transaction-request.test.ts b/packages/providers/src/transaction-request/transaction-request.test.ts index 9771620ca4b..31e3404cf40 100644 --- a/packages/providers/src/transaction-request/transaction-request.test.ts +++ b/packages/providers/src/transaction-request/transaction-request.test.ts @@ -1,16 +1,8 @@ import { Address } from '@fuel-ts/address'; import { BaseAssetId } from '@fuel-ts/address/configs'; import { bn, toNumber } from '@fuel-ts/math'; -import { InputType, OutputType, TransactionType } from '@fuel-ts/transactions'; - -import { - MOCK_REQUEST_CHANGE_OUTPUT, - MOCK_REQUEST_COIN_INPUT, - MOCK_REQUEST_COIN_OUTPUT, - MOCK_REQUEST_CONTRACT_INPUT, - MOCK_REQUEST_CONTRACT_OUTPUT, - MOCK_REQUEST_MESSAGE_INPUT, -} from '../../test/fixtures/inputs-and-outputs'; +import { TransactionType } from '@fuel-ts/transactions'; + import type { CoinQuantity } from '../coin-quantity'; import type { CoinTransactionRequestInput } from './input'; From f3d502581d0c1be529908c90cc54ca143595a43f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Torres?= <30977845+Torres-ssf@users.noreply.github.com> Date: Mon, 18 Dec 2023 16:03:02 -0300 Subject: [PATCH 09/12] add test suite --- .../src/funding-transaction.test.ts | 187 ++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 packages/fuel-gauge/src/funding-transaction.test.ts diff --git a/packages/fuel-gauge/src/funding-transaction.test.ts b/packages/fuel-gauge/src/funding-transaction.test.ts new file mode 100644 index 00000000000..344ab933c4e --- /dev/null +++ b/packages/fuel-gauge/src/funding-transaction.test.ts @@ -0,0 +1,187 @@ +import { seedTestWallet } from '@fuel-ts/wallet/test-utils'; +import type { Account, CoinTransactionRequestInput } from 'fuels'; +import { + FUEL_NETWORK_URL, + Provider, + BaseAssetId, + ScriptTransactionRequest, + Wallet, + bn, +} from 'fuels'; + +describe(__filename, () => { + let mainWallet: Account; + let provider: Provider; + beforeAll(async () => { + provider = await Provider.create(FUEL_NETWORK_URL); + mainWallet = Wallet.generate({ provider }); + await seedTestWallet(mainWallet, [[500_000, BaseAssetId]]); + }); + + const fundingTxWithMultipleUTXOs = async ({ + account, + totalAmount, + splitIn, + }: { + account: Account; + totalAmount: number; + splitIn: number; + }) => { + const request = new ScriptTransactionRequest({ + gasLimit: 1_000, + gasPrice: bn(10), + }); + + for (let i = 0; i < splitIn; i++) { + request.addCoinOutput(account.address, totalAmount / splitIn, BaseAssetId); + } + + const resources = await mainWallet.getResourcesToSpend([[totalAmount + 2_000, BaseAssetId]]); + request.addResources(resources); + + const tx = await mainWallet.sendTransaction(request); + await tx.waitForResult(); + }; + + it('should successfully fund a transaction request when it is not fully funded', async () => { + const sender = Wallet.generate({ provider }); + const receiver = Wallet.generate({ provider }); + + // 1500 splitted in 5 = 5 UTXOs of 300 each + await fundingTxWithMultipleUTXOs({ + account: sender, + totalAmount: 1500, + splitIn: 5, + }); + + // this will return one UTXO of 300, not enought to pay for the TX fees + const lowResources = await sender.getResourcesToSpend([[100, BaseAssetId]]); + + // confirm we only fetched 1 UTXO from the expected amount + expect(lowResources.length).toBe(1); + expect(lowResources[0].amount.toNumber()).toBe(300); + + const request = new ScriptTransactionRequest({ + gasLimit: 1_000, + gasPrice: bn(10), + }); + + const amountToTransfer = 300; + request.addCoinOutput(receiver.address, amountToTransfer, BaseAssetId); + + request.addResources(lowResources); + + const { maxFee, requiredQuantities } = await provider.getTransactionCost(request); + + // TX request already does NOT carries enough resources, it needs to be funded + expect(request.inputs.length).toBe(1); + expect(bn((request.inputs[0]).amount).toNumber()).toBe(300); + expect(maxFee.gt(300)).toBeTruthy(); + + const getResourcesToSpendSpy = jest.spyOn(sender, 'getResourcesToSpend'); + + await sender.fund(request, requiredQuantities, maxFee); + + const tx = await sender.sendTransaction(request); + + await tx.waitForResult(); + + // fund method should have been called to fetch the remaining UTXOs + expect(getResourcesToSpendSpy).toHaveBeenCalledTimes(1); + + const receiverBalance = await receiver.getBalance(BaseAssetId); + + expect(receiverBalance.toNumber()).toBe(amountToTransfer); + }); + + it('should not fund a transaction request when it is already funded', async () => { + const sender = Wallet.generate({ provider }); + const receiver = Wallet.generate({ provider }); + + // 2000 splitted in 2 = 2 UTXOs of 1000 each + await fundingTxWithMultipleUTXOs({ + account: sender, + totalAmount: 2000, + splitIn: 2, + }); + + // sender has 2 UTXOs for 1000 each, so it has enough resources to spend 1000 of BaseAssetId + const enoughtResources = await sender.getResourcesToSpend([[100, BaseAssetId]]); + + // confirm we only fetched 1 UTXO from the expected amount + expect(enoughtResources.length).toBe(1); + expect(enoughtResources[0].amount.toNumber()).toBe(1000); + + const request = new ScriptTransactionRequest({ + gasLimit: 1_000, + gasPrice: bn(10), + }); + + const amountToTransfer = 100; + + request.addCoinOutput(receiver.address, amountToTransfer, BaseAssetId); + request.addResources(enoughtResources); + + const { maxFee, requiredQuantities } = await provider.getTransactionCost(request); + + // TX request already carries enough resources, it does not need to be funded + expect(request.inputs.length).toBe(1); + expect(bn((request.inputs[0]).amount).toNumber()).toBe(1000); + expect(maxFee.lt(1000)).toBeTruthy(); + + const getResourcesToSpendSpy = jest.spyOn(sender, 'getResourcesToSpend'); + + await sender.fund(request, requiredQuantities, maxFee); + + const tx = await sender.sendTransaction(request); + + await tx.waitForResult(); + + // fund should not have been called since the TX request was already funded + expect(getResourcesToSpendSpy).toHaveBeenCalledTimes(0); + + const receiverBalance = await receiver.getBalance(BaseAssetId); + + expect(receiverBalance.toNumber()).toBe(amountToTransfer); + }); + + it('should fully fund a transaction when it is has no funds yet', async () => { + const sender = Wallet.generate({ provider }); + const receiver = Wallet.generate({ provider }); + + // 5000 splitted in 10 = 10 UTXOs of 500 each + await fundingTxWithMultipleUTXOs({ + account: sender, + totalAmount: 5000, + splitIn: 10, + }); + + const request = new ScriptTransactionRequest({ + gasLimit: 1_000, + gasPrice: bn(10), + }); + + const amountToTransfer = 1000; + request.addCoinOutput(receiver.address, amountToTransfer, BaseAssetId); + + const { maxFee, requiredQuantities } = await provider.getTransactionCost(request); + + // TX request does NOT carry any resources, it needs to be funded + expect(request.inputs.length).toBe(0); + + const getResourcesToSpendSpy = jest.spyOn(sender, 'getResourcesToSpend'); + + await sender.fund(request, requiredQuantities, maxFee); + + const tx = await sender.sendTransaction(request); + + await tx.waitForResult(); + + // fund method should have been called to fetch UTXOs + expect(getResourcesToSpendSpy).toHaveBeenCalledTimes(1); + + const receiverBalance = await receiver.getBalance(BaseAssetId); + + expect(receiverBalance.toNumber()).toBe(amountToTransfer); + }); +}); From 5fa68272989fac90574a2f116f877615e54dc555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Torres?= <30977845+Torres-ssf@users.noreply.github.com> Date: Tue, 19 Dec 2023 13:44:09 -0300 Subject: [PATCH 10/12] consider withdraw amount on withdrawToBaseLayer --- packages/wallet/src/account.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/wallet/src/account.ts b/packages/wallet/src/account.ts index 04169fe2445..ffc65a8a77d 100644 --- a/packages/wallet/src/account.ts +++ b/packages/wallet/src/account.ts @@ -410,8 +410,12 @@ export class Account extends AbstractAccount { const params = { script, ...txParams }; const request = new ScriptTransactionRequest(params); + const forwardingQuantities = [{ amount: bn(amount), assetId: BaseAssetId }]; - const { requiredQuantities, maxFee } = await this.provider.getTransactionCost(request); + const { requiredQuantities, maxFee } = await this.provider.getTransactionCost( + request, + forwardingQuantities + ); await this.fund(request, requiredQuantities, maxFee); From bbc90736f6f97310a12b4962824ffbac5060d5d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Torres?= <30977845+Torres-ssf@users.noreply.github.com> Date: Tue, 19 Dec 2023 13:45:46 -0300 Subject: [PATCH 11/12] ensure only message coins are considered when funding TX --- packages/wallet/src/account.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/wallet/src/account.ts b/packages/wallet/src/account.ts index ffc65a8a77d..5a5f0eebd30 100644 --- a/packages/wallet/src/account.ts +++ b/packages/wallet/src/account.ts @@ -251,7 +251,7 @@ export class Account extends AbstractAccount { // caching this utxo to avoid fetching it again if requests needs to be funded cachedUtxos.push(input.id); } - } else if (input.recipient === owner && quantitiesDict[BaseAssetId]) { + } else if (input.recipient === owner && input.amount && quantitiesDict[BaseAssetId]) { quantitiesDict[BaseAssetId].owned = quantitiesDict[BaseAssetId].owned.add(input.amount); // caching this message to avoid fetching it again if requests needs to be funded From 49b195dae9b732da028507db2e8bca18b30d1620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Torres?= <30977845+Torres-ssf@users.noreply.github.com> Date: Tue, 19 Dec 2023 20:14:39 -0300 Subject: [PATCH 12/12] unrelease PR --- .github/workflows/pr-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-release.yaml b/.github/workflows/pr-release.yaml index 34ad25146b1..9b48fc2352a 100644 --- a/.github/workflows/pr-release.yaml +++ b/.github/workflows/pr-release.yaml @@ -8,7 +8,7 @@ jobs: name: "Release PR to npm" runs-on: ubuntu-latest # comment out if:false to enable release PR to npm - # if: false + if: false permissions: write-all steps: - name: Checkout