# TypeScript SDK

**URL:** https://forum.fuel.network/c/typescript-sdk/10.md?page=1

[Latest](https://forum.fuel.network/latest.md) · [Categories](https://forum.fuel.network/categories.md) · [Tags](https://forum.fuel.network/tags.md)

**Page:** 2

---

## [How do you instantiate or interact with a Sway Script?](https://forum.fuel.network/t/how-do-you-instantiate-or-interact-with-a-sway-script/6789)

<div class="topic-metadata">

**Author:** [@eesheng](https://forum.fuel.network/u/eesheng)\
**Replies:** 4\
**Last updated:** [October 7, 2024, 8:11am UTC](https://forum.fuel.network/t/how-do-you-instantiate-or-interact-with-a-sway-script/6789 "2024-10-07T08:11:06Z")

</div>

How do you instantiate or interact with a Sway Script? There seems to be 2 ways: Fuel TS SDK | Fuel Docs Fuel TS SDK | Fuel Docs While for 2) how do you instantiate and interact with the script? In the docs it states…

---

## [Can't deploy to mainnet: \_FuelError: Transaction Squeezed Out with reason: Transaction expired because it exceeded the configured time to live \`tx-pool-ttl\`](https://forum.fuel.network/t/cant-deploy-to-mainnet-fuelerror-transaction-squeezed-out-with-reason-transaction-expired-because-it-exceeded-the-configured-time-to-live-tx-pool-ttl/6799)

<div class="topic-metadata">

**Author:** [@xpluscal](https://forum.fuel.network/u/xpluscal)\
**Replies:** 1\
**Last updated:** [October 6, 2024, 1:07pm UTC](https://forum.fuel.network/t/cant-deploy-to-mainnet-fuelerror-transaction-squeezed-out-with-reason-transaction-expired-because-it-exceeded-the-configured-time-to-live-tx-pool-ttl/6799 "2024-10-06T13:07:32Z")

</div>

When deploying via fuels-ts script, I get the following error: \_FuelError: Transaction Squeezed Out with reason: Transaction expired because it exceeded the configured time to live tx-pool-ttl. Any idea what this might…

---

## [Why are moving from Nextjs to Vite.js?](https://forum.fuel.network/t/why-are-moving-from-nextjs-to-vite-js/6793)

<div class="topic-metadata">

**Author:** [@eesheng](https://forum.fuel.network/u/eesheng)\
**Replies:** 1\
**Last updated:** [October 6, 2024, 10:10am UTC](https://forum.fuel.network/t/why-are-moving-from-nextjs-to-vite-js/6793 "2024-10-06T10:10:51Z")

</div>

A query on why the Fuel Team is building towards Vite.js. Will Nextjs be depreciated?

---

## [Error decoding contract event deployed with fuels-rs \`v0.66.3\`](https://forum.fuel.network/t/error-decoding-contract-event-deployed-with-fuels-rs-v0-66-3/6582)

<div class="topic-metadata">

**Author:** [@PaulZhemanov](https://forum.fuel.network/u/PaulZhemanov)\
**Replies:** 22\
**Last updated:** [October 4, 2024, 2:27pm UTC](https://forum.fuel.network/t/error-decoding-contract-event-deployed-with-fuels-rs-v0-66-3/6582 "2024-10-04T14:27:09Z")

</div>

Hi guys! We deployed our contract with this dependencies: Fuel Dependencies: forc v0.63.3 fuel-core v0.35.0 fuels-rs v0.66.3 But i got this error while decoding the event with 0.94.1 ts-sdk version: \[11:36:02.387\] …

---

## [Wallet connection not persisting across page navigation or reload](https://forum.fuel.network/t/wallet-connection-not-persisting-across-page-navigation-or-reload/6760)

<div class="topic-metadata">

**Author:** [@meir](https://forum.fuel.network/u/meir)\
**Replies:** 2\
**Last updated:** [October 4, 2024, 9:53am UTC](https://forum.fuel.network/t/wallet-connection-not-persisting-across-page-navigation-or-reload/6760 "2024-10-04T09:53:17Z")

</div>

Hello, I’m migrating to the fuels/connector. I’ve set up the context in my app at the highest level as shown here: export const App = () =\> { return ( \<PersistQueryClientProvider client={queryClient} …

---

## [Error decoding contract log using fuels-ts 0.94.6](https://forum.fuel.network/t/error-decoding-contract-log-using-fuels-ts-0-94-6/6696)

<div class="topic-metadata">

**Author:** [@PaulZhemanov](https://forum.fuel.network/u/PaulZhemanov)\
**Replies:** 9\
**Last updated:** [October 1, 2024, 2:53pm UTC](https://forum.fuel.network/t/error-decoding-contract-log-using-fuels-ts-0-94-6/6696 "2024-10-01T14:53:45Z")

</div>

Hi fuel team! i deployed contract using forc="0.63.6" fuel-core = "0.36.0" I got this error tryin decode event log \_FuelError: Log type with logId '12590297951544648000' doesn't exist in the ABI. at Interface…

---

## [\`run\_external\` fails with TS SDK](https://forum.fuel.network/t/run-external-fails-with-ts-sdk/6757)

<div class="topic-metadata">

**Author:** [@theAusicist](https://forum.fuel.network/u/theAusicist)\
**Replies:** 5\
**Last updated:** [September 30, 2024, 9:31am UTC](https://forum.fuel.network/t/run-external-fails-with-ts-sdk/6757 "2024-09-30T09:31:21Z")

</div>

Using the run\_external callframe fails with the following error: Proxy: // SPDX-License-Identifier: Apache-2.0 contract; use std::{ call\_frames::first\_param, context::\*, asset::\*, execution::run\_external, has…

---

## [sendTransactionAsync(from the useSendTransactionHook) does not add a witness signature?](https://forum.fuel.network/t/sendtransactionasync-from-the-usesendtransactionhook-does-not-add-a-witness-signature/6663)

<div class="topic-metadata">

**Author:** [@Akash](https://forum.fuel.network/u/Akash)\
**Replies:** 3\
**Last updated:** [September 27, 2024, 2:20pm UTC](https://forum.fuel.network/t/sendtransactionasync-from-the-usesendtransactionhook-does-not-add-a-witness-signature/6663 "2024-09-27T14:20:10Z")

</div>

When we do sendTransactionAsync at frontend it asks for a signature to perform the transaction. Now in my predicate code i am recovering the sender address with ec\_recover\_address but it throws OutOfGas error as i am no…

---

## [Version Mismatch: Fuel Node using fuel-core 0.36.0 not supported by TypeScript SDK 0.94.6](https://forum.fuel.network/t/version-mismatch-fuel-node-using-fuel-core-0-36-0-not-supported-by-typescript-sdk-0-94-6/6692)

<div class="topic-metadata">

**Author:** [@Prasanth](https://forum.fuel.network/u/Prasanth)\
**Replies:** 3\
**Last updated:** [September 25, 2024, 10:10am UTC](https://forum.fuel.network/t/version-mismatch-fuel-node-using-fuel-core-0-36-0-not-supported-by-typescript-sdk-0-94-6/6692 "2024-09-25T10:10:46Z")

</div>

Description: I am encountering a version compatibility issue between the Fuel Node and the TypeScript SDK. Despite installing the latest version of the fuel-ts SDK, I am still receiving an error indicating that my Fuel …

---

## [So many compile warn when using lastest @fuels/connectors](https://forum.fuel.network/t/so-many-compile-warn-when-using-lastest-fuels-connectors/6653)

<div class="topic-metadata">

**Author:** [@Clara](https://forum.fuel.network/u/Clara)\
**Replies:** 6\
**Last updated:** [September 25, 2024, 12:09am UTC](https://forum.fuel.network/t/so-many-compile-warn-when-using-lastest-fuels-connectors/6653 "2024-09-25T00:09:55Z")

</div>

After using lastest @fuels/connectors and fuels sdk, our full-chain game is very smoothly. But we still have to point out two hidden problems. The first one is when compiling, there are more than 500 warnings related t…

---

## [Can we get Contract address from Asset ID](https://forum.fuel.network/t/can-we-get-contract-address-from-asset-id/6559)

<div class="topic-metadata">

**Author:** [@div-lync](https://forum.fuel.network/u/div-lync)\
**Replies:** 4\
**Last updated:** [September 24, 2024, 5:35pm UTC](https://forum.fuel.network/t/can-we-get-contract-address-from-asset-id/6559 "2024-09-24T17:35:24Z")

</div>

is there any way to get contract address from Asset ID?

---

## [How to get the network a wallet is connected to?](https://forum.fuel.network/t/how-to-get-the-network-a-wallet-is-connected-to/6638)

<div class="topic-metadata">

**Author:** [@mpoplavkov](https://forum.fuel.network/u/mpoplavkov)\
**Replies:** 8\
**Last updated:** [September 24, 2024, 3:04pm UTC](https://forum.fuel.network/t/how-to-get-the-network-a-wallet-is-connected-to/6638 "2024-09-24T15:04:11Z")

</div>

Dapps should check what network a wallet is connected to. Most dapps are using the fuel connectors. How to check if a wallet is connected to testnet or mainnet? The only way I see right now is to get wallet.provider.url,…

---

## [Error decoding contract event deployed with forc 0.63.5, fuel-core 0.35.0](https://forum.fuel.network/t/error-decoding-contract-event-deployed-with-forc-0-63-5-fuel-core-0-35-0/6639)

<div class="topic-metadata">

**Author:** [@PaulZhemanov](https://forum.fuel.network/u/PaulZhemanov)\
**Replies:** 30\
**Last updated:** [September 24, 2024, 2:04pm UTC](https://forum.fuel.network/t/error-decoding-contract-event-deployed-with-forc-0-63-5-fuel-core-0-35-0/6639 "2024-09-24T14:04:59Z")

</div>

Hi Fuel team! I got a problem with docoding contract event(with fuels-ts 0.94.6): \[21:18:23.649\] ERROR (41038): error decoding event chainId: 0 logType: "Block Range Query" workerType: "HyperFuel" fromB…

---

## [How to read contract logs](https://forum.fuel.network/t/how-to-read-contract-logs/6668)

<div class="topic-metadata">

**Author:** [@mpoplavkov](https://forum.fuel.network/u/mpoplavkov)\
**Replies:** 2\
**Last updated:** [September 24, 2024, 9:24am UTC](https://forum.fuel.network/t/how-to-read-contract-logs/6668 "2024-09-24T09:24:15Z")

</div>

Given a transaction id from the past, how to get its logs and decode them? Is it necessary to provide the contract abi for that? Please give an example, it’s not clear from the docs

---

## [\`.get()\` method calls \`dryRun\` and \`estimateGasPrice\`](https://forum.fuel.network/t/get-method-calls-dryrun-and-estimategasprice/6651)

<div class="topic-metadata">

**Author:** [@martines3000](https://forum.fuel.network/u/martines3000)\
**Replies:** 11\
**Last updated:** [September 23, 2024, 6:26pm UTC](https://forum.fuel.network/t/get-method-calls-dryrun-and-estimategasprice/6651 "2024-09-23T18:26:38Z")

</div>

Version used: @fuel-ts/contract: "^0.94.6" @fuels/connectors": "^0.27.1" @fuels/react": "^0.27.1" fuels: "^0.94.6" I generated the smart contract types using fuels typegen. Smart contract reads being executed as foll…

---

## [\`Wallet.generate()\` not working when using through an NPM SDK but works fine when used directly in a React app](https://forum.fuel.network/t/wallet-generate-not-working-when-using-through-an-npm-sdk-but-works-fine-when-used-directly-in-a-react-app/6642)

<div class="topic-metadata">

**Author:** [@bobby-lync](https://forum.fuel.network/u/bobby-lync)\
**Replies:** 5\
**Last updated:** [September 20, 2024, 1:23pm UTC](https://forum.fuel.network/t/wallet-generate-not-working-when-using-through-an-npm-sdk-but-works-fine-when-used-directly-in-a-react-app/6642 "2024-09-20T13:23:10Z")

</div>

I am building an NPM SDK in which I need to generate a Fuel account using Wallet.generate() method which comes from fuels SDK. When I try to generate the account using the same method in a React app, it works fine and a…

---

## [Babel issues on generated typescript types](https://forum.fuel.network/t/babel-issues-on-generated-typescript-types/6632)

<div class="topic-metadata">

**Author:** [@diyahir](https://forum.fuel.network/u/diyahir)\
**Replies:** 10\
**Last updated:** [September 19, 2024, 7:58am UTC](https://forum.fuel.network/t/babel-issues-on-generated-typescript-types/6632 "2024-09-19T07:58:35Z")

</div>

SyntaxError: src/types/active-pool-contract/ActivePoolContract.ts: TypeScript ‘declare’ fields must first be transformed by @babel/plugin-transform-typescript. If you have already enabled that plugin (or ‘@babel/preset-…

---

## [Unable to parse array data by using latest TS SDK](https://forum.fuel.network/t/unable-to-parse-array-data-by-using-latest-ts-sdk/6592)

<div class="topic-metadata">

**Author:** [@Clara](https://forum.fuel.network/u/Clara)\
**Replies:** 12\
**Last updated:** [September 12, 2024, 2:21pm UTC](https://forum.fuel.network/t/unable-to-parse-array-data-by-using-latest-ts-sdk/6592 "2024-09-12T14:21:56Z")

</div>

My Contract content below #\[storage(read)\] fn get\_share\_bonus\_list(\_identity: Identity) -\> Vec\<BonusList\>{ let \_epoch = storage.epoch.read(); if \_epoch \< 2{ return Vec::new(); }el…

---

## [Typescript typegen doesn't support some types](https://forum.fuel.network/t/typescript-typegen-doesnt-support-some-types/6546)

<div class="topic-metadata">

**Author:** [@mpoplavkov](https://forum.fuel.network/u/mpoplavkov)\
**Replies:** 8\
**Last updated:** [September 9, 2024, 4:52pm UTC](https://forum.fuel.network/t/typescript-typegen-doesnt-support-some-types/6546 "2024-09-09T16:52:31Z")

</div>

I’m trying to generate ts wrappers for my contracts and getting this error: error: Type not supported: (struct std::asset\_id::AssetId, struct std::asset\_id::AssetId, bool) I indeed have a type (AssetId, AssetId, bool) …

---

## [Mint Native Tokens with SDK](https://forum.fuel.network/t/mint-native-tokens-with-sdk/6568)

<div class="topic-metadata">

**Author:** [@KITSCHO](https://forum.fuel.network/u/KITSCHO)\
**Replies:** 13\
**Last updated:** [September 8, 2024, 6:41pm UTC](https://forum.fuel.network/t/mint-native-tokens-with-sdk/6568 "2024-09-08T18:41:02Z")

</div>

I want to mint native asset but I keep getting an error FuelError: The transaction reverted with an unknown reason: 0 This is my function const mintTokens = async () =\> { if (!provider || !account) { …

---

## [Any suggestions how to do gasless transactions?](https://forum.fuel.network/t/any-suggestions-how-to-do-gasless-transactions/5292)

<div class="topic-metadata">

**Author:** [@shivamlync](https://forum.fuel.network/u/shivamlync)\
**Replies:** 3\
**Last updated:** [September 8, 2024, 3:53pm UTC](https://forum.fuel.network/t/any-suggestions-how-to-do-gasless-transactions/5292 "2024-09-08T15:53:06Z")

</div>

I was trying to implement gasless transactions. Is it possible to achieve it using fuel?

---

## [The fail of outofgas transactions is too high. How to avoid it?](https://forum.fuel.network/t/the-fail-of-outofgas-transactions-is-too-high-how-to-avoid-it/6565)

<div class="topic-metadata">

**Author:** [@Clara](https://forum.fuel.network/u/Clara)\
**Replies:** 7\
**Last updated:** [September 8, 2024, 12:34am UTC](https://forum.fuel.network/t/the-fail-of-outofgas-transactions-is-too-high-how-to-avoid-it/6565 "2024-09-08T00:34:32Z")

</div>

In the past, there would only be an occasional failed outofgas transaction out of about 10 transactions. Now at least 5 out of 10 transactions are failed outofgas transactions. This is a terrible experience. We use Type…

---

## [Error with deployment script with Typescript SDK](https://forum.fuel.network/t/error-with-deployment-script-with-typescript-sdk/6563)

<div class="topic-metadata">

**Author:** [@KITSCHO](https://forum.fuel.network/u/KITSCHO)\
**Replies:** 4\
**Last updated:** [September 5, 2024, 6:06am UTC](https://forum.fuel.network/t/error-with-deployment-script-with-typescript-sdk/6563 "2024-09-05T06:06:07Z")

</div>

This is my deployment script but I get an error when creating factory instance. Error deploying contract: TypeError: Class constructor ContractFactory cannot be invoked without 'new' I have simple counter contract from…

---

## [Type 'WalletUnlocked' is not assignable to type 'Account'](https://forum.fuel.network/t/type-walletunlocked-is-not-assignable-to-type-account/6543)

<div class="topic-metadata">

**Author:** [@xpluscal](https://forum.fuel.network/u/xpluscal)\
**Replies:** 8\
**Last updated:** [September 3, 2024, 3:46am UTC](https://forum.fuel.network/t/type-walletunlocked-is-not-assignable-to-type-account/6543 "2024-09-03T03:46:08Z")

</div>

With the lastest fuel 0.94.0 when trying to deploy a contract with this: // Create a wallet instance from the address const wallet = Wallet.fromPrivateKey(process.env.WALLET\_PRIVATE\_KEY as string); // Connect to the …

---

## [FuelError: Invalid struct Vec. Field "buf" not present](https://forum.fuel.network/t/fuelerror-invalid-struct-vec-field-buf-not-present/6553)

<div class="topic-metadata">

**Author:** [@liny52](https://forum.fuel.network/u/liny52)\
**Replies:** 1\
**Last updated:** [September 2, 2024, 4:59am UTC](https://forum.fuel.network/t/fuelerror-invalid-struct-vec-field-buf-not-present/6553 "2024-09-02T04:59:42Z")

</div>

“fuels”: “^0.94.2” Error calling contract function: \_FuelError: Invalid struct Vec. Field “buf” not present. This problem does not occur in fuels ^0.91.0 version

---

## [How to convert json to TransactionRequest?](https://forum.fuel.network/t/how-to-convert-json-to-transactionrequest/6539)

<div class="topic-metadata">

**Author:** [@mpoplavkov](https://forum.fuel.network/u/mpoplavkov)\
**Replies:** 1\
**Last updated:** [August 28, 2024, 6:14pm UTC](https://forum.fuel.network/t/how-to-convert-json-to-transactionrequest/6539 "2024-08-28T18:14:35Z")

</div>

There is toJson function on TransactionRequest option, that converts the request to json. How to do a reverse conversion, ie from json to TransactionRequest?

---

## [Running \`fuels typegen\` command generates different contract factories each run](https://forum.fuel.network/t/running-fuels-typegen-command-generates-different-contract-factories-each-run/6531)

<div class="topic-metadata">

**Author:** [@martines3000](https://forum.fuel.network/u/martines3000)\
**Replies:** 8\
**Last updated:** [August 28, 2024, 6:05am UTC](https://forum.fuel.network/t/running-fuels-typegen-command-generates-different-contract-factories-each-run/6531 "2024-08-28T06:05:13Z")

</div>

Versions used: fuels - 0.94.1 toolchain channel latest-aarch64-apple-darwin (and tried with nightly-2024-08-27) forc - 0.63.1 fuel-core - 0.34.0 The expected behavior is that the output of the typegen command should r…

---

## [FuelError: Invalid u64](https://forum.fuel.network/t/fuelerror-invalid-u64/6515)

<div class="topic-metadata">

**Author:** [@chappie1998](https://forum.fuel.network/u/chappie1998)\
**Replies:** 1\
**Last updated:** [August 23, 2024, 11:51am UTC](https://forum.fuel.network/t/fuelerror-invalid-u64/6515 "2024-08-23T11:51:57Z")

</div>

I am trying to make a contract call in TS. Fuels TS:- 0.94.0 fuel-toolchain.toml forc = “0.63.1” fuel-core = “0.33.0” My TS call:- const provider = await getProvider(); const contract = await getContract();…

---

## [Query balance issue](https://forum.fuel.network/t/query-balance-issue/6494)

<div class="topic-metadata">

**Author:** [@aravindhk](https://forum.fuel.network/u/aravindhk)\
**Replies:** 6\
**Last updated:** [August 23, 2024, 9:22am UTC](https://forum.fuel.network/t/query-balance-issue/6494 "2024-08-23T09:22:44Z")

</div>

const contract\_wallet = Wallet.fromAddress(toBech32(market\_contract\_id), provider); const contract\_token\_all\_balance = await contract\_wallet.getBalances() console.log("contract\_token\_all\_balance", contract\_token\_all\_bala…

---

## [New TS-SDK Requires Buffer, which hinders frontend dev](https://forum.fuel.network/t/new-ts-sdk-requires-buffer-which-hinders-frontend-dev/6487)

<div class="topic-metadata">

**Author:** [@xpluscal](https://forum.fuel.network/u/xpluscal)\
**Replies:** 6\
**Last updated:** [August 22, 2024, 2:21pm UTC](https://forum.fuel.network/t/new-ts-sdk-requires-buffer-which-hinders-frontend-dev/6487 "2024-08-22T14:21:31Z")

</div>

The latest version of the TS SDK (0.94.0) uses decompressBytecode function in the factory, which requires the node builtin Buffer, which isn’t available in most Frontend Envs and causes issues especially with Vite. This…

[Previous page](https://forum.fuel.network/c/typescript-sdk/10.md)

[Next page](https://forum.fuel.network/c/typescript-sdk/10.md?page=2)
