use-stellar 0.1.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/dist/index.d.mts +180 -0
- package/dist/index.d.ts +180 -0
- package/dist/index.js +527 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +489 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +73 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
// src/context/StellarProvider.tsx
|
|
2
|
+
import React, {
|
|
3
|
+
createContext,
|
|
4
|
+
useContext,
|
|
5
|
+
useState
|
|
6
|
+
} from "react";
|
|
7
|
+
|
|
8
|
+
// src/types/index.ts
|
|
9
|
+
var NETWORK_CONFIGS = {
|
|
10
|
+
testnet: {
|
|
11
|
+
network: "testnet",
|
|
12
|
+
horizonUrl: "https://horizon-testnet.stellar.org",
|
|
13
|
+
sorobanUrl: "https://soroban-testnet.stellar.org"
|
|
14
|
+
},
|
|
15
|
+
mainnet: {
|
|
16
|
+
network: "mainnet",
|
|
17
|
+
horizonUrl: "https://horizon.stellar.org",
|
|
18
|
+
sorobanUrl: "https://soroban.stellar.org"
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// src/context/StellarProvider.tsx
|
|
23
|
+
var DEFAULT_WALLET = {
|
|
24
|
+
connected: false,
|
|
25
|
+
address: null,
|
|
26
|
+
network: null,
|
|
27
|
+
wallet: null,
|
|
28
|
+
connecting: false,
|
|
29
|
+
error: null
|
|
30
|
+
};
|
|
31
|
+
var StellarContext = createContext(null);
|
|
32
|
+
function StellarProvider({
|
|
33
|
+
network = "testnet",
|
|
34
|
+
children
|
|
35
|
+
}) {
|
|
36
|
+
const [wallet, setWallet] = useState(DEFAULT_WALLET);
|
|
37
|
+
const value = {
|
|
38
|
+
network,
|
|
39
|
+
networkConfig: NETWORK_CONFIGS[network],
|
|
40
|
+
wallet,
|
|
41
|
+
setWallet
|
|
42
|
+
};
|
|
43
|
+
return /* @__PURE__ */ React.createElement(StellarContext.Provider, { value }, children);
|
|
44
|
+
}
|
|
45
|
+
function useStellarContext() {
|
|
46
|
+
const ctx = useContext(StellarContext);
|
|
47
|
+
if (!ctx) {
|
|
48
|
+
throw new Error(
|
|
49
|
+
"use-stellar: No StellarProvider found. Wrap your app in <StellarProvider> before using any use-stellar hooks."
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
return ctx;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// src/hooks/useWallet.ts
|
|
56
|
+
import { useCallback } from "react";
|
|
57
|
+
function useWallet() {
|
|
58
|
+
const { wallet, setWallet, network } = useStellarContext();
|
|
59
|
+
const connect = useCallback(
|
|
60
|
+
async (walletType = "freighter") => {
|
|
61
|
+
setWallet((prev) => ({ ...prev, connecting: true, error: null }));
|
|
62
|
+
try {
|
|
63
|
+
let address;
|
|
64
|
+
if (walletType === "freighter") {
|
|
65
|
+
address = await connectFreighter(network);
|
|
66
|
+
} else {
|
|
67
|
+
throw new Error(
|
|
68
|
+
`Wallet "${walletType}" not yet supported. Contributions welcome \u2014 see GitHub issues.`
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
setWallet({
|
|
72
|
+
connected: true,
|
|
73
|
+
address,
|
|
74
|
+
network,
|
|
75
|
+
wallet: walletType,
|
|
76
|
+
connecting: false,
|
|
77
|
+
error: null
|
|
78
|
+
});
|
|
79
|
+
} catch (err) {
|
|
80
|
+
setWallet((prev) => ({
|
|
81
|
+
...prev,
|
|
82
|
+
connecting: false,
|
|
83
|
+
error: err instanceof Error ? err.message : "Failed to connect wallet"
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
[setWallet, network]
|
|
88
|
+
);
|
|
89
|
+
const disconnect = useCallback(() => {
|
|
90
|
+
setWallet({
|
|
91
|
+
connected: false,
|
|
92
|
+
address: null,
|
|
93
|
+
network: null,
|
|
94
|
+
wallet: null,
|
|
95
|
+
connecting: false,
|
|
96
|
+
error: null
|
|
97
|
+
});
|
|
98
|
+
}, [setWallet]);
|
|
99
|
+
return { ...wallet, connect, disconnect };
|
|
100
|
+
}
|
|
101
|
+
async function connectFreighter(network) {
|
|
102
|
+
const freighter = window.freighter;
|
|
103
|
+
if (!freighter) {
|
|
104
|
+
throw new Error(
|
|
105
|
+
"Freighter wallet not found. Install the Freighter browser extension and try again."
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
const isAllowed = await freighter.isAllowed();
|
|
109
|
+
if (!isAllowed) {
|
|
110
|
+
await freighter.setAllowed();
|
|
111
|
+
}
|
|
112
|
+
const { publicKey } = await freighter.getPublicKey();
|
|
113
|
+
const { networkPassphrase } = await freighter.getNetworkDetails();
|
|
114
|
+
const expectedPassphrase = network === "mainnet" ? "Public Global Stellar Network ; September 2015" : "Test SDF Network ; September 2015";
|
|
115
|
+
if (networkPassphrase !== expectedPassphrase) {
|
|
116
|
+
throw new Error(
|
|
117
|
+
`Wrong network. Switch Freighter to ${network} and try again.`
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
return publicKey;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// src/hooks/useBalance.ts
|
|
124
|
+
import { useState as useState2, useEffect, useCallback as useCallback2 } from "react";
|
|
125
|
+
|
|
126
|
+
// src/utils/index.ts
|
|
127
|
+
import { Horizon } from "@stellar/stellar-sdk";
|
|
128
|
+
function getHorizonServer(network) {
|
|
129
|
+
return new Horizon.Server(NETWORK_CONFIGS[network].horizonUrl);
|
|
130
|
+
}
|
|
131
|
+
function isNativeAsset(asset) {
|
|
132
|
+
return asset === "XLM";
|
|
133
|
+
}
|
|
134
|
+
function formatAssetCode(asset) {
|
|
135
|
+
return isNativeAsset(asset) ? "XLM" : asset.code;
|
|
136
|
+
}
|
|
137
|
+
function parseHorizonBalance(raw) {
|
|
138
|
+
if (raw.asset_type === "native") {
|
|
139
|
+
return {
|
|
140
|
+
asset: "XLM",
|
|
141
|
+
balance: raw.balance
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
const issued = raw;
|
|
145
|
+
return {
|
|
146
|
+
asset: {
|
|
147
|
+
code: issued.asset_code,
|
|
148
|
+
issuer: issued.asset_issuer
|
|
149
|
+
},
|
|
150
|
+
balance: issued.balance,
|
|
151
|
+
limit: issued.limit
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function isValidStellarAddress(address) {
|
|
155
|
+
return /^G[A-Z0-9]{55}$/.test(address);
|
|
156
|
+
}
|
|
157
|
+
function shortenAddress(address, chars = 6) {
|
|
158
|
+
if (!address) return "";
|
|
159
|
+
return `${address.slice(0, chars)}...${address.slice(-chars)}`;
|
|
160
|
+
}
|
|
161
|
+
function formatAmount(amount, decimals = 7) {
|
|
162
|
+
const num = parseFloat(amount);
|
|
163
|
+
if (isNaN(num)) return "0";
|
|
164
|
+
return num.toFixed(decimals).replace(/\.?0+$/, "");
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// src/hooks/useBalance.ts
|
|
168
|
+
function useBalance({
|
|
169
|
+
address,
|
|
170
|
+
asset = "XLM",
|
|
171
|
+
watch = false
|
|
172
|
+
} = {}) {
|
|
173
|
+
const { network, wallet } = useStellarContext();
|
|
174
|
+
const resolvedAddress = address ?? wallet.address;
|
|
175
|
+
const [balances, setBalances] = useState2([]);
|
|
176
|
+
const [loading, setLoading] = useState2(false);
|
|
177
|
+
const [error, setError] = useState2(null);
|
|
178
|
+
const fetchBalances = useCallback2(async () => {
|
|
179
|
+
if (!resolvedAddress) return;
|
|
180
|
+
setLoading(true);
|
|
181
|
+
setError(null);
|
|
182
|
+
try {
|
|
183
|
+
const server = getHorizonServer(network);
|
|
184
|
+
const account = await server.loadAccount(resolvedAddress);
|
|
185
|
+
const parsed = account.balances.map(parseHorizonBalance);
|
|
186
|
+
setBalances(parsed);
|
|
187
|
+
} catch (err) {
|
|
188
|
+
setError(err instanceof Error ? err.message : "Failed to fetch balance");
|
|
189
|
+
} finally {
|
|
190
|
+
setLoading(false);
|
|
191
|
+
}
|
|
192
|
+
}, [resolvedAddress, network]);
|
|
193
|
+
useEffect(() => {
|
|
194
|
+
fetchBalances();
|
|
195
|
+
if (watch) {
|
|
196
|
+
const interval = setInterval(fetchBalances, 1e4);
|
|
197
|
+
return () => clearInterval(interval);
|
|
198
|
+
}
|
|
199
|
+
}, [fetchBalances, watch]);
|
|
200
|
+
const match = balances.find((b) => {
|
|
201
|
+
if (asset === "XLM") return b.asset === "XLM";
|
|
202
|
+
if (typeof asset === "object" && typeof b.asset === "object") {
|
|
203
|
+
return b.asset.code === asset.code && b.asset.issuer === asset.issuer;
|
|
204
|
+
}
|
|
205
|
+
return false;
|
|
206
|
+
});
|
|
207
|
+
const balance = match?.balance ?? null;
|
|
208
|
+
return {
|
|
209
|
+
balance,
|
|
210
|
+
balances,
|
|
211
|
+
loading,
|
|
212
|
+
error,
|
|
213
|
+
refetch: fetchBalances
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// src/hooks/useAccount.ts
|
|
218
|
+
import { useState as useState3, useEffect as useEffect2 } from "react";
|
|
219
|
+
function useAccount({ address } = {}) {
|
|
220
|
+
const { network, wallet } = useStellarContext();
|
|
221
|
+
const resolvedAddress = address ?? wallet.address;
|
|
222
|
+
const [account, setAccount] = useState3(null);
|
|
223
|
+
const [loading, setLoading] = useState3(false);
|
|
224
|
+
const [error, setError] = useState3(null);
|
|
225
|
+
async function fetchAccount() {
|
|
226
|
+
if (!resolvedAddress) return;
|
|
227
|
+
setLoading(true);
|
|
228
|
+
setError(null);
|
|
229
|
+
try {
|
|
230
|
+
const server = getHorizonServer(network);
|
|
231
|
+
const raw = await server.loadAccount(resolvedAddress);
|
|
232
|
+
const info = {
|
|
233
|
+
address: raw.id,
|
|
234
|
+
sequence: raw.sequenceNumber(),
|
|
235
|
+
balances: raw.balances.map(parseHorizonBalance),
|
|
236
|
+
subentryCount: raw.subentry_count,
|
|
237
|
+
thresholds: {
|
|
238
|
+
lowThreshold: raw.thresholds.low_threshold,
|
|
239
|
+
medThreshold: raw.thresholds.med_threshold,
|
|
240
|
+
highThreshold: raw.thresholds.high_threshold
|
|
241
|
+
},
|
|
242
|
+
signers: raw.signers.map((s) => ({
|
|
243
|
+
key: s.key,
|
|
244
|
+
weight: s.weight,
|
|
245
|
+
type: s.type
|
|
246
|
+
}))
|
|
247
|
+
};
|
|
248
|
+
setAccount(info);
|
|
249
|
+
} catch (err) {
|
|
250
|
+
setError(err instanceof Error ? err.message : "Failed to fetch account");
|
|
251
|
+
} finally {
|
|
252
|
+
setLoading(false);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
useEffect2(() => {
|
|
256
|
+
fetchAccount();
|
|
257
|
+
}, [resolvedAddress, network]);
|
|
258
|
+
return { account, loading, error, refetch: fetchAccount };
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// src/hooks/useSendPayment.ts
|
|
262
|
+
import { useState as useState4, useCallback as useCallback3 } from "react";
|
|
263
|
+
import {
|
|
264
|
+
TransactionBuilder,
|
|
265
|
+
Networks,
|
|
266
|
+
BASE_FEE,
|
|
267
|
+
Operation,
|
|
268
|
+
Asset as StellarAsset,
|
|
269
|
+
Memo
|
|
270
|
+
} from "@stellar/stellar-sdk";
|
|
271
|
+
function useSendPayment() {
|
|
272
|
+
const { network, networkConfig, wallet } = useStellarContext();
|
|
273
|
+
const [loading, setLoading] = useState4(false);
|
|
274
|
+
const [error, setError] = useState4(null);
|
|
275
|
+
const [result, setResult] = useState4(null);
|
|
276
|
+
const send = useCallback3(
|
|
277
|
+
async (options) => {
|
|
278
|
+
if (!wallet.connected || !wallet.address) {
|
|
279
|
+
throw new Error("Wallet not connected. Call connect() first.");
|
|
280
|
+
}
|
|
281
|
+
setLoading(true);
|
|
282
|
+
setError(null);
|
|
283
|
+
try {
|
|
284
|
+
const server = getHorizonServer(network);
|
|
285
|
+
const sourceAcc = await server.loadAccount(wallet.address);
|
|
286
|
+
const networkPass = network === "mainnet" ? Networks.PUBLIC : Networks.TESTNET;
|
|
287
|
+
const stellarAsset = toStellarAsset(options.asset);
|
|
288
|
+
const operation = Operation.payment({
|
|
289
|
+
destination: options.to,
|
|
290
|
+
asset: stellarAsset,
|
|
291
|
+
amount: options.amount
|
|
292
|
+
});
|
|
293
|
+
const builder = new TransactionBuilder(sourceAcc, {
|
|
294
|
+
fee: BASE_FEE,
|
|
295
|
+
networkPassphrase: networkPass
|
|
296
|
+
}).addOperation(operation).setTimeout(30);
|
|
297
|
+
if (options.memo) {
|
|
298
|
+
builder.addMemo(Memo.text(options.memo));
|
|
299
|
+
}
|
|
300
|
+
const tx = builder.build();
|
|
301
|
+
const xdr = tx.toXDR();
|
|
302
|
+
const freighter = window.freighter;
|
|
303
|
+
if (!freighter) throw new Error("Freighter wallet not found");
|
|
304
|
+
const { signedTxXdr } = await freighter.signTransaction(xdr, {
|
|
305
|
+
networkPassphrase: networkPass
|
|
306
|
+
});
|
|
307
|
+
const signed = TransactionBuilder.fromXDR(signedTxXdr, networkPass);
|
|
308
|
+
const res = await server.submitTransaction(signed);
|
|
309
|
+
const outcome = {
|
|
310
|
+
hash: res.hash,
|
|
311
|
+
status: "success"
|
|
312
|
+
};
|
|
313
|
+
setResult(outcome);
|
|
314
|
+
return outcome;
|
|
315
|
+
} catch (err) {
|
|
316
|
+
const message = err instanceof Error ? err.message : "Transaction failed";
|
|
317
|
+
setError(message);
|
|
318
|
+
throw new Error(message);
|
|
319
|
+
} finally {
|
|
320
|
+
setLoading(false);
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
[network, wallet]
|
|
324
|
+
);
|
|
325
|
+
const reset = useCallback3(() => {
|
|
326
|
+
setError(null);
|
|
327
|
+
setResult(null);
|
|
328
|
+
}, []);
|
|
329
|
+
return { send, loading, error, result, reset };
|
|
330
|
+
}
|
|
331
|
+
function toStellarAsset(asset) {
|
|
332
|
+
if (isNativeAsset(asset)) return StellarAsset.native();
|
|
333
|
+
return new StellarAsset(asset.code, asset.issuer);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// src/hooks/useTransaction.ts
|
|
337
|
+
import { useState as useState5, useEffect as useEffect3, useRef, useCallback as useCallback4 } from "react";
|
|
338
|
+
function useTransaction({
|
|
339
|
+
hash,
|
|
340
|
+
watch = false
|
|
341
|
+
}) {
|
|
342
|
+
const { network } = useStellarContext();
|
|
343
|
+
const [transaction, setTransaction] = useState5(null);
|
|
344
|
+
const [loading, setLoading] = useState5(false);
|
|
345
|
+
const [error, setError] = useState5(null);
|
|
346
|
+
const transactionRef = useRef(null);
|
|
347
|
+
transactionRef.current = transaction;
|
|
348
|
+
const fetchTransaction = useCallback4(async () => {
|
|
349
|
+
if (!hash) return;
|
|
350
|
+
setLoading(true);
|
|
351
|
+
setError(null);
|
|
352
|
+
try {
|
|
353
|
+
const server = getHorizonServer(network);
|
|
354
|
+
const raw = await server.transactions().transaction(hash).call();
|
|
355
|
+
const status = raw.successful ? "success" : "failed";
|
|
356
|
+
setTransaction({
|
|
357
|
+
hash: raw.hash,
|
|
358
|
+
status,
|
|
359
|
+
ledger: Number(raw.ledger),
|
|
360
|
+
createdAt: raw.created_at,
|
|
361
|
+
fee: String(raw.fee_charged)
|
|
362
|
+
});
|
|
363
|
+
} catch (err) {
|
|
364
|
+
const is404 = err?.response?.status === 404;
|
|
365
|
+
if (is404) {
|
|
366
|
+
setTransaction({ hash, status: watch ? "pending" : "not_found" });
|
|
367
|
+
} else {
|
|
368
|
+
setError(err instanceof Error ? err.message : "Failed to fetch transaction");
|
|
369
|
+
}
|
|
370
|
+
} finally {
|
|
371
|
+
setLoading(false);
|
|
372
|
+
}
|
|
373
|
+
}, [hash, network, watch]);
|
|
374
|
+
useEffect3(() => {
|
|
375
|
+
fetchTransaction();
|
|
376
|
+
if (watch) {
|
|
377
|
+
const interval = setInterval(() => {
|
|
378
|
+
const status = transactionRef.current?.status;
|
|
379
|
+
if (status === "success" || status === "failed") return;
|
|
380
|
+
fetchTransaction();
|
|
381
|
+
}, 3e3);
|
|
382
|
+
return () => clearInterval(interval);
|
|
383
|
+
}
|
|
384
|
+
}, [fetchTransaction, watch]);
|
|
385
|
+
return { transaction, loading, error, refetch: fetchTransaction };
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// src/hooks/useNetwork.ts
|
|
389
|
+
function useNetwork() {
|
|
390
|
+
const { network, networkConfig } = useStellarContext();
|
|
391
|
+
return {
|
|
392
|
+
network,
|
|
393
|
+
networkConfig,
|
|
394
|
+
isTestnet: network === "testnet",
|
|
395
|
+
isMainnet: network === "mainnet"
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// src/hooks/useAsset.ts
|
|
400
|
+
import { useState as useState6, useEffect as useEffect4, useCallback as useCallback5 } from "react";
|
|
401
|
+
function useAsset({ code, issuer }) {
|
|
402
|
+
const { network } = useStellarContext();
|
|
403
|
+
const [asset, setAsset] = useState6(null);
|
|
404
|
+
const [loading, setLoading] = useState6(false);
|
|
405
|
+
const [error, setError] = useState6(null);
|
|
406
|
+
const fetchAsset = useCallback5(async () => {
|
|
407
|
+
setLoading(true);
|
|
408
|
+
setError(null);
|
|
409
|
+
try {
|
|
410
|
+
const server = getHorizonServer(network);
|
|
411
|
+
const res = await server.assets().forCode(code).forIssuer(issuer).call();
|
|
412
|
+
const raw = res.records[0];
|
|
413
|
+
if (!raw) throw new Error(`Asset ${code}:${issuer} not found`);
|
|
414
|
+
const assetRecord = raw;
|
|
415
|
+
setAsset({
|
|
416
|
+
code: raw.asset_code,
|
|
417
|
+
issuer: raw.asset_issuer,
|
|
418
|
+
supply: raw.amount,
|
|
419
|
+
numAccounts: raw.num_accounts,
|
|
420
|
+
homeDomain: assetRecord.home_domain,
|
|
421
|
+
flags: {
|
|
422
|
+
authRequired: raw.flags.auth_required,
|
|
423
|
+
authRevocable: raw.flags.auth_revocable,
|
|
424
|
+
authImmutable: raw.flags.auth_immutable
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
} catch (err) {
|
|
428
|
+
setError(err instanceof Error ? err.message : "Failed to fetch asset");
|
|
429
|
+
} finally {
|
|
430
|
+
setLoading(false);
|
|
431
|
+
}
|
|
432
|
+
}, [code, issuer, network]);
|
|
433
|
+
useEffect4(() => {
|
|
434
|
+
fetchAsset();
|
|
435
|
+
}, [fetchAsset]);
|
|
436
|
+
return { asset, loading, error, refetch: fetchAsset };
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
// src/hooks/useSorobanContract.ts
|
|
440
|
+
import { useState as useState7, useEffect as useEffect5, useCallback as useCallback6 } from "react";
|
|
441
|
+
function useSorobanContract({
|
|
442
|
+
contractId,
|
|
443
|
+
method
|
|
444
|
+
}) {
|
|
445
|
+
const { networkConfig } = useStellarContext();
|
|
446
|
+
const [data, setData] = useState7(null);
|
|
447
|
+
const [loading, setLoading] = useState7(false);
|
|
448
|
+
const [error, setError] = useState7(null);
|
|
449
|
+
const callContract = useCallback6(async () => {
|
|
450
|
+
setLoading(true);
|
|
451
|
+
setError(null);
|
|
452
|
+
try {
|
|
453
|
+
if (!contractId || !method) {
|
|
454
|
+
setData(null);
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
setData({
|
|
458
|
+
contractId,
|
|
459
|
+
method,
|
|
460
|
+
network: networkConfig.network,
|
|
461
|
+
note: "Simulation wiring tracked in issue #10"
|
|
462
|
+
});
|
|
463
|
+
} catch (err) {
|
|
464
|
+
setError(err instanceof Error ? err.message : "Contract call failed");
|
|
465
|
+
} finally {
|
|
466
|
+
setLoading(false);
|
|
467
|
+
}
|
|
468
|
+
}, [contractId, method, networkConfig]);
|
|
469
|
+
useEffect5(() => {
|
|
470
|
+
callContract();
|
|
471
|
+
}, [callContract]);
|
|
472
|
+
return { data, loading, error, refetch: callContract };
|
|
473
|
+
}
|
|
474
|
+
export {
|
|
475
|
+
StellarProvider,
|
|
476
|
+
formatAmount,
|
|
477
|
+
formatAssetCode,
|
|
478
|
+
isValidStellarAddress,
|
|
479
|
+
shortenAddress,
|
|
480
|
+
useAccount,
|
|
481
|
+
useAsset,
|
|
482
|
+
useBalance,
|
|
483
|
+
useNetwork,
|
|
484
|
+
useSendPayment,
|
|
485
|
+
useSorobanContract,
|
|
486
|
+
useTransaction,
|
|
487
|
+
useWallet
|
|
488
|
+
};
|
|
489
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/context/StellarProvider.tsx","../src/types/index.ts","../src/hooks/useWallet.ts","../src/hooks/useBalance.ts","../src/utils/index.ts","../src/hooks/useAccount.ts","../src/hooks/useSendPayment.ts","../src/hooks/useTransaction.ts","../src/hooks/useNetwork.ts","../src/hooks/useAsset.ts","../src/hooks/useSorobanContract.ts"],"sourcesContent":["import React, {\n createContext,\n useContext,\n useState,\n type ReactNode,\n} from \"react\";\nimport type {\n StellarContextValue,\n StellarNetwork,\n WalletState,\n} from \"../types\";\nimport { NETWORK_CONFIGS } from \"../types\";\n\n// ── Default wallet state ───────────────────────────────────────────────────\nconst DEFAULT_WALLET: WalletState = {\n connected: false,\n address: null,\n network: null,\n wallet: null,\n connecting: false,\n error: null,\n};\n\n// ── Context ────────────────────────────────────────────────────────────────\nconst StellarContext = createContext<StellarContextValue | null>(null);\n\n// ── Provider ───────────────────────────────────────────────────────────────\nexport interface StellarProviderProps {\n network?: StellarNetwork;\n children: ReactNode;\n}\n\nexport function StellarProvider({\n network = \"testnet\",\n children,\n}: StellarProviderProps) {\n const [wallet, setWallet] = useState<WalletState>(DEFAULT_WALLET);\n\n const value: StellarContextValue = {\n network,\n networkConfig: NETWORK_CONFIGS[network],\n wallet,\n setWallet,\n };\n\n return (\n <StellarContext.Provider value={value}>\n {children}\n </StellarContext.Provider>\n );\n}\n\n// ── Hook to consume context ────────────────────────────────────────────────\nexport function useStellarContext(): StellarContextValue {\n const ctx = useContext(StellarContext);\n if (!ctx) {\n throw new Error(\n \"use-stellar: No StellarProvider found. \" +\n \"Wrap your app in <StellarProvider> before using any use-stellar hooks.\"\n );\n }\n return ctx;\n}\n","import type { Dispatch, SetStateAction } from \"react\";\n\nexport type StellarNetwork = \"testnet\" | \"mainnet\";\n\nexport interface NetworkConfig {\n network: StellarNetwork;\n horizonUrl: string;\n sorobanUrl: string;\n}\n\nexport const NETWORK_CONFIGS: Record<StellarNetwork, NetworkConfig> = {\n testnet: {\n network: \"testnet\",\n horizonUrl: \"https://horizon-testnet.stellar.org\",\n sorobanUrl: \"https://soroban-testnet.stellar.org\",\n },\n mainnet: {\n network: \"mainnet\",\n horizonUrl: \"https://horizon.stellar.org\",\n sorobanUrl: \"https://soroban.stellar.org\",\n },\n};\n\nexport type WalletType = \"freighter\" | \"albedo\" | \"rabet\";\n\nexport interface WalletState {\n connected: boolean;\n address: string | null;\n network: StellarNetwork | null;\n wallet: WalletType | null;\n connecting: boolean;\n error: string | null;\n}\n\nexport type NativeAsset = \"XLM\";\n\nexport interface IssuedAsset {\n code: string;\n issuer: string;\n}\n\nexport type Asset = NativeAsset | IssuedAsset;\n\nexport interface Balance {\n asset: Asset;\n balance: string;\n limit?: string;\n buying?: string;\n selling?: string;\n}\n\nexport interface AccountInfo {\n address: string;\n sequence: string;\n balances: Balance[];\n subentryCount: number;\n thresholds: {\n lowThreshold: number;\n medThreshold: number;\n highThreshold: number;\n };\n signers: {\n key: string;\n weight: number;\n type: string;\n }[];\n}\n\nexport type TransactionStatus = \"pending\" | \"success\" | \"failed\" | \"not_found\";\n\nexport interface TransactionResult {\n hash: string;\n status: TransactionStatus;\n ledger?: number;\n createdAt?: string;\n fee?: string;\n}\n\nexport interface SendPaymentOptions {\n to: string;\n asset: Asset;\n amount: string;\n memo?: string;\n}\n\nexport interface SendPaymentResult {\n hash: string;\n status: TransactionStatus;\n}\n\nexport interface ContractCallOptions {\n contractId: string;\n method: string;\n args?: unknown[];\n}\n\nexport interface StellarContextValue {\n network: StellarNetwork;\n networkConfig: NetworkConfig;\n wallet: WalletState;\n setWallet: Dispatch<SetStateAction<WalletState>>;\n}\n","import { useCallback } from \"react\";\nimport { useStellarContext } from \"../context/StellarProvider\";\nimport type { WalletState, WalletType } from \"../types\";\n\nexport interface UseWalletReturn extends WalletState {\n connect: (wallet?: WalletType) => Promise<void>;\n disconnect: () => void;\n}\n\nexport function useWallet(): UseWalletReturn {\n const { wallet, setWallet, network } = useStellarContext();\n\n const connect = useCallback(\n async (walletType: WalletType = \"freighter\") => {\n setWallet(prev => ({ ...prev, connecting: true, error: null }));\n\n try {\n let address: string;\n\n if (walletType === \"freighter\") {\n address = await connectFreighter(network);\n } else {\n throw new Error(\n `Wallet \"${walletType}\" not yet supported. ` +\n `Contributions welcome — see GitHub issues.`\n );\n }\n\n setWallet({\n connected: true,\n address,\n network,\n wallet: walletType,\n connecting: false,\n error: null,\n });\n } catch (err) {\n setWallet(prev => ({\n ...prev,\n connecting: false,\n error: err instanceof Error ? err.message : \"Failed to connect wallet\",\n }));\n }\n },\n [setWallet, network]\n );\n\n const disconnect = useCallback(() => {\n setWallet({\n connected: false,\n address: null,\n network: null,\n wallet: null,\n connecting: false,\n error: null,\n });\n }, [setWallet]);\n\n return { ...wallet, connect, disconnect };\n}\n\n// ── Freighter connector ────────────────────────────────────────────────────\nasync function connectFreighter(network: string): Promise<string> {\n // Freighter injects window.freighter\n const freighter = (window as unknown as { freighter?: FreighterAPI }).freighter;\n\n if (!freighter) {\n throw new Error(\n \"Freighter wallet not found. \" +\n \"Install the Freighter browser extension and try again.\"\n );\n }\n\n const isAllowed = await freighter.isAllowed();\n if (!isAllowed) {\n await freighter.setAllowed();\n }\n\n const { publicKey } = await freighter.getPublicKey();\n const { networkPassphrase } = await freighter.getNetworkDetails();\n\n // Validate we're on the right network\n const expectedPassphrase =\n network === \"mainnet\"\n ? \"Public Global Stellar Network ; September 2015\"\n : \"Test SDF Network ; September 2015\";\n\n if (networkPassphrase !== expectedPassphrase) {\n throw new Error(\n `Wrong network. Switch Freighter to ${network} and try again.`\n );\n }\n\n return publicKey;\n}\n\n// ── Freighter API types ────────────────────────────────────────────────────\n// Full type definitions tracked in GitHub issue #9\ninterface FreighterAPI {\n isAllowed: () => Promise<boolean>;\n setAllowed: () => Promise<void>;\n getPublicKey: () => Promise<{ publicKey: string }>;\n getNetworkDetails: () => Promise<{ networkPassphrase: string; network: string }>;\n signTransaction: (xdr: string, opts?: object) => Promise<{ signedTxXdr: string }>;\n}\n","import { useState, useEffect, useCallback } from \"react\";\nimport { useStellarContext } from \"../context/StellarProvider\";\nimport { getHorizonServer, parseHorizonBalance } from \"../utils\";\nimport type { Asset, Balance } from \"../types\";\n\nexport interface UseBalanceOptions {\n address?: string | null; // defaults to connected wallet address\n asset?: Asset; // defaults to XLM\n watch?: boolean; // re-fetch every 10s\n}\n\nexport interface UseBalanceReturn {\n balance: string | null;\n balances: Balance[];\n loading: boolean;\n error: string | null;\n refetch: () => void;\n}\n\nexport function useBalance({\n address,\n asset = \"XLM\",\n watch = false,\n}: UseBalanceOptions = {}): UseBalanceReturn {\n const { network, wallet } = useStellarContext();\n const resolvedAddress = address ?? wallet.address;\n\n const [balances, setBalances] = useState<Balance[]>([]);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const fetchBalances = useCallback(async () => {\n if (!resolvedAddress) return;\n\n setLoading(true);\n setError(null);\n\n try {\n const server = getHorizonServer(network);\n const account = await server.loadAccount(resolvedAddress);\n const parsed = account.balances.map(parseHorizonBalance);\n setBalances(parsed);\n } catch (err) {\n setError(err instanceof Error ? err.message : \"Failed to fetch balance\");\n } finally {\n setLoading(false);\n }\n }, [resolvedAddress, network]);\n\n useEffect(() => {\n fetchBalances();\n\n if (watch) {\n const interval = setInterval(fetchBalances, 10_000);\n return () => clearInterval(interval);\n }\n }, [fetchBalances, watch]);\n\n // Find the specific asset balance\n const match = balances.find(b => {\n if (asset === \"XLM\") return b.asset === \"XLM\";\n if (typeof asset === \"object\" && typeof b.asset === \"object\") {\n return b.asset.code === asset.code && b.asset.issuer === asset.issuer;\n }\n return false;\n });\n const balance = match?.balance ?? null;\n\n return {\n balance,\n balances,\n loading,\n error,\n refetch: fetchBalances,\n };\n}\n","import { Horizon } from \"@stellar/stellar-sdk\";\nimport type { Asset, Balance, NetworkConfig, StellarNetwork } from \"../types\";\nimport { NETWORK_CONFIGS } from \"../types\";\n\n// ── Network helpers ────────────────────────────────────────────────────────\nexport function getNetworkConfig(network: StellarNetwork): NetworkConfig {\n return NETWORK_CONFIGS[network];\n}\n\nexport function getHorizonServer(network: StellarNetwork): Horizon.Server {\n return new Horizon.Server(NETWORK_CONFIGS[network].horizonUrl);\n}\n\n// ── Asset helpers ──────────────────────────────────────────────────────────\nexport function isNativeAsset(asset: Asset): asset is \"XLM\" {\n return asset === \"XLM\";\n}\n\nexport function formatAssetCode(asset: Asset): string {\n return isNativeAsset(asset) ? \"XLM\" : asset.code;\n}\n\nexport function parseHorizonBalance(\n raw: Horizon.HorizonApi.BalanceLine\n): Balance {\n if (raw.asset_type === \"native\") {\n return {\n asset: \"XLM\",\n balance: raw.balance,\n };\n }\n\n const issued = raw as Horizon.HorizonApi.BalanceLineAsset;\n return {\n asset: {\n code: issued.asset_code,\n issuer: issued.asset_issuer,\n },\n balance: issued.balance,\n limit: issued.limit,\n };\n}\n\n// ── Address helpers ────────────────────────────────────────────────────────\nexport function isValidStellarAddress(address: string): boolean {\n return /^G[A-Z0-9]{55}$/.test(address);\n}\n\nexport function shortenAddress(address: string, chars = 6): string {\n if (!address) return \"\";\n return `${address.slice(0, chars)}...${address.slice(-chars)}`;\n}\n\n// ── Amount helpers ─────────────────────────────────────────────────────────\nexport function formatAmount(amount: string, decimals = 7): string {\n const num = parseFloat(amount);\n if (isNaN(num)) return \"0\";\n return num.toFixed(decimals).replace(/\\.?0+$/, \"\");\n}\n","import { useState, useEffect } from \"react\";\nimport { useStellarContext } from \"../context/StellarProvider\";\nimport { getHorizonServer, parseHorizonBalance } from \"../utils\";\nimport type { AccountInfo } from \"../types\";\n\nexport interface UseAccountOptions {\n address?: string | null; // defaults to connected wallet address\n}\n\nexport interface UseAccountReturn {\n account: AccountInfo | null;\n loading: boolean;\n error: string | null;\n refetch: () => void;\n}\n\nexport function useAccount({ address }: UseAccountOptions = {}): UseAccountReturn {\n const { network, wallet } = useStellarContext();\n const resolvedAddress = address ?? wallet.address;\n\n const [account, setAccount] = useState<AccountInfo | null>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n async function fetchAccount() {\n if (!resolvedAddress) return;\n\n setLoading(true);\n setError(null);\n\n try {\n const server = getHorizonServer(network);\n const raw = await server.loadAccount(resolvedAddress);\n\n const info: AccountInfo = {\n address: raw.id,\n sequence: raw.sequenceNumber(),\n balances: raw.balances.map(parseHorizonBalance),\n subentryCount: raw.subentry_count,\n thresholds: {\n lowThreshold: raw.thresholds.low_threshold,\n medThreshold: raw.thresholds.med_threshold,\n highThreshold: raw.thresholds.high_threshold,\n },\n signers: raw.signers.map(s => ({\n key: s.key,\n weight: s.weight,\n type: s.type,\n })),\n };\n\n setAccount(info);\n } catch (err) {\n setError(err instanceof Error ? err.message : \"Failed to fetch account\");\n } finally {\n setLoading(false);\n }\n }\n\n useEffect(() => {\n fetchAccount();\n }, [resolvedAddress, network]);\n\n return { account, loading, error, refetch: fetchAccount };\n}\n","import { useState, useCallback } from \"react\";\nimport {\n TransactionBuilder,\n Networks,\n BASE_FEE,\n Operation,\n Asset as StellarAsset,\n Memo,\n} from \"@stellar/stellar-sdk\";\nimport { useStellarContext } from \"../context/StellarProvider\";\nimport { getHorizonServer, isNativeAsset } from \"../utils\";\nimport type { SendPaymentOptions, SendPaymentResult, Asset } from \"../types\";\n\nexport interface UseSendPaymentReturn {\n send: (options: SendPaymentOptions) => Promise<SendPaymentResult>;\n loading: boolean;\n error: string | null;\n result: SendPaymentResult | null;\n reset: () => void;\n}\n\nexport function useSendPayment(): UseSendPaymentReturn {\n const { network, networkConfig, wallet } = useStellarContext();\n\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [result, setResult] = useState<SendPaymentResult | null>(null);\n\n const send = useCallback(\n async (options: SendPaymentOptions): Promise<SendPaymentResult> => {\n if (!wallet.connected || !wallet.address) {\n throw new Error(\"Wallet not connected. Call connect() first.\");\n }\n\n setLoading(true);\n setError(null);\n\n try {\n const server = getHorizonServer(network);\n const sourceAcc = await server.loadAccount(wallet.address);\n const networkPass = network === \"mainnet\"\n ? Networks.PUBLIC\n : Networks.TESTNET;\n\n // ── Build the operation ──────────────────────────────────────────\n const stellarAsset = toStellarAsset(options.asset);\n const operation = Operation.payment({\n destination: options.to,\n asset: stellarAsset,\n amount: options.amount,\n });\n\n // ── Build the transaction ────────────────────────────────────────\n const builder = new TransactionBuilder(sourceAcc, {\n fee: BASE_FEE,\n networkPassphrase: networkPass,\n }).addOperation(operation).setTimeout(30);\n\n if (options.memo) {\n builder.addMemo(Memo.text(options.memo));\n }\n\n const tx = builder.build();\n const xdr = tx.toXDR();\n\n // ── Sign with Freighter ──────────────────────────────────────────\n const freighter = (window as unknown as { freighter?: { signTransaction: (xdr: string, opts?: object) => Promise<{ signedTxXdr: string }> } }).freighter;\n if (!freighter) throw new Error(\"Freighter wallet not found\");\n\n const { signedTxXdr } = await freighter.signTransaction(xdr, {\n networkPassphrase: networkPass,\n });\n\n // ── Submit ───────────────────────────────────────────────────────\n const signed = TransactionBuilder.fromXDR(signedTxXdr, networkPass);\n const res = await server.submitTransaction(signed);\n\n const outcome: SendPaymentResult = {\n hash: res.hash,\n status: \"success\",\n };\n\n setResult(outcome);\n return outcome;\n } catch (err) {\n const message = err instanceof Error ? err.message : \"Transaction failed\";\n setError(message);\n throw new Error(message);\n } finally {\n setLoading(false);\n }\n },\n [network, wallet]\n );\n\n const reset = useCallback(() => {\n setError(null);\n setResult(null);\n }, []);\n\n return { send, loading, error, result, reset };\n}\n\n// ── Convert our Asset type to Stellar SDK Asset ────────────────────────────\nfunction toStellarAsset(asset: Asset): StellarAsset {\n if (isNativeAsset(asset)) return StellarAsset.native();\n return new StellarAsset(asset.code, asset.issuer);\n}\n","import { useState, useEffect, useRef, useCallback } from \"react\";\nimport { useStellarContext } from \"../context/StellarProvider\";\nimport { getHorizonServer } from \"../utils\";\nimport type { TransactionResult, TransactionStatus } from \"../types\";\n\nexport interface UseTransactionOptions {\n hash: string | null;\n watch?: boolean; // keep polling until success or failed\n}\n\nexport interface UseTransactionReturn {\n transaction: TransactionResult | null;\n loading: boolean;\n error: string | null;\n refetch: () => void;\n}\n\nexport function useTransaction({\n hash,\n watch = false,\n}: UseTransactionOptions): UseTransactionReturn {\n const { network } = useStellarContext();\n\n const [transaction, setTransaction] = useState<TransactionResult | null>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const transactionRef = useRef<TransactionResult | null>(null);\n\n transactionRef.current = transaction;\n\n const fetchTransaction = useCallback(async () => {\n if (!hash) return;\n\n setLoading(true);\n setError(null);\n\n try {\n const server = getHorizonServer(network);\n const raw = await server.transactions().transaction(hash).call();\n\n const status: TransactionStatus = raw.successful ? \"success\" : \"failed\";\n\n setTransaction({\n hash: raw.hash,\n status,\n ledger: Number(raw.ledger),\n createdAt: raw.created_at,\n fee: String(raw.fee_charged),\n });\n } catch (err: unknown) {\n // 404 means not found / still pending\n const is404 = (err as { response?: { status: number } })?.response?.status === 404;\n if (is404) {\n setTransaction({ hash: hash!, status: watch ? \"pending\" : \"not_found\" });\n } else {\n setError(err instanceof Error ? err.message : \"Failed to fetch transaction\");\n }\n } finally {\n setLoading(false);\n }\n }, [hash, network, watch]);\n\n useEffect(() => {\n fetchTransaction();\n\n if (watch) {\n const interval = setInterval(() => {\n const status = transactionRef.current?.status;\n if (status === \"success\" || status === \"failed\") return;\n fetchTransaction();\n }, 3000);\n return () => clearInterval(interval);\n }\n }, [fetchTransaction, watch]);\n\n return { transaction, loading, error, refetch: fetchTransaction };\n}\n","import { useStellarContext } from \"../context/StellarProvider\";\nimport type { StellarNetwork, NetworkConfig } from \"../types\";\n\nexport interface UseNetworkReturn {\n network: StellarNetwork;\n networkConfig: NetworkConfig;\n isTestnet: boolean;\n isMainnet: boolean;\n}\n\nexport function useNetwork(): UseNetworkReturn {\n const { network, networkConfig } = useStellarContext();\n\n return {\n network,\n networkConfig,\n isTestnet: network === \"testnet\",\n isMainnet: network === \"mainnet\",\n };\n}\n","import { useState, useEffect, useCallback } from \"react\";\nimport { useStellarContext } from \"../context/StellarProvider\";\nimport { getHorizonServer } from \"../utils\";\n\nexport interface AssetInfo {\n code: string;\n issuer: string;\n supply: string;\n homeDomain?: string;\n numAccounts: number;\n flags: {\n authRequired: boolean;\n authRevocable: boolean;\n authImmutable: boolean;\n };\n}\n\nexport interface UseAssetOptions {\n code: string;\n issuer: string;\n}\n\nexport interface UseAssetReturn {\n asset: AssetInfo | null;\n loading: boolean;\n error: string | null;\n refetch: () => void;\n}\n\nexport function useAsset({ code, issuer }: UseAssetOptions): UseAssetReturn {\n const { network } = useStellarContext();\n\n const [asset, setAsset] = useState<AssetInfo | null>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const fetchAsset = useCallback(async () => {\n setLoading(true);\n setError(null);\n\n try {\n const server = getHorizonServer(network);\n const res = await server\n .assets()\n .forCode(code)\n .forIssuer(issuer)\n .call();\n\n const raw = res.records[0];\n if (!raw) throw new Error(`Asset ${code}:${issuer} not found`);\n const assetRecord = raw as typeof raw & { home_domain?: string };\n\n setAsset({\n code: raw.asset_code,\n issuer: raw.asset_issuer,\n supply: raw.amount,\n numAccounts: raw.num_accounts,\n homeDomain: assetRecord.home_domain,\n flags: {\n authRequired: raw.flags.auth_required,\n authRevocable: raw.flags.auth_revocable,\n authImmutable: raw.flags.auth_immutable,\n },\n });\n } catch (err) {\n setError(err instanceof Error ? err.message : \"Failed to fetch asset\");\n } finally {\n setLoading(false);\n }\n }, [code, issuer, network]);\n\n useEffect(() => {\n fetchAsset();\n }, [fetchAsset]);\n\n return { asset, loading, error, refetch: fetchAsset };\n}\n","import { useState, useEffect, useCallback } from \"react\";\nimport { useStellarContext } from \"../context/StellarProvider\";\nimport type { ContractCallOptions } from \"../types\";\n\nexport interface UseSorobanContractReturn {\n data: unknown | null;\n loading: boolean;\n error: string | null;\n refetch: () => void;\n}\n\nexport function useSorobanContract({\n contractId,\n method,\n}: ContractCallOptions): UseSorobanContractReturn {\n const { networkConfig } = useStellarContext();\n\n const [data, setData] = useState<unknown | null>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const callContract = useCallback(async () => {\n setLoading(true);\n setError(null);\n\n try {\n if (!contractId || !method) {\n setData(null);\n return;\n }\n\n setData({\n contractId,\n method,\n network: networkConfig.network,\n note: \"Simulation wiring tracked in issue #10\",\n });\n } catch (err) {\n setError(err instanceof Error ? err.message : \"Contract call failed\");\n } finally {\n setLoading(false);\n }\n }, [contractId, method, networkConfig]);\n\n useEffect(() => {\n callContract();\n }, [callContract]);\n\n return { data, loading, error, refetch: callContract };\n}\n"],"mappings":";AAAA,OAAO;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,OAEK;;;ACKA,IAAM,kBAAyD;AAAA,EACpE,SAAS;AAAA,IACP,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,YAAY;AAAA,EACd;AAAA,EACA,SAAS;AAAA,IACP,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,YAAY;AAAA,EACd;AACF;;;ADPA,IAAM,iBAA8B;AAAA,EAClC,WAAY;AAAA,EACZ,SAAY;AAAA,EACZ,SAAY;AAAA,EACZ,QAAY;AAAA,EACZ,YAAY;AAAA,EACZ,OAAY;AACd;AAGA,IAAM,iBAAiB,cAA0C,IAAI;AAQ9D,SAAS,gBAAgB;AAAA,EAC9B,UAAW;AAAA,EACX;AACF,GAAyB;AACvB,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAsB,cAAc;AAEhE,QAAM,QAA6B;AAAA,IACjC;AAAA,IACA,eAAe,gBAAgB,OAAO;A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AAO,SAAS,WAAW;AACtD;;;AC5EA,SAAS,YAAAC,WAAU,aAAAC,YAAW,eAAAC,oBAAmB;AAW1C,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AACF,GAAkD;AAChD,QAAM,EAAE,cAAc,IAAI,kBAAkB;AAE5C,QAAM,CAAC,MAAS,OAAO,IAAOC,UAAyB,IAAI;AAC3D,QAAM,CAAC,SAAS,UAAU,IAAIA,UAAS,KAAK;AAC5C,QAAM,CAAC,OAAS,QAAQ,IAAMA,UAAwB,IAAI;AAE1D,QAAM,eAAeC,aAAY,YAAY;AAC3C,eAAW,IAAI;AACf,aAAS,IAAI;AAEb,QAAI;AACF,UAAI,CAAC,cAAc,CAAC,QAAQ;AAC1B,gBAAQ,IAAI;AACZ;AAAA,MACF;AAEA,cAAQ;AAAA,QACN;AAAA,QACA;AAAA,QACA,SAAS,cAAc;AAAA,QACvB,MAAM;AAAA,MACR,CAAC;AAAA,IACH,SAAS,KAAK;AACZ,eAAS,eAAe,QAAQ,IAAI,UAAU,sBAAsB;AAAA,IACtE,UAAE;AACA,iBAAW,KAAK;AAAA,IAClB;AAAA,EACF,GAAG,CAAC,YAAY,QAAQ,aAAa,CAAC;AAEtC,EAAAC,WAAU,MAAM;AACd,iBAAa;AAAA,EACf,GAAG,CAAC,YAAY,CAAC;AAEjB,SAAO,EAAE,MAAM,SAAS,OAAO,SAAS,aAAa;AACvD;","names":["useState","useCallback","useState","useCallback","useState","useEffect","useState","useEffect","useState","useCallback","useState","useCallback","useState","useEffect","useCallback","useState","useCallback","useEffect","useState","useEffect","useCallback","useState","useCallback","useEffect","useState","useEffect","useCallback","useState","useCallback","useEffect"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "use-stellar",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "React hooks for the Stellar network - the wagmi of Stellar",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/israelolrunfemi/use-stellar.git",
|
|
8
|
+
"directory": "packages/core"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/israelolrunfemi/use-stellar#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/israelolrunfemi/use-stellar/issues"
|
|
13
|
+
},
|
|
14
|
+
"main": "dist/index.js",
|
|
15
|
+
"module": "dist/index.mjs",
|
|
16
|
+
"types": "dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.mjs",
|
|
21
|
+
"require": "./dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": ["dist"],
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsup",
|
|
31
|
+
"test": "jest",
|
|
32
|
+
"dev": "tsup --watch"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"react": ">=18.0.0",
|
|
36
|
+
"react-dom": ">=18.0.0"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@stellar/stellar-sdk": "^12.0.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@testing-library/react": "^14.0.0",
|
|
43
|
+
"@testing-library/react-hooks": "^8.0.0",
|
|
44
|
+
"@testing-library/jest-dom": "^6.0.0",
|
|
45
|
+
"@types/jest": "^29.5.0",
|
|
46
|
+
"@types/node": "^20.0.0",
|
|
47
|
+
"@types/react": "^18.2.0",
|
|
48
|
+
"jest": "^29.0.0",
|
|
49
|
+
"jest-environment-jsdom": "^29.0.0",
|
|
50
|
+
"react": "^18.2.0",
|
|
51
|
+
"react-dom": "^18.2.0",
|
|
52
|
+
"ts-jest": "^29.0.0",
|
|
53
|
+
"tsup": "^8.0.0",
|
|
54
|
+
"typescript": "^5.4.0"
|
|
55
|
+
},
|
|
56
|
+
"jest": {
|
|
57
|
+
"preset": "ts-jest",
|
|
58
|
+
"testEnvironment": "jsdom",
|
|
59
|
+
"testMatch": ["**/*.test.ts", "**/*.test.tsx"],
|
|
60
|
+
"setupFilesAfterEnv": ["@testing-library/jest-dom"]
|
|
61
|
+
},
|
|
62
|
+
"keywords": [
|
|
63
|
+
"stellar",
|
|
64
|
+
"soroban",
|
|
65
|
+
"react",
|
|
66
|
+
"hooks",
|
|
67
|
+
"blockchain",
|
|
68
|
+
"web3",
|
|
69
|
+
"xlm",
|
|
70
|
+
"usdc"
|
|
71
|
+
],
|
|
72
|
+
"license": "MIT"
|
|
73
|
+
}
|