@flashnet/sdk 0.3.6 → 0.3.7

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.
@@ -1,11 +1,12 @@
1
1
  import type { IssuerSparkWallet } from "@buildonspark/issuer-sdk";
2
2
  import type { SparkWallet } from "@buildonspark/spark-sdk";
3
- import { type AddLiquidityResponse, type AllLpPositionsResponse, type ConfirmDepositResponse, type CreatePoolResponse, type ExecuteRouteSwapResponse, type GetHostFeesResponse, type GetHostResponse, type GetIntegratorFeesResponse, type GetPoolHostFeesResponse, type ListGlobalSwapsQuery, type ListGlobalSwapsResponse, type ListPoolSwapsQuery, type ListPoolSwapsResponse, type ListPoolsQuery, type ListPoolsResponse, type ListUserSwapsQuery, type ListUserSwapsResponse, type LpPositionDetailsResponse, type NetworkType, type SparkNetworkType, type ClientEnvironment, type FlashnetClientConfig, type FlashnetClientCustomConfig, type FlashnetClientEnvironmentConfig, type FlashnetClientLegacyConfig, type PoolDetailsResponse, type RegisterHostResponse, type RemoveLiquidityResponse, type SettlementPingResponse, type SimulateAddLiquidityRequest, type SimulateAddLiquidityResponse, type SimulateRemoveLiquidityRequest, type SimulateRemoveLiquidityResponse, type SimulateRouteSwapRequest, type SimulateRouteSwapResponse, type SimulateSwapRequest, type SimulateSwapResponse, type SwapResponse, type WithdrawHostFeesResponse, type WithdrawIntegratorFeesResponse } from "../types";
4
- import { type HumanReadableTokenIdentifier, type SparkHumanReadableTokenIdentifier } from "../utils/tokenAddress";
3
+ import { type AddLiquidityResponse, type AllLpPositionsResponse, type ConfirmDepositResponse, type CreatePoolResponse, type ExecuteRouteSwapResponse, type GetHostFeesResponse, type GetHostResponse, type GetIntegratorFeesResponse, type GetPoolHostFeesResponse, type ListGlobalSwapsQuery, type ListGlobalSwapsResponse, type ListPoolSwapsQuery, type ListPoolSwapsResponse, type ListPoolsQuery, type ListPoolsResponse, type ListUserSwapsQuery, type ListUserSwapsResponse, type LpPositionDetailsResponse, type NetworkType, type PoolDetailsResponse, type RegisterHostResponse, type RemoveLiquidityResponse, type SettlementPingResponse, type SimulateAddLiquidityRequest, type SimulateAddLiquidityResponse, type SimulateRemoveLiquidityRequest, type SimulateRemoveLiquidityResponse, type SimulateRouteSwapRequest, type SimulateRouteSwapResponse, type SimulateSwapRequest, type SimulateSwapResponse, type SwapResponse, type WithdrawHostFeesResponse, type WithdrawIntegratorFeesResponse } from "../types";
4
+ import { type HumanReadableTokenIdentifier } from "../utils/tokenAddress";
5
5
  export interface TokenBalance {
6
6
  balance: bigint;
7
7
  tokenInfo?: {
8
- tokenPublicKey: string;
8
+ tokenIdentifier: string;
9
+ tokenAddress: string;
9
10
  tokenName: string;
10
11
  tokenSymbol: string;
11
12
  tokenDecimals: number;
@@ -16,9 +17,6 @@ export interface WalletBalance {
16
17
  balance: bigint;
17
18
  tokenBalances: Map<string, TokenBalance>;
18
19
  }
19
- /**
20
- * @deprecated Use FlashnetClientConfig instead
21
- */
22
20
  export interface FlashnetClientOptions {
23
21
  autoAuthenticate?: boolean;
24
22
  }
@@ -37,8 +35,7 @@ export declare class FlashnetClient {
37
35
  private apiClient;
38
36
  private typedApi;
39
37
  private authManager;
40
- private sparkNetwork;
41
- private clientEnvironment;
38
+ private network;
42
39
  private publicKey;
43
40
  private sparkAddress;
44
41
  private isAuthenticated;
@@ -47,15 +44,6 @@ export declare class FlashnetClient {
47
44
  */
48
45
  get wallet(): IssuerSparkWallet | SparkWallet;
49
46
  /**
50
- * Get the Spark network type (for blockchain operations)
51
- */
52
- get sparkNetworkType(): SparkNetworkType;
53
- /**
54
- * Get the client environment (for API configuration)
55
- */
56
- get clientEnvironmentType(): ClientEnvironment;
57
- /**
58
- * @deprecated Use sparkNetworkType instead
59
47
  * Get the network type
60
48
  */
61
49
  get networkType(): NetworkType;
@@ -68,30 +56,11 @@ export declare class FlashnetClient {
68
56
  */
69
57
  get address(): string;
70
58
  /**
71
- * Create a new FlashnetClient instance with new configuration system
72
- * @param wallet - The SparkWallet to use
73
- * @param config - Client configuration with separate Spark network and client config
74
- */
75
- constructor(wallet: IssuerSparkWallet | SparkWallet, config: FlashnetClientConfig);
76
- /**
77
- * Create a new FlashnetClient instance with custom configuration
78
- * @param wallet - The SparkWallet to use
79
- * @param config - Custom configuration with specific endpoints
80
- */
81
- constructor(wallet: IssuerSparkWallet | SparkWallet, config: FlashnetClientCustomConfig);
82
- /**
83
- * Create a new FlashnetClient instance with environment configuration
59
+ * Create a new FlashnetClient instance
84
60
  * @param wallet - The SparkWallet to use
85
- * @param config - Environment-based configuration
61
+ * @param options - Client options
86
62
  */
87
- constructor(wallet: IssuerSparkWallet | SparkWallet, config: FlashnetClientEnvironmentConfig);
88
- /**
89
- * @deprecated Use the new constructor with FlashnetClientConfig instead
90
- * Create a new FlashnetClient instance with legacy configuration
91
- * @param wallet - The SparkWallet to use
92
- * @param options - Legacy client options
93
- */
94
- constructor(wallet: IssuerSparkWallet | SparkWallet, options?: FlashnetClientLegacyConfig);
63
+ constructor(wallet: IssuerSparkWallet | SparkWallet, _options?: FlashnetClientOptions);
95
64
  /**
96
65
  * Initialize the client by deducing network and authenticating
97
66
  * This is called automatically on first use if not called manually
@@ -104,7 +73,7 @@ export declare class FlashnetClient {
104
73
  /**
105
74
  * Ensure a token identifier is in human-readable (Bech32m) form expected by the Spark SDK.
106
75
  * If the identifier is already human-readable or it is the BTC constant, it is returned unchanged.
107
- * Otherwise, it is encoded from the raw hex form using the client's Spark network.
76
+ * Otherwise, it is encoded from the raw hex form using the client network.
108
77
  */
109
78
  private toHumanReadableTokenIdentifier;
110
79
  /**
@@ -288,34 +257,17 @@ export declare class FlashnetClient {
288
257
  */
289
258
  getUserSwaps(userPublicKey?: string, query?: ListUserSwapsQuery): Promise<ListUserSwapsResponse>;
290
259
  /**
291
- * Encode a token identifier into a human-readable token address using the client's Spark network
260
+ * Encode a token identifier into a human-readable token address using the client's network
292
261
  * @param tokenIdentifier - Token identifier as hex string or Uint8Array
293
262
  * @returns Human-readable token address
294
263
  */
295
- encodeTokenAddress(tokenIdentifier: string | Uint8Array): SparkHumanReadableTokenIdentifier;
264
+ encodeTokenAddress(tokenIdentifier: string | Uint8Array): HumanReadableTokenIdentifier;
296
265
  /**
297
266
  * Decode a human-readable token address back to its identifier
298
267
  * @param address - Human-readable token address
299
- * @returns Object containing the token identifier (as hex string) and Spark network
300
- */
301
- decodeTokenAddress(address: SparkHumanReadableTokenIdentifier): {
302
- tokenIdentifier: string;
303
- network: SparkNetworkType;
304
- };
305
- /**
306
- * @deprecated Use encodeTokenAddress instead - this method uses legacy types
307
- * Encode a token identifier into a human-readable token address using legacy types
308
- * @param tokenIdentifier - Token identifier as hex string or Uint8Array
309
- * @returns Human-readable token address
310
- */
311
- encodeLegacyTokenAddress(tokenIdentifier: string | Uint8Array): HumanReadableTokenIdentifier;
312
- /**
313
- * @deprecated Use decodeTokenAddress instead - this method uses legacy types
314
- * Decode a human-readable token address back to its identifier using legacy types
315
- * @param address - Human-readable token address
316
268
  * @returns Object containing the token identifier (as hex string) and network
317
269
  */
318
- decodeLegacyTokenAddress(address: HumanReadableTokenIdentifier): {
270
+ decodeTokenAddress(address: HumanReadableTokenIdentifier): {
319
271
  tokenIdentifier: string;
320
272
  network: NetworkType;
321
273
  };
@@ -1 +1 @@
1
- {"version":3,"file":"FlashnetClient.d.ts","sourceRoot":"","sources":["../../../../src/client/FlashnetClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAY3D,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAG3B,KAAK,kBAAkB,EAGvB,KAAK,wBAAwB,EAG7B,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB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,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAUtE;;OAEG;IACG,sBAAsB,CAAC,MAAM,EAAE;QACnC,mBAAmB,EAAE,MAAM,CAAC;QAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GAAG,OAAO,CAAC,8BAA8B,CAAC;IAyC3C;;OAEG;IACG,iBAAiB,IAAI,OAAO,CAAC,yBAAyB,CAAC;IAO7D;;OAEG;IACG,YAAY,CAChB,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,kBAAkB,GACzB,OAAO,CAAC,qBAAqB,CAAC;IAKjC;;OAEG;IACG,cAAc,CAClB,KAAK,CAAC,EAAE,oBAAoB,GAC3B,OAAO,CAAC,uBAAuB,CAAC;IAKnC;;OAEG;IACG,YAAY,CAChB,aAAa,CAAC,EAAE,MAAM,EACtB,KAAK,CAAC,EAAE,kBAAkB,GACzB,OAAO,CAAC,qBAAqB,CAAC;IAQjC;;;;OAIG;IACH,kBAAkB,CAAC,eAAe,EAAE,MAAM,GAAG,UAAU,GAAG,4BAA4B;IAItF;;;;OAIG;IACH,kBAAkB,CAAC,OAAO,EAAE,4BAA4B,GAAG;QAAE,eAAe,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,WAAW,CAAA;KAAE;IAM5G;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,sBAAsB,CAAC;IAO7C;;OAEG;YACW,mBAAmB;IAoFjC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B"}
@@ -26,8 +26,7 @@ class FlashnetClient {
26
26
  apiClient;
27
27
  typedApi;
28
28
  authManager;
29
- sparkNetwork;
30
- clientEnvironment;
29
+ network;
31
30
  publicKey = "";
32
31
  sparkAddress = "";
33
32
  isAuthenticated = false;
@@ -38,27 +37,10 @@ class FlashnetClient {
38
37
  return this._wallet;
39
38
  }
40
39
  /**
41
- * Get the Spark network type (for blockchain operations)
42
- */
43
- get sparkNetworkType() {
44
- return this.sparkNetwork;
45
- }
46
- /**
47
- * Get the client environment (for API configuration)
48
- */
49
- get clientEnvironmentType() {
50
- return this.clientEnvironment;
51
- }
52
- /**
53
- * @deprecated Use sparkNetworkType instead
54
40
  * Get the network type
55
41
  */
56
42
  get networkType() {
57
- // Map Spark network back to legacy network type
58
- // This is for backward compatibility
59
- return this.sparkNetwork === "REGTEST" && this.clientEnvironment === "local"
60
- ? "LOCAL"
61
- : this.sparkNetwork;
43
+ return this.network;
62
44
  }
63
45
  /**
64
46
  * Get the wallet's public key
@@ -72,87 +54,24 @@ class FlashnetClient {
72
54
  get address() {
73
55
  return this.sparkAddress;
74
56
  }
75
- constructor(wallet, configOrOptions) {
57
+ /**
58
+ * Create a new FlashnetClient instance
59
+ * @param wallet - The SparkWallet to use
60
+ * @param options - Client options
61
+ */
62
+ constructor(wallet, _options = {}) {
76
63
  this._wallet = wallet;
77
- // Determine configuration type and extract values
78
- const isLegacyConfig = !configOrOptions || 'network' in configOrOptions ||
79
- (!('sparkNetworkType' in configOrOptions));
80
- if (isLegacyConfig) {
81
- // Legacy configuration system - derive from wallet or options
82
- const legacyConfig = configOrOptions;
83
- if (legacyConfig?.network) {
84
- // Use provided legacy network
85
- this.sparkNetwork = index.getSparkNetworkFromLegacy(legacyConfig.network);
86
- this.clientEnvironment = index.getClientEnvironmentFromLegacy(legacyConfig.network);
87
- }
88
- else {
89
- // Auto-detect from wallet (existing behavior)
90
- // @ts-expect-error - wallet.config is protected
91
- const networkEnum = wallet.config.getNetwork();
92
- const networkName = index.Network[networkEnum];
93
- const detectedNetwork = networkName === "MAINNET" ? "MAINNET" : "REGTEST";
94
- this.sparkNetwork = index.getSparkNetworkFromLegacy(detectedNetwork);
95
- this.clientEnvironment = index.getClientEnvironmentFromLegacy(detectedNetwork);
96
- }
97
- }
98
- else {
99
- // New configuration system
100
- const config = configOrOptions;
101
- this.sparkNetwork = config.sparkNetworkType;
102
- // Determine client configuration based on the specific config type
103
- let clientConfig;
104
- if ('clientConfig' in config) {
105
- // FlashnetClientConfig - can be either environment or custom config
106
- clientConfig = config.clientConfig;
107
- }
108
- else if ('clientNetworkConfig' in config) {
109
- // FlashnetClientCustomConfig - custom configuration
110
- clientConfig = config.clientNetworkConfig;
111
- }
112
- else if ('clientEnvironment' in config) {
113
- // FlashnetClientEnvironmentConfig - predefined environment
114
- clientConfig = config.clientEnvironment;
115
- }
116
- else {
117
- throw new Error('Invalid configuration: must specify clientConfig, clientNetworkConfig, or clientEnvironment');
118
- }
119
- // Resolve the client environment name for internal tracking
120
- const environmentName = index$1.getClientEnvironmentName(clientConfig);
121
- this.clientEnvironment = environmentName === 'custom' ? 'local' : environmentName;
122
- // Validate Spark network and client environment combination
123
- const validation = index$1.validateNetworkCombination(this.sparkNetwork, this.clientEnvironment);
124
- if (!validation.valid) {
125
- throw new Error(`Invalid network combination: ${validation.error}`);
126
- }
127
- }
128
- // Panic if mainnet for now
129
- if (this.sparkNetwork === "MAINNET") {
64
+ // We'll initialize these in the init method
65
+ // @ts-expect-error - wallet.config is protected
66
+ const networkEnum = wallet.config.getNetwork();
67
+ const networkName = index.Network[networkEnum];
68
+ this.network = networkName === "MAINNET" ? "MAINNET" : "REGTEST";
69
+ // panic if mainnet for now
70
+ if (networkName === "MAINNET") {
130
71
  throw new Error("Mainnet is not supported yet");
131
72
  }
132
- // Initialize API client with resolved client configuration
133
- let resolvedClientConfig;
134
- if (!isLegacyConfig) {
135
- const config = configOrOptions;
136
- let clientConfigParam;
137
- if ('clientConfig' in config) {
138
- clientConfigParam = config.clientConfig;
139
- }
140
- else if ('clientNetworkConfig' in config) {
141
- clientConfigParam = config.clientNetworkConfig;
142
- }
143
- else if ('clientEnvironment' in config) {
144
- clientConfigParam = config.clientEnvironment;
145
- }
146
- else {
147
- throw new Error('Invalid configuration');
148
- }
149
- resolvedClientConfig = index$1.resolveClientNetworkConfig(clientConfigParam);
150
- }
151
- else {
152
- // Use legacy resolution
153
- resolvedClientConfig = index$1.getClientNetworkConfig(this.clientEnvironment);
154
- }
155
- this.apiClient = new client.ApiClient(resolvedClientConfig);
73
+ const config = index$1.getNetworkConfig(this.network);
74
+ this.apiClient = new client.ApiClient(config);
156
75
  this.typedApi = new typedEndpoints.TypedAmmApi(this.apiClient);
157
76
  this.authManager = new auth.AuthManager(this.apiClient, "", wallet);
158
77
  }
@@ -167,21 +86,20 @@ class FlashnetClient {
167
86
  // Get wallet details
168
87
  this.publicKey = await this._wallet.getIdentityPublicKey();
169
88
  this.sparkAddress = await this._wallet.getSparkAddress();
170
- // Deduce Spark network from spark address and validate consistency
171
- const detectedSparkNetwork = sparkAddress.getSparkNetworkFromAddress(this.sparkAddress);
172
- if (!detectedSparkNetwork) {
173
- throw new Error(`Unable to determine Spark network from spark address: ${this.sparkAddress}`);
174
- }
175
- // Warn if configured Spark network doesn't match detected network
176
- if (this.sparkNetwork !== detectedSparkNetwork) {
177
- console.warn(`Warning: Configured Spark network (${this.sparkNetwork}) doesn't match detected network from address (${detectedSparkNetwork}). Using detected network.`);
178
- this.sparkNetwork = detectedSparkNetwork;
89
+ // Deduce network from spark address
90
+ const detectedNetwork = sparkAddress.getNetworkFromAddress(this.sparkAddress);
91
+ if (!detectedNetwork) {
92
+ throw new Error(`Unable to determine network from spark address: ${this.sparkAddress}`);
179
93
  }
180
- // Panic if mainnet for now
181
- if (this.sparkNetwork === "MAINNET") {
94
+ this.network = detectedNetwork;
95
+ // panic if mainnet for now
96
+ if (detectedNetwork === "MAINNET") {
182
97
  throw new Error("Mainnet is not supported yet");
183
98
  }
184
- // Re-initialize auth manager with correct public key
99
+ // Reinitialize API client with correct network
100
+ const config = index$1.getNetworkConfig(this.network);
101
+ this.apiClient = new client.ApiClient(config);
102
+ this.typedApi = new typedEndpoints.TypedAmmApi(this.apiClient);
185
103
  this.authManager = new auth.AuthManager(this.apiClient, this.publicKey, signer.createWalletSigner(this._wallet));
186
104
  // Authenticate
187
105
  const token = await this.authManager.authenticate();
@@ -199,7 +117,7 @@ class FlashnetClient {
199
117
  /**
200
118
  * Ensure a token identifier is in human-readable (Bech32m) form expected by the Spark SDK.
201
119
  * If the identifier is already human-readable or it is the BTC constant, it is returned unchanged.
202
- * Otherwise, it is encoded from the raw hex form using the client's Spark network.
120
+ * Otherwise, it is encoded from the raw hex form using the client network.
203
121
  */
204
122
  toHumanReadableTokenIdentifier(tokenIdentifier) {
205
123
  if (tokenIdentifier === index$1.BTC_ASSET_PUBKEY) {
@@ -208,7 +126,7 @@ class FlashnetClient {
208
126
  if (tokenIdentifier.startsWith("btkn")) {
209
127
  return tokenIdentifier;
210
128
  }
211
- return tokenAddress.encodeSparkHumanReadableTokenIdentifier(tokenIdentifier, this.sparkNetwork);
129
+ return tokenAddress.encodeHumanReadableTokenIdentifier(tokenIdentifier, this.network);
212
130
  }
213
131
  /**
214
132
  * Convert a token identifier into the raw hex string form expected by the Flashnet backend.
@@ -220,7 +138,7 @@ class FlashnetClient {
220
138
  return tokenIdentifier;
221
139
  }
222
140
  if (tokenIdentifier.startsWith("btkn")) {
223
- return tokenAddress.decodeSparkHumanReadableTokenIdentifier(tokenIdentifier, this.sparkNetwork).tokenIdentifier;
141
+ return tokenAddress.decodeHumanReadableTokenIdentifier(tokenIdentifier, this.network).tokenIdentifier;
224
142
  }
225
143
  return tokenIdentifier;
226
144
  }
@@ -233,16 +151,18 @@ class FlashnetClient {
233
151
  const tokenBalances = new Map();
234
152
  if (balance.tokenBalances) {
235
153
  for (const [tokenPubkey, tokenData] of balance.tokenBalances.entries()) {
236
- const info = "tokenInfo" in tokenData
237
- ? tokenData.tokenInfo
238
- : tokenData.tokenMetadata;
154
+ const info = tokenData.tokenMetadata;
155
+ // Convert raw token identifier to hex and human-readable forms
156
+ const tokenIdentifierHex = Buffer.from(info.rawTokenIdentifier).toString("hex");
157
+ const tokenAddress$1 = tokenAddress.encodeHumanReadableTokenIdentifier(info.rawTokenIdentifier, this.network);
239
158
  tokenBalances.set(tokenPubkey, {
240
159
  balance: BigInt(tokenData.balance),
241
160
  tokenInfo: {
242
- tokenPublicKey: info.tokenPublicKey,
161
+ tokenIdentifier: tokenIdentifierHex,
162
+ tokenAddress: tokenAddress$1,
243
163
  tokenName: info.tokenName,
244
- tokenSymbol: (info.tokenSymbol || info.tokenTicker),
245
- tokenDecimals: (info.tokenDecimals ?? info.decimals),
164
+ tokenSymbol: info.tokenTicker,
165
+ tokenDecimals: info.decimals,
246
166
  maxSupply: info.maxSupply,
247
167
  },
248
168
  });
@@ -434,10 +354,10 @@ class FlashnetClient {
434
354
  // If pool creation was successful, handle the initial deposit
435
355
  if (createResponse.poolId) {
436
356
  try {
437
- // Transfer initial reserve to the pool using new address encoding
438
- const lpSparkAddress = sparkAddress.encodeSparkAddressNew({
357
+ // Transfer initial reserve to the pool
358
+ const lpSparkAddress = sparkAddress.encodeSparkAddress({
439
359
  identityPublicKey: createResponse.poolId,
440
- network: this.sparkNetwork,
360
+ network: this.network,
441
361
  });
442
362
  let assetATransferId;
443
363
  if (params.assetAAddress === index$1.BTC_ASSET_PUBKEY) {
@@ -536,10 +456,10 @@ class FlashnetClient {
536
456
  if (!balanceCheck.sufficient) {
537
457
  throw new Error(`Insufficient balance for swap: ${balanceCheck.message}`);
538
458
  }
539
- // Transfer assets to pool using new address encoding
540
- const lpSparkAddress = sparkAddress.encodeSparkAddressNew({
459
+ // Transfer assets to pool
460
+ const lpSparkAddress = sparkAddress.encodeSparkAddress({
541
461
  identityPublicKey: params.poolId,
542
- network: this.sparkNetwork,
462
+ network: this.network,
543
463
  });
544
464
  let transferId;
545
465
  if (params.assetInAddress === index$1.BTC_ASSET_PUBKEY) {
@@ -628,14 +548,14 @@ class FlashnetClient {
628
548
  if (!params.hops.length) {
629
549
  throw new Error("Route swap requires at least one hop");
630
550
  }
631
- // Transfer initial asset to first pool using new address encoding
551
+ // Transfer initial asset to first pool
632
552
  const firstPoolId = params.hops[0]?.poolId;
633
553
  if (!firstPoolId) {
634
554
  throw new Error("First pool ID is required");
635
555
  }
636
- const lpSparkAddress = sparkAddress.encodeSparkAddressNew({
556
+ const lpSparkAddress = sparkAddress.encodeSparkAddress({
637
557
  identityPublicKey: firstPoolId,
638
- network: this.sparkNetwork,
558
+ network: this.network,
639
559
  });
640
560
  let initialTransferId;
641
561
  if (params.initialAssetAddress === index$1.BTC_ASSET_PUBKEY) {
@@ -750,10 +670,10 @@ class FlashnetClient {
750
670
  if (!balanceCheck.sufficient) {
751
671
  throw new Error(`Insufficient balance for adding liquidity: ${balanceCheck.message}`);
752
672
  }
753
- // Transfer assets to pool using new address encoding
754
- const lpSparkAddress = sparkAddress.encodeSparkAddressNew({
673
+ // Transfer assets to pool
674
+ const lpSparkAddress = sparkAddress.encodeSparkAddress({
755
675
  identityPublicKey: params.poolId,
756
- network: this.sparkNetwork,
676
+ network: this.network,
757
677
  });
758
678
  // Transfer asset A
759
679
  let assetATransferId;
@@ -1013,38 +933,20 @@ class FlashnetClient {
1013
933
  }
1014
934
  // ===== Token Address Operations =====
1015
935
  /**
1016
- * Encode a token identifier into a human-readable token address using the client's Spark network
936
+ * Encode a token identifier into a human-readable token address using the client's network
1017
937
  * @param tokenIdentifier - Token identifier as hex string or Uint8Array
1018
938
  * @returns Human-readable token address
1019
939
  */
1020
940
  encodeTokenAddress(tokenIdentifier) {
1021
- return tokenAddress.encodeSparkHumanReadableTokenIdentifier(tokenIdentifier, this.sparkNetwork);
941
+ return tokenAddress.encodeHumanReadableTokenIdentifier(tokenIdentifier, this.network);
1022
942
  }
1023
943
  /**
1024
944
  * Decode a human-readable token address back to its identifier
1025
945
  * @param address - Human-readable token address
1026
- * @returns Object containing the token identifier (as hex string) and Spark network
1027
- */
1028
- decodeTokenAddress(address) {
1029
- return tokenAddress.decodeSparkHumanReadableTokenIdentifier(address, this.sparkNetwork);
1030
- }
1031
- /**
1032
- * @deprecated Use encodeTokenAddress instead - this method uses legacy types
1033
- * Encode a token identifier into a human-readable token address using legacy types
1034
- * @param tokenIdentifier - Token identifier as hex string or Uint8Array
1035
- * @returns Human-readable token address
1036
- */
1037
- encodeLegacyTokenAddress(tokenIdentifier) {
1038
- return tokenAddress.encodeHumanReadableTokenIdentifier(tokenIdentifier, this.sparkNetwork);
1039
- }
1040
- /**
1041
- * @deprecated Use decodeTokenAddress instead - this method uses legacy types
1042
- * Decode a human-readable token address back to its identifier using legacy types
1043
- * @param address - Human-readable token address
1044
946
  * @returns Object containing the token identifier (as hex string) and network
1045
947
  */
1046
- decodeLegacyTokenAddress(address) {
1047
- return tokenAddress.decodeHumanReadableTokenIdentifier(address, this.sparkNetwork);
948
+ decodeTokenAddress(address) {
949
+ return tokenAddress.decodeHumanReadableTokenIdentifier(address, this.network);
1048
950
  }
1049
951
  // ===== Status =====
1050
952
  /**
@@ -1059,9 +961,9 @@ class FlashnetClient {
1059
961
  * Helper method to add initial liquidity after pool creation
1060
962
  */
1061
963
  async addInitialLiquidity(poolId, assetATokenPublicKey, assetBTokenPublicKey, assetAAmount, assetBAmount) {
1062
- const lpSparkAddress = sparkAddress.encodeSparkAddressNew({
964
+ const lpSparkAddress = sparkAddress.encodeSparkAddress({
1063
965
  identityPublicKey: poolId,
1064
- network: this.sparkNetwork,
966
+ network: this.network,
1065
967
  });
1066
968
  // Transfer asset A
1067
969
  let assetATransferId;