@layerswap/wallet-fuel 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # @layerswap/wallet-fuel
2
+
3
+ Fuel wallet provider for the Layerswap Widget. Enables Fuel blockchain wallet connections and transactions.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @layerswap/wallet-fuel wagmi viem @wagmi/core @tanstack/react-query
9
+ # or
10
+ yarn add @layerswap/wallet-fuel wagmi viem @wagmi/core @tanstack/react-query
11
+ # or
12
+ pnpm add @layerswap/wallet-fuel wagmi viem @wagmi/core @tanstack/react-query
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ```tsx
18
+ import { LayerswapProvider, Swap } from "@layerswap/widget";
19
+ import { createFuelProvider } from "@layerswap/wallet-fuel";
20
+
21
+ export default function Page() {
22
+ const fuelProvider = createFuelProvider();
23
+
24
+ return (
25
+ <LayerswapProvider walletProviders={[fuelProvider]}>
26
+ <Swap />
27
+ </LayerswapProvider>
28
+ );
29
+ }
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ Use `createFuelProvider()` to create a Fuel wallet provider:
35
+
36
+ ```tsx
37
+ import { createFuelProvider } from "@layerswap/wallet-fuel";
38
+
39
+ const fuelProvider = createFuelProvider({
40
+ // Custom configuration options
41
+ });
42
+ ```
43
+
44
+ ## Documentation
45
+
46
+ For detailed setup instructions, configuration options, and usage examples, see the [Fuel Wallet Provider documentation](https://docs.layerswap.io/integration/UI/Widget/WalletManagement/FuelProvider).
47
+
48
+ ## Features
49
+
50
+ - Fuel wallet connection via Fuel SDK
51
+ - Balance checking
52
+ - Gas estimation
53
+ - Address validation and utilities
54
+ - Fuel transaction support
55
+ - Integration with `@fuels/react` for React hooks
56
+
57
+ ## TypeScript
58
+
59
+ This package includes TypeScript definitions. All types are exported from the main entry point.
60
+
61
+ ## License
62
+
63
+ MIT
64
+
65
+ ## Repository
66
+
67
+ [GitHub](https://github.com/layerswap/layerswapapp/tree/main/packages/wallets/fuel)
68
+
@@ -46,14 +46,13 @@ export class FuelBalanceProvider extends BalanceProvider {
46
46
  decimals: token.decimals,
47
47
  isNativeCurrency: network.token?.symbol === token.symbol,
48
48
  token: token.symbol,
49
- request_time: new Date().toJSON(),
50
- error: balance?.amount === undefined ? `Could not fetch balance for ${token.symbol}` : undefined
49
+ request_time: new Date().toJSON()
51
50
  };
52
51
  balances.push(balanceObj);
53
52
  }
54
53
  }
55
54
  catch (e) {
56
- return network.tokens.map((currency) => (this.resolveTokenBalanceFetchError(e, currency, network)));
55
+ throw e;
57
56
  }
58
57
  return balances;
59
58
  };
@@ -160,7 +160,8 @@ export default function useFuelConnection({ networks }) {
160
160
  id: c.name,
161
161
  icon: typeof c.metadata.image === 'string' ? c.metadata.image : (c.metadata.image?.dark.startsWith('data:') ? c.metadata.image.dark : `data:image/svg+xml;base64,${c.metadata.image && btoa(c.metadata.image.dark)}`),
162
162
  type: isInstalled ? 'injected' : 'other',
163
- installUrl: c.installed ? undefined : c.metadata.install.link,
163
+ installUrl: c.metadata.install.link,
164
+ extensionNotFound: !c.installed
164
165
  };
165
166
  });
166
167
  const provider = {