-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into st/docs/migrate-types-snippets
- Loading branch information
Showing
37 changed files
with
635 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
--- | ||
|
||
ci(deps): bump thollander/actions-comment-pull-request from 2 to 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"create-fuels": patch | ||
--- | ||
|
||
build(deps): bump typescript-eslint from 8.5.0 to 8.8.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
--- | ||
|
||
build(deps): bump memfs from 4.11.1 to 4.14.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
"@internal/fuel-core": patch | ||
"@fuel-ts/versions": patch | ||
"@fuel-ts/account": patch | ||
"@fuel-ts/errors": patch | ||
--- | ||
|
||
chore: upgrading `fuel-core` to `0.40.0` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@fuel-ts/account": patch | ||
--- | ||
|
||
feat: implement batch transfer to contracts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"create-fuels": patch | ||
--- | ||
|
||
chore: exclude `node_modules` in template tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
--- | ||
|
||
chore: increase benchmark iterations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
--- | ||
ci: add optimized graphql query e2e tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// #region combining-utxos | ||
import { Provider, Wallet } from 'fuels'; | ||
|
||
import { LOCAL_NETWORK_URL, WALLET_PVT_KEY } from '../env'; | ||
|
||
const provider = await Provider.create(LOCAL_NETWORK_URL); | ||
const fundingWallet = Wallet.fromPrivateKey(WALLET_PVT_KEY, provider); | ||
|
||
const wallet = Wallet.generate({ provider }); | ||
|
||
// First, lets fund a wallet with 10_000 of the base asset. But as we are doing this across 10 transactions, | ||
// we will end up with 10 UTXOs. | ||
for (let i = 0; i < 10; i++) { | ||
const initTx = await fundingWallet.transfer( | ||
wallet.address, | ||
1000, | ||
provider.getBaseAssetId() | ||
); | ||
await initTx.waitForResult(); | ||
} | ||
|
||
// We can fetch the coins to see how many UTXOs we have, and confirm it is 10. | ||
const { coins: initialCoins } = await wallet.getCoins( | ||
provider.getBaseAssetId() | ||
); | ||
console.log('Initial Coins Length', initialCoins.length); | ||
// 10 | ||
|
||
// But we can also confirm the total balance of the base asset for this account is 10_000. | ||
const initialBalance = await wallet.getBalance(provider.getBaseAssetId()); | ||
console.log('Initial Balance', initialBalance.toNumber()); | ||
// 10_000 | ||
|
||
// Now we can combine the UTXOs into a single UTXO by performing a single transfer for the | ||
// majority of the balance. Of course, we will still need some funds for the transaction fees. | ||
const combineTx = await wallet.transfer( | ||
wallet.address, | ||
9500, | ||
provider.getBaseAssetId() | ||
); | ||
await combineTx.wait(); | ||
|
||
// Now we can perform the same validations and see we have less UTXOs. | ||
// We have 2 in this instance, as we have performed the transfer in the base asset: | ||
// a UTXO for our transfer, and another for what is left after paying the fees. | ||
const { coins: combinedCoins } = await wallet.getCoins( | ||
provider.getBaseAssetId() | ||
); | ||
console.log('Combined Coins Length', combinedCoins.length); | ||
// 2 | ||
|
||
// And we can also confirm the final balance of the base asset for this account is 9_998, | ||
// so the cost of combining is also minimal. | ||
const combinedBalance = await wallet.getBalance(provider.getBaseAssetId()); | ||
console.log('Combined Balance', combinedBalance.toNumber()); | ||
// 9_998 | ||
// #endregion combining-utxos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Combining UTXOs | ||
|
||
When performing a funding operation or calling `getResourcesToSpend`, you may encounter the `MAX_COINS_REACHED` error if the number of coins fetched per asset exceeds the maximum limit allowed by the chain. | ||
|
||
You may also want to do this if you want to reduce the number of inputs in your transaction, which can be useful if you are trying to reduce the size of your transaction or you are receiving the `MAX_INPUTS_EXCEEDED` error. | ||
|
||
One way to avoid these errors is to combine your UTXOs. This can be done by performing a transfer that combines multiple UTXOs into a single UTXO, where the transaction has multiple inputs for the asset, but a smaller number of outputs. | ||
|
||
> **Note:** You will not be able to have a single UTXO for the base asset after combining, as one output will be for the transfer, and you will have another for the fees. | ||
<<< @/../../docs-snippets2/src/cookbook/combining-utxos.ts#combining-utxos{ts:line-numbers} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.39.0 | ||
0.40.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.