@flashbacktech/flashbackclient 0.2.70 → 0.2.72

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.
@@ -23,12 +23,13 @@ export interface CreateUnitRequest {
23
23
  name: string;
24
24
  bucket: string;
25
25
  storageType: StorageType;
26
- key: string;
27
- secret: string;
26
+ key?: string;
27
+ secret?: string;
28
28
  endpoint?: string;
29
29
  region?: string;
30
30
  workspaceId: string;
31
31
  walletAddress?: string;
32
+ apiKeyUuid?: string;
32
33
  }
33
34
  export interface GetUnitNodeStatsRequest {
34
35
  day: Date;
@@ -138,7 +139,7 @@ export interface StorageBucket {
138
139
  name: string;
139
140
  bucket: string;
140
141
  storageType: StorageType;
141
- key: string;
142
+ key?: string;
142
143
  secret?: EncryptedKey;
143
144
  endpoint?: string;
144
145
  region?: string;
@@ -148,6 +149,7 @@ export interface StorageBucket {
148
149
  workspaceId: string;
149
150
  walletAddress?: string;
150
151
  repos?: StorageRepoBasic[];
152
+ apiKeyId?: string;
151
153
  }
152
154
  export interface GetUnitsResponse {
153
155
  success: boolean;
@@ -166,10 +168,11 @@ export interface GetRepoKeysResponse {
166
168
  keys: ApiKey[];
167
169
  }
168
170
  export interface ValidateUnitRequest {
169
- key: string;
170
- secret: string;
171
+ key?: string;
172
+ secret?: string;
171
173
  endpoint?: string;
172
174
  bucket: string;
175
+ apiKeyUuid?: string;
173
176
  }
174
177
  export interface ValidateUnitResponse {
175
178
  success: boolean;
@@ -270,6 +273,18 @@ export interface StorageBucketStatusResponse {
270
273
  bucketId: string;
271
274
  nodeStatus: NodeStatusInfo[];
272
275
  }
276
+ export interface ProviderApiKeyDTO {
277
+ id: string;
278
+ key: string;
279
+ endpoint?: string;
280
+ region?: string;
281
+ provider: string;
282
+ createdAt: string;
283
+ }
284
+ export interface GetProviderApiKeysResponse {
285
+ success: boolean;
286
+ apiKeys: ProviderApiKeyDTO[];
287
+ }
273
288
  export interface GetBucketNodeStatsRequest {
274
289
  day: Date;
275
290
  }
@@ -7,6 +7,12 @@ export interface StellarNetwork {
7
7
  }
8
8
  declare const getNetwork: (network: string) => StellarNetwork;
9
9
  declare const getPublicKeyFromPrivateKey: (privateKey: string) => string;
10
+ /**
11
+ * Set a custom Soroban RPC server URL for a network.
12
+ * Use this to point the client at a different RPC endpoint (e.g. your own node).
13
+ * Pass `undefined` as url to clear the override and revert to the default for that network.
14
+ */
15
+ export declare const setServer: (network: string, url: string | undefined) => void;
10
16
  declare const getServer: (network: StellarNetwork) => rpc.Server;
11
17
  interface ContractMethodCall {
12
18
  method: string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getServer = exports.getPublicKeyFromPrivateKey = exports.getNetwork = exports.signTransaction = exports.sendTransaction = exports.prepareTransaction = exports.createPrivateKeySigner = exports.executeMultiWalletTransactions = exports.executeWalletTransaction = exports.executeServerTransaction = exports.getHorizonServer = void 0;
3
+ exports.getServer = exports.getPublicKeyFromPrivateKey = exports.getNetwork = exports.signTransaction = exports.sendTransaction = exports.prepareTransaction = exports.createPrivateKeySigner = exports.executeMultiWalletTransactions = exports.executeWalletTransaction = exports.executeServerTransaction = exports.getHorizonServer = exports.setServer = void 0;
4
4
  const timing_1 = require("../utils/timing");
5
5
  // Polyfill for BigInt JSON serialization
6
6
  BigInt.prototype.toJSON = function () {
@@ -32,30 +32,37 @@ const getPublicKeyFromPrivateKey = (privateKey) => {
32
32
  return keypair.publicKey();
33
33
  };
34
34
  exports.getPublicKeyFromPrivateKey = getPublicKeyFromPrivateKey;
35
+ const DEFAULT_RPC_URLS = {
36
+ TESTNET: "https://soroban-testnet.stellar.org",
37
+ PUBLIC: "https://soroban-rpc.creit.tech",
38
+ };
39
+ const customRpcUrls = {};
40
+ /**
41
+ * Set a custom Soroban RPC server URL for a network.
42
+ * Use this to point the client at a different RPC endpoint (e.g. your own node).
43
+ * Pass `undefined` as url to clear the override and revert to the default for that network.
44
+ */
45
+ const setServer = (network, url) => {
46
+ if (url === undefined) {
47
+ delete customRpcUrls[network];
48
+ }
49
+ else {
50
+ customRpcUrls[network] = url;
51
+ }
52
+ };
53
+ exports.setServer = setServer;
35
54
  const getServer = (network) => {
36
- let serverUrl = "";
37
- switch (network.network) {
38
- case "TESTNET":
39
- serverUrl = "https://soroban-testnet.stellar.org";
40
- break;
41
- case "PUBLIC":
42
- //serverUrl = "https://rpc.stellar.org";
43
- //serverUrl = "https://stellar-soroban-public.nodies.app";
44
- serverUrl = "https://soroban-rpc.mainnet.stellar.gateway.fm";
45
- break;
55
+ const serverUrl = customRpcUrls[network.network] ?? DEFAULT_RPC_URLS[network.network] ?? "";
56
+ if (!serverUrl) {
57
+ throw new Error(`No RPC URL configured for network "${network.network}". Use setServer(network, url) or ensure the network is one of: TESTNET, PUBLIC.`);
46
58
  }
47
- // For Stellar SDK v13+, we need to handle the allowHttp issue
48
- let server;
49
- // Approach 1: Try with allowHttp option
50
59
  try {
51
- server = new stellar_sdk_2.rpc.Server(serverUrl, { allowHttp: true });
52
- return server;
60
+ return new stellar_sdk_2.rpc.Server(serverUrl, { allowHttp: true });
53
61
  }
54
62
  catch (error) {
55
63
  console.log(`Failed with allowHttp: true:`, error instanceof Error ? error.message : String(error));
64
+ throw new Error(`Failed to create Soroban RPC server for ${network.network} at ${serverUrl}. All configuration attempts failed.`);
56
65
  }
57
- // If all approaches fail, throw a comprehensive error
58
- throw new Error(`Failed to create Soroban RPC server for ${network.network} at ${serverUrl}. All configuration attempts failed.`);
59
66
  };
60
67
  exports.getServer = getServer;
61
68
  const TIMEOUT_TRANSACTION = 60;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashbacktech/flashbackclient",
3
- "version": "0.2.70",
3
+ "version": "0.2.72",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"