@dynamic-labs/stellar 4.57.2 → 4.58.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/CHANGELOG.md CHANGED
@@ -1,4 +1,18 @@
1
1
 
2
+ ## [4.58.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.57.2...v4.58.0) (2026-01-28)
3
+
4
+
5
+ ### Features
6
+
7
+ * add password setup flow for WaaS wallets ([#10308](https://github.com/dynamic-labs/dynamic-auth/issues/10308)) ([aad892d](https://github.com/dynamic-labs/dynamic-auth/commit/aad892d0359df589753b141c1099a03c72b799d9))
8
+ * add useRefreshAuth ([#10280](https://github.com/dynamic-labs/dynamic-auth/issues/10280)) ([bff850a](https://github.com/dynamic-labs/dynamic-auth/commit/bff850afc4167d47d3a38c5e9845d35b754ea573))
9
+ * **waas:** add unlockWallet and getWalletRecoveryState methods ([#10286](https://github.com/dynamic-labs/dynamic-auth/issues/10286)) ([4c2f26b](https://github.com/dynamic-labs/dynamic-auth/commit/4c2f26b1cd6483406288513d73be66554cd3c66a))
10
+
11
+ ### Bug Fixes
12
+
13
+ * ensure refresh user not update the jwt ([#10278](https://github.com/dynamic-labs/dynamic-auth/issues/10278)) ([c8cdbe6](https://github.com/dynamic-labs/dynamic-auth/commit/c8cdbe6e10636b39985f299a219fa362c25b4cd0))
14
+ * use isVersionedTransaction for reliable Solana transaction type detection ([#10319](https://github.com/dynamic-labs/dynamic-auth/issues/10319)) ([472aa15](https://github.com/dynamic-labs/dynamic-auth/commit/472aa15a94cfe541b22b96c5c63483e6a5971781))
15
+
2
16
  ### [4.57.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.57.1...v4.57.2) (2026-01-23)
3
17
 
4
18
  ### [4.57.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.57.0...v4.57.1) (2026-01-22)
@@ -0,0 +1,36 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ /******************************************************************************
7
+ Copyright (c) Microsoft Corporation.
8
+
9
+ Permission to use, copy, modify, and/or distribute this software for any
10
+ purpose with or without fee is hereby granted.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
13
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
14
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
15
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
17
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18
+ PERFORMANCE OF THIS SOFTWARE.
19
+ ***************************************************************************** */
20
+
21
+ function __awaiter(thisArg, _arguments, P, generator) {
22
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
+ return new (P || (P = Promise))(function (resolve, reject) {
24
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ }
30
+
31
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
32
+ var e = new Error(message);
33
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
34
+ };
35
+
36
+ exports.__awaiter = __awaiter;
@@ -0,0 +1,32 @@
1
+ 'use client'
2
+ /******************************************************************************
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
+ PERFORMANCE OF THIS SOFTWARE.
15
+ ***************************************************************************** */
16
+
17
+ function __awaiter(thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ }
26
+
27
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
28
+ var e = new Error(message);
29
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
30
+ };
31
+
32
+ export { __awaiter };
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.57.2";
6
+ var version = "4.58.0";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.57.2";
2
+ var version = "4.58.0";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/stellar",
3
- "version": "4.57.2",
3
+ "version": "4.58.0",
4
4
  "description": "A React SDK for implementing Stellar wallet web3 authentication and authorization to your website.",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -18,7 +18,10 @@
18
18
  },
19
19
  "homepage": "https://www.dynamic.xyz/",
20
20
  "dependencies": {
21
- "@dynamic-labs/assert-package-version": "4.57.2"
21
+ "@stellar/stellar-sdk": "14.4.3",
22
+ "@dynamic-labs/wallet-connector-core": "4.58.0",
23
+ "@dynamic-labs/assert-package-version": "4.58.0",
24
+ "@dynamic-labs/types": "4.58.0"
22
25
  },
23
26
  "peerDependencies": {}
24
27
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Required features for Stellar wallets to function properly.
3
+ * These are the minimum capabilities a wallet must support.
4
+ */
5
+ export declare const REQUIRED_FEATURES: readonly ["getPublicKey", "signTransaction"];
6
+ /**
7
+ * Stellar network passphrase for mainnet
8
+ */
9
+ export declare const STELLAR_PUBLIC_NETWORK_PASSPHRASE = "Public Global Stellar Network ; September 2015";
10
+ /**
11
+ * Stellar network passphrase for testnet
12
+ */
13
+ export declare const STELLAR_TESTNET_NETWORK_PASSPHRASE = "Test SDF Network ; September 2015";
14
+ /**
15
+ * Stellar network passphrase for futurenet
16
+ */
17
+ export declare const STELLAR_FUTURENET_NETWORK_PASSPHRASE = "Test SDF Future Network ; October 2022";
package/src/index.cjs CHANGED
@@ -5,10 +5,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var assertPackageVersion = require('@dynamic-labs/assert-package-version');
7
7
  var _package = require('../package.cjs');
8
+ var StellarWallet = require('./wallet/StellarWallet.cjs');
9
+ var getNetworkFromAddress = require('./utils/getNetworkFromAddress.cjs');
8
10
 
9
11
  assertPackageVersion.assertPackageVersion('@dynamic-labs/stellar', _package.version);
10
- // Wallet connector factory
11
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
12
- const StellarWalletConnectors = (props) => [];
12
+ // Wallet connector factory (to be implemented by specific wallet connectors)
13
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
14
+ const StellarWalletConnectors = (_props) => [
15
+ // Specific wallet connectors will be added here by implementers
16
+ ];
13
17
 
18
+ exports.StellarWallet = StellarWallet.StellarWallet;
19
+ exports.getNetworkFromAddress = getNetworkFromAddress.getNetworkFromAddress;
14
20
  exports.StellarWalletConnectors = StellarWalletConnectors;
package/src/index.d.ts CHANGED
@@ -1 +1,3 @@
1
- export declare const StellarWalletConnectors: (props: any) => never[];
1
+ export { StellarWallet } from './wallet';
2
+ export { getNetworkFromAddress } from './utils';
3
+ export declare const StellarWalletConnectors: (_props?: unknown) => never[];
package/src/index.js CHANGED
@@ -1,10 +1,14 @@
1
1
  'use client'
2
2
  import { assertPackageVersion } from '@dynamic-labs/assert-package-version';
3
3
  import { version } from '../package.js';
4
+ export { StellarWallet } from './wallet/StellarWallet.js';
5
+ export { getNetworkFromAddress } from './utils/getNetworkFromAddress.js';
4
6
 
5
7
  assertPackageVersion('@dynamic-labs/stellar', version);
6
- // Wallet connector factory
7
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
8
- const StellarWalletConnectors = (props) => [];
8
+ // Wallet connector factory (to be implemented by specific wallet connectors)
9
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
10
+ const StellarWalletConnectors = (_props) => [
11
+ // Specific wallet connectors will be added here by implementers
12
+ ];
9
13
 
10
14
  export { StellarWalletConnectors };
package/src/types.d.ts ADDED
@@ -0,0 +1,124 @@
1
+ import type { Transaction } from '@stellar/stellar-sdk';
2
+ import type { GenericNetwork } from '@dynamic-labs/types';
3
+ import type { ProviderCondition } from '@dynamic-labs/wallet-connector-core';
4
+ /**
5
+ * Interface for Stellar wallet providers.
6
+ *
7
+ * This interface is designed to work with Stellar wallets that implement
8
+ * common wallet APIs. Major Stellar wallets include:
9
+ * Freighter, Albedo, xBull, Lobstr, and Rabet.
10
+ *
11
+ * ## Core Features
12
+ * - **Connection Management**: Connect, disconnect, and account retrieval
13
+ * - **Network Support**: Network information and switching capabilities
14
+ * - **Transaction Signing**: Support for transaction and message signing
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * // Connect to wallet
19
+ * const publicKey = await provider.connect();
20
+ *
21
+ * // Sign a transaction
22
+ * const signedXdr = await provider.sign(transactionXdr, options);
23
+ *
24
+ * // Sign a message
25
+ * const signature = await provider.signMessage("Hello Stellar");
26
+ * ```
27
+ */
28
+ export type IStellarProvider = {
29
+ /** Close the wallet connection */
30
+ close(): void;
31
+ /** Connect to the wallet and get the public key */
32
+ connect(): Promise<string>;
33
+ /** Disconnect from the wallet */
34
+ disconnect(): Promise<void>;
35
+ /** Get the current network */
36
+ getNetwork(): Promise<string>;
37
+ /** Check if the wallet is unlocked */
38
+ isUnlocked(): Promise<boolean>;
39
+ /** Subscribe to wallet events */
40
+ on(event: StellarProviderEvent, callback: StellarEventCallback): void;
41
+ /** Sign a Stellar transaction XDR */
42
+ sign(transactionXdr: string, options?: StellarSignTransactionOptions): Promise<string>;
43
+ /** Sign an arbitrary message */
44
+ signMessage(message: string): Promise<string>;
45
+ };
46
+ /**
47
+ * Stellar provider event types
48
+ */
49
+ export type StellarProviderEvent = 'accountChanged' | 'networkChanged';
50
+ /**
51
+ * Stellar event callback type
52
+ */
53
+ export type StellarEventCallback = (data: unknown) => void;
54
+ /**
55
+ * Options for signing a Stellar transaction
56
+ */
57
+ export type StellarSignTransactionOptions = {
58
+ /** Account public key (for multi-account wallets) */
59
+ accountToSign?: string;
60
+ /** Network to use ('PUBLIC' or 'TESTNET' or custom passphrase) */
61
+ network?: string;
62
+ /** Network passphrase */
63
+ networkPassphrase?: string;
64
+ };
65
+ /**
66
+ * Result from wallet connection
67
+ */
68
+ export type StellarConnectionResult = {
69
+ publicKey: string;
70
+ };
71
+ /**
72
+ * Props for sending XLM or token balance
73
+ */
74
+ export type StellarSendBalanceProps = {
75
+ /** Amount to send (in XLM for native transfers) */
76
+ amount: string;
77
+ /** Optional asset information for non-XLM transfers */
78
+ asset?: {
79
+ /** Asset code */
80
+ code: string;
81
+ /** Asset issuer */
82
+ issuer: string;
83
+ };
84
+ /** Optional memo */
85
+ memo?: {
86
+ type: 'hash' | 'id' | 'return' | 'text';
87
+ value: string;
88
+ };
89
+ /** Recipient address (Stellar public key) */
90
+ toAddress: string;
91
+ };
92
+ /**
93
+ * Stellar wallet connector constructor properties
94
+ */
95
+ export type StellarWalletConnectorProps = {
96
+ /** Wallet metadata */
97
+ metadata?: unknown;
98
+ /** Stellar networks */
99
+ stellarNetworks?: GenericNetwork[];
100
+ /** Wallet book schema */
101
+ walletBook: unknown;
102
+ };
103
+ /**
104
+ * Extension locators for identifying Stellar wallet browser extensions.
105
+ * These flags are typically set on the injected provider object to identify
106
+ * which wallet extension is present.
107
+ */
108
+ export type ExtensionLocator = 'isAlbedo' | 'isFreighter' | 'isLobstr' | 'isRabet' | 'isXBull';
109
+ /**
110
+ * Type for Stellar provider condition used in provider lookup.
111
+ */
112
+ export type StellarProviderCondition = ProviderCondition<ExtensionLocator>;
113
+ /**
114
+ * Stellar network names
115
+ */
116
+ export type StellarNetworkName = 'FUTURENET' | 'PUBLIC' | 'TESTNET';
117
+ /**
118
+ * Stellar method names for provider interactions
119
+ */
120
+ export type StellarMethodName = 'close' | 'connect' | 'disconnect' | 'getNetwork' | 'isUnlocked' | 'on' | 'sign' | 'signMessage';
121
+ /**
122
+ * Stellar transaction type from the SDK
123
+ */
124
+ export type StellarTransaction = Transaction;
@@ -0,0 +1,66 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../../_virtual/_tslib.cjs');
7
+ var stellarSdk = require('@stellar/stellar-sdk');
8
+
9
+ const HORIZON_MAINNET_URL = 'https://horizon.stellar.org';
10
+ const HORIZON_TESTNET_URL = 'https://horizon-testnet.stellar.org';
11
+ const getNetworkIdFromPassphrase = (passphrase) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
12
+ const encoder = new TextEncoder();
13
+ const data = encoder.encode(passphrase);
14
+ const hashBuffer = yield crypto.subtle.digest('SHA-256', data);
15
+ const hashArray = Array.from(new Uint8Array(hashBuffer));
16
+ return hashArray.map((b) => b.toString(16).padStart(2, '0')).join('');
17
+ });
18
+ /**
19
+ * Checks if a Stellar account exists on a given Horizon server.
20
+ *
21
+ * @param address - The Stellar public key to check
22
+ * @param server - The Horizon Server instance to query
23
+ * @returns true if the account exists, false otherwise
24
+ * @throws Re-throws non-404 errors (network errors, bad request, etc.)
25
+ */
26
+ const accountExistsOnNetwork = (address, server) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
27
+ var _a;
28
+ try {
29
+ yield server.loadAccount(address);
30
+ return true;
31
+ }
32
+ catch (error) {
33
+ // Account not found (404) - expected for unfunded accounts
34
+ if (((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
35
+ return false;
36
+ }
37
+ throw error;
38
+ }
39
+ });
40
+ /**
41
+ * Detects which Stellar network an address belongs to by checking
42
+ * if the account exists on mainnet or testnet.
43
+ *
44
+ * @param address - The Stellar public key to check
45
+ * @returns The network chainId (which is sha256 hash of the network passphrase)
46
+ */
47
+ const getNetworkFromAddress = (address, defaultNetwork) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
48
+ const mainnetServer = new stellarSdk.Horizon.Server(HORIZON_MAINNET_URL);
49
+ const testnetServer = new stellarSdk.Horizon.Server(HORIZON_TESTNET_URL);
50
+ // Check testnet
51
+ const existsOnTestnet = yield accountExistsOnNetwork(address, testnetServer);
52
+ if (existsOnTestnet) {
53
+ return getNetworkIdFromPassphrase(stellarSdk.Networks.TESTNET);
54
+ }
55
+ // Check mainnet first since it's the most common
56
+ const existsOnMainnet = yield accountExistsOnNetwork(address, mainnetServer);
57
+ if (existsOnMainnet) {
58
+ return getNetworkIdFromPassphrase(stellarSdk.Networks.PUBLIC);
59
+ }
60
+ // Account doesn't exist on either network (unfunded account)
61
+ // Default to mainnet
62
+ return defaultNetwork.chainId.toString();
63
+ });
64
+
65
+ exports.getNetworkFromAddress = getNetworkFromAddress;
66
+ exports.getNetworkIdFromPassphrase = getNetworkIdFromPassphrase;
@@ -0,0 +1,10 @@
1
+ import { GenericNetwork } from '@dynamic-labs/types';
2
+ export declare const getNetworkIdFromPassphrase: (passphrase: string) => Promise<string>;
3
+ /**
4
+ * Detects which Stellar network an address belongs to by checking
5
+ * if the account exists on mainnet or testnet.
6
+ *
7
+ * @param address - The Stellar public key to check
8
+ * @returns The network chainId (which is sha256 hash of the network passphrase)
9
+ */
10
+ export declare const getNetworkFromAddress: (address: string, defaultNetwork: GenericNetwork) => Promise<string | undefined>;
@@ -0,0 +1,61 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../_virtual/_tslib.js';
3
+ import { Horizon, Networks } from '@stellar/stellar-sdk';
4
+
5
+ const HORIZON_MAINNET_URL = 'https://horizon.stellar.org';
6
+ const HORIZON_TESTNET_URL = 'https://horizon-testnet.stellar.org';
7
+ const getNetworkIdFromPassphrase = (passphrase) => __awaiter(void 0, void 0, void 0, function* () {
8
+ const encoder = new TextEncoder();
9
+ const data = encoder.encode(passphrase);
10
+ const hashBuffer = yield crypto.subtle.digest('SHA-256', data);
11
+ const hashArray = Array.from(new Uint8Array(hashBuffer));
12
+ return hashArray.map((b) => b.toString(16).padStart(2, '0')).join('');
13
+ });
14
+ /**
15
+ * Checks if a Stellar account exists on a given Horizon server.
16
+ *
17
+ * @param address - The Stellar public key to check
18
+ * @param server - The Horizon Server instance to query
19
+ * @returns true if the account exists, false otherwise
20
+ * @throws Re-throws non-404 errors (network errors, bad request, etc.)
21
+ */
22
+ const accountExistsOnNetwork = (address, server) => __awaiter(void 0, void 0, void 0, function* () {
23
+ var _a;
24
+ try {
25
+ yield server.loadAccount(address);
26
+ return true;
27
+ }
28
+ catch (error) {
29
+ // Account not found (404) - expected for unfunded accounts
30
+ if (((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
31
+ return false;
32
+ }
33
+ throw error;
34
+ }
35
+ });
36
+ /**
37
+ * Detects which Stellar network an address belongs to by checking
38
+ * if the account exists on mainnet or testnet.
39
+ *
40
+ * @param address - The Stellar public key to check
41
+ * @returns The network chainId (which is sha256 hash of the network passphrase)
42
+ */
43
+ const getNetworkFromAddress = (address, defaultNetwork) => __awaiter(void 0, void 0, void 0, function* () {
44
+ const mainnetServer = new Horizon.Server(HORIZON_MAINNET_URL);
45
+ const testnetServer = new Horizon.Server(HORIZON_TESTNET_URL);
46
+ // Check testnet
47
+ const existsOnTestnet = yield accountExistsOnNetwork(address, testnetServer);
48
+ if (existsOnTestnet) {
49
+ return getNetworkIdFromPassphrase(Networks.TESTNET);
50
+ }
51
+ // Check mainnet first since it's the most common
52
+ const existsOnMainnet = yield accountExistsOnNetwork(address, mainnetServer);
53
+ if (existsOnMainnet) {
54
+ return getNetworkIdFromPassphrase(Networks.PUBLIC);
55
+ }
56
+ // Account doesn't exist on either network (unfunded account)
57
+ // Default to mainnet
58
+ return defaultNetwork.chainId.toString();
59
+ });
60
+
61
+ export { getNetworkFromAddress, getNetworkIdFromPassphrase };
@@ -0,0 +1 @@
1
+ export { getNetworkFromAddress } from './getNetworkFromAddress';
@@ -0,0 +1,91 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../../_virtual/_tslib.cjs');
7
+ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
8
+
9
+ /**
10
+ * Stellar wallet implementation that provides chain-specific functionality
11
+ * for interacting with the Stellar blockchain.
12
+ *
13
+ * This class extends the base Wallet class and provides Stellar-specific
14
+ * methods for transactions, signing, and network operations.
15
+ */
16
+ class StellarWallet extends walletConnectorCore.Wallet {
17
+ /**
18
+ * Get balance of the wallet.
19
+ * @returns Balance of the wallet in XLM
20
+ */
21
+ getBalance() {
22
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
23
+ yield this._connector.connect();
24
+ // Balance fetching will be implemented when full SDK support is added
25
+ return '0';
26
+ });
27
+ }
28
+ /**
29
+ * Sends balance to another address.
30
+ * @param amount - Amount to send (in XLM for native transfers)
31
+ * @param toAddress - Recipient address
32
+ * @returns Transaction hash
33
+ */
34
+ sendBalance(_a) {
35
+ return _tslib.__awaiter(this, arguments, void 0, function* ({ amount, toAddress, }) {
36
+ yield this._connector.connect();
37
+ // Transaction sending will be implemented when full SDK support is added
38
+ throw new Error(`sendBalance not yet implemented. Amount: ${amount}, To: ${toAddress}`);
39
+ });
40
+ }
41
+ /**
42
+ * Signs a Stellar transaction XDR.
43
+ *
44
+ * @param transactionXdr - The transaction XDR to sign
45
+ * @returns The signed transaction XDR
46
+ */
47
+ signTransaction(transactionXdr) {
48
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
49
+ yield this._connector.connect();
50
+ return this._connector.signTransaction(transactionXdr);
51
+ });
52
+ }
53
+ /**
54
+ * Signs a message.
55
+ *
56
+ * @param message - The message to sign
57
+ * @returns The signature
58
+ */
59
+ signMessage(message) {
60
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
61
+ yield this._connector.connect();
62
+ const result = yield this._connector.signMessage(message);
63
+ if (!result) {
64
+ throw new Error('Failed to sign message');
65
+ }
66
+ return result;
67
+ });
68
+ }
69
+ /**
70
+ * Returns the wallet's current network.
71
+ *
72
+ * @returns The current network or undefined if not available
73
+ */
74
+ getNetworkInfo() {
75
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
76
+ return this._connector.getNetwork();
77
+ });
78
+ }
79
+ /**
80
+ * Retrieves the Horizon Server instance for interacting with the Stellar network.
81
+ *
82
+ * @returns A promise that resolves to the Horizon.Server instance
83
+ */
84
+ getHorizonServer() {
85
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
86
+ return this._connector.getHorizonServer();
87
+ });
88
+ }
89
+ }
90
+
91
+ exports.StellarWallet = StellarWallet;
@@ -0,0 +1,63 @@
1
+ import { Horizon } from '@stellar/stellar-sdk';
2
+ import { Wallet, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
3
+ /**
4
+ * Stellar wallet connector interface for type safety.
5
+ * This will be properly typed when StellarWalletConnector is added.
6
+ */
7
+ type StellarWalletConnectorType = WalletConnectorBase<typeof StellarWallet> & {
8
+ signTransaction(transactionXdr: string): Promise<string>;
9
+ signMessage(message: string): Promise<string | undefined>;
10
+ getNetwork(): Promise<string | undefined>;
11
+ getHorizonServer(): Promise<Horizon.Server>;
12
+ };
13
+ /**
14
+ * Stellar wallet implementation that provides chain-specific functionality
15
+ * for interacting with the Stellar blockchain.
16
+ *
17
+ * This class extends the base Wallet class and provides Stellar-specific
18
+ * methods for transactions, signing, and network operations.
19
+ */
20
+ export declare class StellarWallet extends Wallet<StellarWalletConnectorType> {
21
+ /**
22
+ * Get balance of the wallet.
23
+ * @returns Balance of the wallet in XLM
24
+ */
25
+ getBalance(): Promise<string>;
26
+ /**
27
+ * Sends balance to another address.
28
+ * @param amount - Amount to send (in XLM for native transfers)
29
+ * @param toAddress - Recipient address
30
+ * @returns Transaction hash
31
+ */
32
+ sendBalance({ amount, toAddress, }: {
33
+ amount: string;
34
+ toAddress: string;
35
+ }): Promise<string>;
36
+ /**
37
+ * Signs a Stellar transaction XDR.
38
+ *
39
+ * @param transactionXdr - The transaction XDR to sign
40
+ * @returns The signed transaction XDR
41
+ */
42
+ signTransaction(transactionXdr: string): Promise<string>;
43
+ /**
44
+ * Signs a message.
45
+ *
46
+ * @param message - The message to sign
47
+ * @returns The signature
48
+ */
49
+ signMessage(message: string): Promise<string | undefined>;
50
+ /**
51
+ * Returns the wallet's current network.
52
+ *
53
+ * @returns The current network or undefined if not available
54
+ */
55
+ getNetworkInfo(): Promise<string | undefined>;
56
+ /**
57
+ * Retrieves the Horizon Server instance for interacting with the Stellar network.
58
+ *
59
+ * @returns A promise that resolves to the Horizon.Server instance
60
+ */
61
+ getHorizonServer(): Promise<Horizon.Server>;
62
+ }
63
+ export {};
@@ -0,0 +1,87 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../_virtual/_tslib.js';
3
+ import { Wallet } from '@dynamic-labs/wallet-connector-core';
4
+
5
+ /**
6
+ * Stellar wallet implementation that provides chain-specific functionality
7
+ * for interacting with the Stellar blockchain.
8
+ *
9
+ * This class extends the base Wallet class and provides Stellar-specific
10
+ * methods for transactions, signing, and network operations.
11
+ */
12
+ class StellarWallet extends Wallet {
13
+ /**
14
+ * Get balance of the wallet.
15
+ * @returns Balance of the wallet in XLM
16
+ */
17
+ getBalance() {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ yield this._connector.connect();
20
+ // Balance fetching will be implemented when full SDK support is added
21
+ return '0';
22
+ });
23
+ }
24
+ /**
25
+ * Sends balance to another address.
26
+ * @param amount - Amount to send (in XLM for native transfers)
27
+ * @param toAddress - Recipient address
28
+ * @returns Transaction hash
29
+ */
30
+ sendBalance(_a) {
31
+ return __awaiter(this, arguments, void 0, function* ({ amount, toAddress, }) {
32
+ yield this._connector.connect();
33
+ // Transaction sending will be implemented when full SDK support is added
34
+ throw new Error(`sendBalance not yet implemented. Amount: ${amount}, To: ${toAddress}`);
35
+ });
36
+ }
37
+ /**
38
+ * Signs a Stellar transaction XDR.
39
+ *
40
+ * @param transactionXdr - The transaction XDR to sign
41
+ * @returns The signed transaction XDR
42
+ */
43
+ signTransaction(transactionXdr) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ yield this._connector.connect();
46
+ return this._connector.signTransaction(transactionXdr);
47
+ });
48
+ }
49
+ /**
50
+ * Signs a message.
51
+ *
52
+ * @param message - The message to sign
53
+ * @returns The signature
54
+ */
55
+ signMessage(message) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ yield this._connector.connect();
58
+ const result = yield this._connector.signMessage(message);
59
+ if (!result) {
60
+ throw new Error('Failed to sign message');
61
+ }
62
+ return result;
63
+ });
64
+ }
65
+ /**
66
+ * Returns the wallet's current network.
67
+ *
68
+ * @returns The current network or undefined if not available
69
+ */
70
+ getNetworkInfo() {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ return this._connector.getNetwork();
73
+ });
74
+ }
75
+ /**
76
+ * Retrieves the Horizon Server instance for interacting with the Stellar network.
77
+ *
78
+ * @returns A promise that resolves to the Horizon.Server instance
79
+ */
80
+ getHorizonServer() {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ return this._connector.getHorizonServer();
83
+ });
84
+ }
85
+ }
86
+
87
+ export { StellarWallet };
@@ -0,0 +1 @@
1
+ export { StellarWallet } from './StellarWallet';
@@ -0,0 +1,3 @@
1
+ import { Wallet } from '@dynamic-labs/wallet-connector-core';
2
+ import { StellarWallet } from '../StellarWallet';
3
+ export declare const isStellarWallet: (wallet: Wallet) => wallet is StellarWallet;