orbis1-sdk-rn 0.0.3 → 0.0.5

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.
Files changed (52) hide show
  1. package/README.md +211 -32
  2. package/android/build.gradle +35 -0
  3. package/android/src/main/java/com/orbis1sdk/Orbis1SdkPackage.kt +5 -5
  4. package/android/src/main/java/com/orbis1sdk/RgbModule.kt +3 -4
  5. package/ios/Rgb.swift +57 -2
  6. package/lib/module/Orbis1SDK.js +10 -5
  7. package/lib/module/Orbis1SDK.js.map +1 -1
  8. package/lib/module/features/gas-free/GasFreeModule.js +2 -2
  9. package/lib/module/features/gas-free/GasFreeModule.js.map +1 -1
  10. package/lib/module/features/gas-free/types/GasFreeConfig.js +9 -9
  11. package/lib/module/features/gas-free/types/GasFreeConfig.js.map +1 -1
  12. package/lib/module/features/watch-tower/WatchTowerModule.js +2 -2
  13. package/lib/module/features/watch-tower/WatchTowerModule.js.map +1 -1
  14. package/lib/module/features/watch-tower/index.js +0 -1
  15. package/lib/module/features/watch-tower/index.js.map +1 -1
  16. package/lib/module/features/watch-tower/types/WatchTowerConfig.js +11 -1
  17. package/lib/module/features/watch-tower/types/WatchTowerConfig.js.map +1 -1
  18. package/lib/module/features/watch-tower/types/index.js +0 -2
  19. package/lib/module/features/watch-tower/types/index.js.map +1 -1
  20. package/lib/module/index.js +1 -1
  21. package/lib/module/index.js.map +1 -1
  22. package/lib/module/types/IFeatureModule.js.map +1 -1
  23. package/lib/module/types/SDKConfig.js +28 -2
  24. package/lib/module/types/SDKConfig.js.map +1 -1
  25. package/lib/typescript/src/Orbis1SDK.d.ts.map +1 -1
  26. package/lib/typescript/src/features/gas-free/types/GasFreeConfig.d.ts +11 -6
  27. package/lib/typescript/src/features/gas-free/types/GasFreeConfig.d.ts.map +1 -1
  28. package/lib/typescript/src/features/watch-tower/index.d.ts +0 -1
  29. package/lib/typescript/src/features/watch-tower/index.d.ts.map +1 -1
  30. package/lib/typescript/src/features/watch-tower/types/WatchTowerConfig.d.ts +10 -2
  31. package/lib/typescript/src/features/watch-tower/types/WatchTowerConfig.d.ts.map +1 -1
  32. package/lib/typescript/src/features/watch-tower/types/index.d.ts +0 -1
  33. package/lib/typescript/src/features/watch-tower/types/index.d.ts.map +1 -1
  34. package/lib/typescript/src/index.d.ts +1 -1
  35. package/lib/typescript/src/index.d.ts.map +1 -1
  36. package/lib/typescript/src/types/IFeatureModule.d.ts +3 -0
  37. package/lib/typescript/src/types/IFeatureModule.d.ts.map +1 -1
  38. package/lib/typescript/src/types/SDKConfig.d.ts +31 -43
  39. package/lib/typescript/src/types/SDKConfig.d.ts.map +1 -1
  40. package/package.json +1 -1
  41. package/src/Orbis1SDK.ts +20 -5
  42. package/src/features/gas-free/GasFreeModule.ts +2 -2
  43. package/src/features/gas-free/types/GasFreeConfig.ts +12 -10
  44. package/src/features/watch-tower/WatchTowerModule.ts +2 -2
  45. package/src/features/watch-tower/index.ts +0 -1
  46. package/src/features/watch-tower/types/WatchTowerConfig.ts +14 -2
  47. package/src/features/watch-tower/types/index.ts +0 -1
  48. package/src/index.tsx +1 -1
  49. package/src/types/IFeatureModule.ts +3 -0
  50. package/src/types/SDKConfig.ts +54 -9
  51. package/android/src/main/java/com/orbis1sdk/Orbis1SdkModule.kt +0 -15
  52. package/android/src/main/java/com/orbis1sdk/RgbPackage.kt +0 -33
@@ -6,8 +6,7 @@
6
6
  * @module types/SDKConfig
7
7
  */
8
8
  import { z } from 'zod';
9
- import type { IFeatureConfig } from './IFeatureModule';
10
- import type { Keys, BitcoinNetwork, AssetSchema } from '../core/Interfaces';
9
+ import type { Keys, AssetSchema } from '../core/Interfaces';
11
10
  /**
12
11
  * Wallet configuration for the SDK
13
12
  */
@@ -16,8 +15,6 @@ export interface WalletConfig {
16
15
  enabled: boolean;
17
16
  /** Wallet keys (mnemonic, xpubs, etc.) */
18
17
  keys: Keys;
19
- /** Bitcoin network */
20
- network?: BitcoinNetwork;
21
18
  /** Supported asset schemas */
22
19
  supportedSchemas?: AssetSchema[];
23
20
  /** Maximum allocations per UTXO */
@@ -42,19 +39,26 @@ export declare enum LogLevel {
42
39
  /** Verbose logging (all messages) */
43
40
  VERBOSE = "verbose"
44
41
  }
42
+ /**
43
+ * SDK Environment
44
+ * Determines which network and service endpoints to use
45
+ */
46
+ export declare enum Environment {
47
+ /** Testnet4 environment */
48
+ TESTNET = "testnet",
49
+ /** Mainnet environment (production) */
50
+ MAINNET = "mainnet"
51
+ }
45
52
  /**
46
53
  * Zod schema for Gas-Free feature configuration
47
54
  */
48
55
  export declare const GasFreeFeatureConfigSchema: z.ZodObject<{
49
- name: z.ZodOptional<z.ZodLiteral<"gasFree">>;
50
56
  enabled: z.ZodOptional<z.ZodBoolean>;
51
57
  timeout: z.ZodOptional<z.ZodNumber>;
52
58
  }, "strip", z.ZodTypeAny, {
53
- name?: "gasFree" | undefined;
54
59
  enabled?: boolean | undefined;
55
60
  timeout?: number | undefined;
56
61
  }, {
57
- name?: "gasFree" | undefined;
58
62
  enabled?: boolean | undefined;
59
63
  timeout?: number | undefined;
60
64
  }>;
@@ -62,15 +66,12 @@ export declare const GasFreeFeatureConfigSchema: z.ZodObject<{
62
66
  * Zod schema for Watch Tower feature configuration
63
67
  */
64
68
  export declare const WatchTowerFeatureConfigSchema: z.ZodObject<{
65
- name: z.ZodOptional<z.ZodLiteral<"watchTower">>;
66
69
  enabled: z.ZodOptional<z.ZodBoolean>;
67
70
  pollingInterval: z.ZodOptional<z.ZodNumber>;
68
71
  }, "strip", z.ZodTypeAny, {
69
- name?: "watchTower" | undefined;
70
72
  enabled?: boolean | undefined;
71
73
  pollingInterval?: number | undefined;
72
74
  }, {
73
- name?: "watchTower" | undefined;
74
75
  enabled?: boolean | undefined;
75
76
  pollingInterval?: number | undefined;
76
77
  }>;
@@ -102,84 +103,67 @@ export declare const SDKOptionsSchema: z.ZodObject<{
102
103
  */
103
104
  export declare const SDKConfigSchema: z.ZodObject<{
104
105
  apiKey: z.ZodString;
106
+ environment: z.ZodDefault<z.ZodNativeEnum<typeof Environment>>;
105
107
  features: z.ZodOptional<z.ZodObject<{
106
108
  gasFree: z.ZodOptional<z.ZodObject<{
107
- name: z.ZodOptional<z.ZodLiteral<"gasFree">>;
108
109
  enabled: z.ZodOptional<z.ZodBoolean>;
109
110
  timeout: z.ZodOptional<z.ZodNumber>;
110
111
  }, "strip", z.ZodTypeAny, {
111
- name?: "gasFree" | undefined;
112
112
  enabled?: boolean | undefined;
113
113
  timeout?: number | undefined;
114
114
  }, {
115
- name?: "gasFree" | undefined;
116
115
  enabled?: boolean | undefined;
117
116
  timeout?: number | undefined;
118
117
  }>>;
119
118
  watchTower: z.ZodOptional<z.ZodObject<{
120
- name: z.ZodOptional<z.ZodLiteral<"watchTower">>;
121
119
  enabled: z.ZodOptional<z.ZodBoolean>;
122
120
  pollingInterval: z.ZodOptional<z.ZodNumber>;
123
121
  }, "strip", z.ZodTypeAny, {
124
- name?: "watchTower" | undefined;
125
122
  enabled?: boolean | undefined;
126
123
  pollingInterval?: number | undefined;
127
124
  }, {
128
- name?: "watchTower" | undefined;
129
125
  enabled?: boolean | undefined;
130
126
  pollingInterval?: number | undefined;
131
127
  }>>;
132
128
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
133
129
  gasFree: z.ZodOptional<z.ZodObject<{
134
- name: z.ZodOptional<z.ZodLiteral<"gasFree">>;
135
130
  enabled: z.ZodOptional<z.ZodBoolean>;
136
131
  timeout: z.ZodOptional<z.ZodNumber>;
137
132
  }, "strip", z.ZodTypeAny, {
138
- name?: "gasFree" | undefined;
139
133
  enabled?: boolean | undefined;
140
134
  timeout?: number | undefined;
141
135
  }, {
142
- name?: "gasFree" | undefined;
143
136
  enabled?: boolean | undefined;
144
137
  timeout?: number | undefined;
145
138
  }>>;
146
139
  watchTower: z.ZodOptional<z.ZodObject<{
147
- name: z.ZodOptional<z.ZodLiteral<"watchTower">>;
148
140
  enabled: z.ZodOptional<z.ZodBoolean>;
149
141
  pollingInterval: z.ZodOptional<z.ZodNumber>;
150
142
  }, "strip", z.ZodTypeAny, {
151
- name?: "watchTower" | undefined;
152
143
  enabled?: boolean | undefined;
153
144
  pollingInterval?: number | undefined;
154
145
  }, {
155
- name?: "watchTower" | undefined;
156
146
  enabled?: boolean | undefined;
157
147
  pollingInterval?: number | undefined;
158
148
  }>>;
159
149
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
160
150
  gasFree: z.ZodOptional<z.ZodObject<{
161
- name: z.ZodOptional<z.ZodLiteral<"gasFree">>;
162
151
  enabled: z.ZodOptional<z.ZodBoolean>;
163
152
  timeout: z.ZodOptional<z.ZodNumber>;
164
153
  }, "strip", z.ZodTypeAny, {
165
- name?: "gasFree" | undefined;
166
154
  enabled?: boolean | undefined;
167
155
  timeout?: number | undefined;
168
156
  }, {
169
- name?: "gasFree" | undefined;
170
157
  enabled?: boolean | undefined;
171
158
  timeout?: number | undefined;
172
159
  }>>;
173
160
  watchTower: z.ZodOptional<z.ZodObject<{
174
- name: z.ZodOptional<z.ZodLiteral<"watchTower">>;
175
161
  enabled: z.ZodOptional<z.ZodBoolean>;
176
162
  pollingInterval: z.ZodOptional<z.ZodNumber>;
177
163
  }, "strip", z.ZodTypeAny, {
178
- name?: "watchTower" | undefined;
179
164
  enabled?: boolean | undefined;
180
165
  pollingInterval?: number | undefined;
181
166
  }, {
182
- name?: "watchTower" | undefined;
183
167
  enabled?: boolean | undefined;
184
168
  pollingInterval?: number | undefined;
185
169
  }>>;
@@ -203,33 +187,28 @@ export declare const SDKConfigSchema: z.ZodObject<{
203
187
  }>>;
204
188
  }, "strip", z.ZodTypeAny, {
205
189
  apiKey: string;
190
+ environment: Environment;
206
191
  options?: {
207
192
  strictMode?: boolean | undefined;
208
193
  } | undefined;
209
194
  features?: z.objectOutputType<{
210
195
  gasFree: z.ZodOptional<z.ZodObject<{
211
- name: z.ZodOptional<z.ZodLiteral<"gasFree">>;
212
196
  enabled: z.ZodOptional<z.ZodBoolean>;
213
197
  timeout: z.ZodOptional<z.ZodNumber>;
214
198
  }, "strip", z.ZodTypeAny, {
215
- name?: "gasFree" | undefined;
216
199
  enabled?: boolean | undefined;
217
200
  timeout?: number | undefined;
218
201
  }, {
219
- name?: "gasFree" | undefined;
220
202
  enabled?: boolean | undefined;
221
203
  timeout?: number | undefined;
222
204
  }>>;
223
205
  watchTower: z.ZodOptional<z.ZodObject<{
224
- name: z.ZodOptional<z.ZodLiteral<"watchTower">>;
225
206
  enabled: z.ZodOptional<z.ZodBoolean>;
226
207
  pollingInterval: z.ZodOptional<z.ZodNumber>;
227
208
  }, "strip", z.ZodTypeAny, {
228
- name?: "watchTower" | undefined;
229
209
  enabled?: boolean | undefined;
230
210
  pollingInterval?: number | undefined;
231
211
  }, {
232
- name?: "watchTower" | undefined;
233
212
  enabled?: boolean | undefined;
234
213
  pollingInterval?: number | undefined;
235
214
  }>>;
@@ -243,30 +222,25 @@ export declare const SDKConfigSchema: z.ZodObject<{
243
222
  options?: {
244
223
  strictMode?: boolean | undefined;
245
224
  } | undefined;
225
+ environment?: Environment | undefined;
246
226
  features?: z.objectInputType<{
247
227
  gasFree: z.ZodOptional<z.ZodObject<{
248
- name: z.ZodOptional<z.ZodLiteral<"gasFree">>;
249
228
  enabled: z.ZodOptional<z.ZodBoolean>;
250
229
  timeout: z.ZodOptional<z.ZodNumber>;
251
230
  }, "strip", z.ZodTypeAny, {
252
- name?: "gasFree" | undefined;
253
231
  enabled?: boolean | undefined;
254
232
  timeout?: number | undefined;
255
233
  }, {
256
- name?: "gasFree" | undefined;
257
234
  enabled?: boolean | undefined;
258
235
  timeout?: number | undefined;
259
236
  }>>;
260
237
  watchTower: z.ZodOptional<z.ZodObject<{
261
- name: z.ZodOptional<z.ZodLiteral<"watchTower">>;
262
238
  enabled: z.ZodOptional<z.ZodBoolean>;
263
239
  pollingInterval: z.ZodOptional<z.ZodNumber>;
264
240
  }, "strip", z.ZodTypeAny, {
265
- name?: "watchTower" | undefined;
266
241
  enabled?: boolean | undefined;
267
242
  pollingInterval?: number | undefined;
268
243
  }, {
269
- name?: "watchTower" | undefined;
270
244
  enabled?: boolean | undefined;
271
245
  pollingInterval?: number | undefined;
272
246
  }>>;
@@ -285,9 +259,16 @@ export interface SDKConfig {
285
259
  * Required for all backend services.
286
260
  */
287
261
  apiKey: string;
262
+ /**
263
+ * SDK environment (testnet or mainnet).
264
+ * Determines which network and service endpoints to use.
265
+ * Defaults to mainnet if not specified.
266
+ */
267
+ environment: Environment;
288
268
  /**
289
269
  * Wallet configuration.
290
270
  * Required for RGB operations and wallet-dependent features (Gas-Free).
271
+ * Network (testnet4 or mainnet) is determined by the environment setting.
291
272
  */
292
273
  wallet?: WalletConfig;
293
274
  /**
@@ -298,17 +279,24 @@ export interface SDKConfig {
298
279
  */
299
280
  features?: {
300
281
  /** Gas-Free feature configuration */
301
- gasFree?: IFeatureConfig & {
282
+ gasFree?: {
283
+ /** Enable the feature */
284
+ enabled?: boolean;
302
285
  /** Request timeout in milliseconds */
303
286
  timeout?: number;
304
287
  };
305
288
  /** Watch-Tower feature configuration */
306
- watchTower?: IFeatureConfig & {
289
+ watchTower?: {
290
+ /** Enable the feature */
291
+ enabled?: boolean;
307
292
  /** Polling interval in milliseconds */
308
293
  pollingInterval?: number;
309
294
  };
310
295
  /** Custom features */
311
- [key: string]: IFeatureConfig | undefined;
296
+ [key: string]: {
297
+ enabled?: boolean;
298
+ [key: string]: unknown;
299
+ } | undefined;
312
300
  };
313
301
  /**
314
302
  * Logging configuration
@@ -1 +1 @@
1
- {"version":3,"file":"SDKConfig.d.ts","sourceRoot":"","sources":["../../../../src/types/SDKConfig.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AA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CAAqC;QACrC,OAAO,CAAC,EAAE;YACR,yBAAyB;YACzB,OAAO,CAAC,EAAE,OAAO,CAAC;YAClB,sCAAsC;YACtC,OAAO,CAAC,EAAE,MAAM,CAAC;SAClB,CAAC;QAEF,wCAAwC;QACxC,UAAU,CAAC,EAAE;YACX,yBAAyB;YACzB,OAAO,CAAC,EAAE,OAAO,CAAC;YAClB,uCAAuC;YACvC,eAAe,CAAC,EAAE,MAAM,CAAC;SAC1B,CAAC;QAEF,sBAAsB;QACtB,CAAC,GAAG,EAAE,MAAM,GAAG;YAAE,OAAO,CAAC,EAAE,OAAO,CAAC;YAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;SAAE,GAAG,SAAS,CAAC;KAC1E,CAAC;IAEF;;OAEG;IACH,OAAO,CAAC,EAAE;QACR,gBAAgB;QAChB,KAAK,CAAC,EAAE,QAAQ,CAAC;QACjB,6BAA6B;QAC7B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;KACzE,CAAC;IAEF;;OAEG;IACH,OAAO,CAAC,EAAE;QACR,8CAA8C;QAC9C,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,CAAC;CACH;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,OAAO,CAAC,SAAS,CASjD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAuCzD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAiB9D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orbis1-sdk-rn",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Orbis1 SDK for React Native with RGB core, Watch Tower, and Gas-Free transfers.",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
package/src/Orbis1SDK.ts CHANGED
@@ -9,7 +9,11 @@
9
9
  import { Wallet } from './core/Wallet';
10
10
  import type { IFeatureModule } from './types/IFeatureModule';
11
11
  import type { SDKConfig } from './types/SDKConfig';
12
- import { validateSDKConfig, mergeWithDefaults } from './types/SDKConfig';
12
+ import {
13
+ validateSDKConfig,
14
+ mergeWithDefaults,
15
+ Environment,
16
+ } from './types/SDKConfig';
13
17
  import { Feature } from './types/Feature';
14
18
  import { ConfigurationError } from './errors/ConfigurationError';
15
19
  import { OrbisError, OrbisErrorCode } from './errors/OrbisError';
@@ -17,6 +21,7 @@ import { FeatureRegistry } from './utils/FeatureRegistry';
17
21
  import { Logger, createLogger } from './utils/logger';
18
22
  import { WatchTowerModule } from './features/watch-tower';
19
23
  import { GasFreeModule } from './features/gas-free';
24
+ import { BitcoinNetwork } from './core/Interfaces';
20
25
 
21
26
  /**
22
27
  * Orbis1SDK class
@@ -55,13 +60,21 @@ export class Orbis1SDK {
55
60
 
56
61
  // Initialize wallet from config (if enabled)
57
62
  if (this.config.wallet?.enabled) {
63
+ // Determine network from environment
64
+ const network =
65
+ this.config.environment === Environment.MAINNET
66
+ ? BitcoinNetwork.MAINNET
67
+ : BitcoinNetwork.TESTNET4;
68
+
58
69
  this.wallet = new Wallet(this.config.wallet.keys, {
59
- network: this.config.wallet.network,
70
+ network,
60
71
  supportedSchemas: this.config.wallet.supportedSchemas,
61
72
  maxAllocationsPerUtxo: this.config.wallet.maxAllocationsPerUtxo,
62
73
  vanillaKeychain: this.config.wallet.vanillaKeychain,
63
74
  });
64
- this.logger.info('Wallet initialized from configuration');
75
+ this.logger.info(
76
+ `Wallet initialized for ${this.config.environment} environment`
77
+ );
65
78
  }
66
79
 
67
80
  // Initialize feature registry
@@ -121,8 +134,9 @@ export class Orbis1SDK {
121
134
  }
122
135
 
123
136
  const gasFreeModule = new GasFreeModule({
124
- name: 'gasFree',
137
+ name: Feature.GAS_FREE,
125
138
  enabled: true,
139
+ environment: this.config.environment,
126
140
  apiKey: this.config.apiKey,
127
141
  timeout: features.gasFree.timeout,
128
142
  });
@@ -133,8 +147,9 @@ export class Orbis1SDK {
133
147
  // Initialize Watch Tower feature
134
148
  if (features?.watchTower?.enabled) {
135
149
  const watchTowerModule = new WatchTowerModule({
136
- name: 'watchTower',
150
+ name: Feature.WATCH_TOWER,
137
151
  enabled: true,
152
+ environment: this.config.environment,
138
153
  apiKey: this.config.apiKey,
139
154
  });
140
155
  this.featureRegistry.register(Feature.WATCH_TOWER, watchTowerModule);
@@ -16,7 +16,7 @@ import type { IServiceClient } from './client/IServiceClient';
16
16
  import { ConsignmentReader } from './consignment/ConsignmentReader';
17
17
  import type { IConsignmentReader } from './consignment/IConsignmentReader';
18
18
  import type { GasFreeConfig } from './types/GasFreeConfig';
19
- import { getServiceUrl } from './types/GasFreeConfig';
19
+ import { getGasFreeServiceUrl } from './types/GasFreeConfig';
20
20
 
21
21
  import type {
22
22
  GasFreeTransferRequest,
@@ -86,7 +86,7 @@ export class GasFreeModule implements IFeatureModule<GasFreeConfig> {
86
86
  // Store logger (create child logger with module prefix)
87
87
  this.logger = logger?.child('GasFree');
88
88
 
89
- const serviceUrl = getServiceUrl();
89
+ const serviceUrl = getGasFreeServiceUrl(this.config.environment);
90
90
 
91
91
  this.logger?.debug('Initializing with config', {
92
92
  baseUrl: serviceUrl,
@@ -8,13 +8,15 @@
8
8
 
9
9
  import { z } from 'zod';
10
10
  import type { IFeatureConfig } from '../../../types/IFeatureModule';
11
+ import { Feature } from '../../../types/Feature';
12
+ import { Environment } from '../../../types/SDKConfig';
11
13
 
12
14
  /**
13
15
  * Gas-Free feature configuration
14
16
  */
15
17
  export interface GasFreeConfig extends IFeatureConfig {
16
18
  /** Feature name (must be 'gasFree') */
17
- name: 'gasFree';
19
+ name: Feature.GAS_FREE;
18
20
 
19
21
  /** Whether the feature is enabled */
20
22
  enabled: boolean;
@@ -48,7 +50,7 @@ export interface GasFreeConfig extends IFeatureConfig {
48
50
  * Zod schema for Gas-Free configuration validation
49
51
  */
50
52
  export const GasFreeConfigSchema = z.object({
51
- name: z.literal('gasFree', {
53
+ name: z.literal(Feature.GAS_FREE, {
52
54
  errorMap: () => ({ message: 'Gas-Free config must have name "gasFree"' }),
53
55
  }),
54
56
  enabled: z.boolean(),
@@ -78,11 +80,6 @@ export const GasFreeConfigSchema = z.object({
78
80
  headers: z.record(z.string()).optional(),
79
81
  });
80
82
 
81
- /**
82
- * Default Gas-Free configuration (internal use)
83
- */
84
- const DEFAULT_SERVICE_URL = 'http://localhost:3000';
85
-
86
83
  /**
87
84
  * Default Gas-Free configuration
88
85
  */
@@ -96,10 +93,15 @@ export const DEFAULT_GAS_FREE_CONFIG: Partial<GasFreeConfig> = {
96
93
  };
97
94
 
98
95
  /**
99
- * Get the hardcoded service URL
96
+ * Get the hardcoded service URL as a function of environment
97
+ *
98
+ * @param environment - SDK environment (mainnet or testnet)
99
+ * @returns Service URL for the specified environment
100
100
  */
101
- export function getServiceUrl(): string {
102
- return DEFAULT_SERVICE_URL;
101
+ export function getGasFreeServiceUrl(environment: Environment): string {
102
+ return environment === Environment.MAINNET
103
+ ? 'https://gasfree.orbis1.io'
104
+ : 'https://gasfree-dev.orbis1.io';
103
105
  }
104
106
 
105
107
  /**
@@ -13,7 +13,7 @@ import type { IFeatureModule } from '../../types/IFeatureModule';
13
13
  import type { Wallet } from '../../core/Wallet';
14
14
  import type { Logger } from '../../utils/logger';
15
15
  import type { WatchTowerConfig } from './types';
16
- import { WATCHTOWER_URL } from './types';
16
+ import { getWatchTowerServiceUrl } from './types/WatchTowerConfig';
17
17
 
18
18
  export class WatchTowerModule implements IFeatureModule<WatchTowerConfig> {
19
19
  readonly name = 'watchTower' as const;
@@ -39,7 +39,7 @@ export class WatchTowerModule implements IFeatureModule<WatchTowerConfig> {
39
39
  }
40
40
 
41
41
  this.client = axios.create({
42
- baseURL: WATCHTOWER_URL,
42
+ baseURL: getWatchTowerServiceUrl(this.config.environment),
43
43
  headers: {
44
44
  'Content-Type': 'application/json',
45
45
  'Authorization': `Bearer ${this.config.apiKey}`,
@@ -6,4 +6,3 @@
6
6
 
7
7
  export { WatchTowerModule } from './WatchTowerModule';
8
8
  export type { WatchTowerConfig } from './types';
9
- export { WATCHTOWER_URL } from './types';
@@ -4,12 +4,24 @@
4
4
  * @module features/watch-tower/types/WatchTowerConfig
5
5
  */
6
6
 
7
+ import type { Feature } from '../../../types/Feature';
7
8
  import type { IFeatureConfig } from '../../../types/IFeatureModule';
9
+ import { Environment } from '../../../types/SDKConfig';
8
10
 
9
- export const WATCHTOWER_URL = 'https://watchtower.orbis1.io';
11
+ /**
12
+ * Get the hardcoded service URL as a function of environment
13
+ *
14
+ * @param environment - SDK environment (mainnet or testnet)
15
+ * @returns Service URL for the specified environment
16
+ */
17
+ export function getWatchTowerServiceUrl(environment: Environment): string {
18
+ return environment === Environment.MAINNET
19
+ ? 'https://watchtower.orbis1.io'
20
+ : 'https://watchtower-dev.orbis1.io';
21
+ }
10
22
 
11
23
  export interface WatchTowerConfig extends IFeatureConfig {
12
- name: 'watchTower';
24
+ name: Feature.WATCH_TOWER;
13
25
  enabled: boolean;
14
26
  apiKey: string;
15
27
  }
@@ -1,2 +1 @@
1
1
  export type { WatchTowerConfig } from './WatchTowerConfig';
2
- export { WATCHTOWER_URL } from './WatchTowerConfig';
package/src/index.tsx CHANGED
@@ -15,7 +15,7 @@ export { Orbis1SDK } from './Orbis1SDK';
15
15
 
16
16
  // Types
17
17
  export type { SDKConfig } from './types/SDKConfig';
18
- export { LogLevel } from './types/SDKConfig';
18
+ export { LogLevel, Environment } from './types/SDKConfig';
19
19
  export { Feature, isValidFeature } from './types/Feature';
20
20
  export type { IFeatureModule, IFeatureConfig } from './types/IFeatureModule';
21
21
 
@@ -9,6 +9,7 @@
9
9
 
10
10
  import type { Wallet } from '../core/Wallet';
11
11
  import type { Logger } from '../utils/logger';
12
+ import { Environment } from './SDKConfig';
12
13
 
13
14
  /**
14
15
  * Base configuration type that all feature configs must extend
@@ -18,6 +19,8 @@ export interface IFeatureConfig {
18
19
  name: string;
19
20
  /** Whether the feature is enabled */
20
21
  enabled: boolean;
22
+ /** SDK environment (testnet or mainnet) */
23
+ environment: Environment;
21
24
  }
22
25
 
23
26
  /**
@@ -7,8 +7,7 @@
7
7
  */
8
8
 
9
9
  import { z } from 'zod';
10
- import type { IFeatureConfig } from './IFeatureModule';
11
- import type { Keys, BitcoinNetwork, AssetSchema } from '../core/Interfaces';
10
+ import type { Keys, AssetSchema } from '../core/Interfaces';
12
11
 
13
12
  /**
14
13
  * Wallet configuration for the SDK
@@ -18,8 +17,6 @@ export interface WalletConfig {
18
17
  enabled: boolean;
19
18
  /** Wallet keys (mnemonic, xpubs, etc.) */
20
19
  keys: Keys;
21
- /** Bitcoin network */
22
- network?: BitcoinNetwork;
23
20
  /** Supported asset schemas */
24
21
  supportedSchemas?: AssetSchema[];
25
22
  /** Maximum allocations per UTXO */
@@ -46,11 +43,21 @@ export enum LogLevel {
46
43
  VERBOSE = 'verbose',
47
44
  }
48
45
 
46
+ /**
47
+ * SDK Environment
48
+ * Determines which network and service endpoints to use
49
+ */
50
+ export enum Environment {
51
+ /** Testnet4 environment */
52
+ TESTNET = 'testnet',
53
+ /** Mainnet environment (production) */
54
+ MAINNET = 'mainnet',
55
+ }
56
+
49
57
  /**
50
58
  * Zod schema for Gas-Free feature configuration
51
59
  */
52
60
  export const GasFreeFeatureConfigSchema = z.object({
53
- name: z.literal('gasFree').optional(),
54
61
  enabled: z.boolean().optional(),
55
62
  timeout: z.number().int().positive('Timeout must be positive').optional(),
56
63
  });
@@ -59,7 +66,6 @@ export const GasFreeFeatureConfigSchema = z.object({
59
66
  * Zod schema for Watch Tower feature configuration
60
67
  */
61
68
  export const WatchTowerFeatureConfigSchema = z.object({
62
- name: z.literal('watchTower').optional(),
63
69
  enabled: z.boolean().optional(),
64
70
  pollingInterval: z
65
71
  .number()
@@ -88,6 +94,7 @@ export const SDKOptionsSchema = z.object({
88
94
  */
89
95
  export const SDKConfigSchema = z.object({
90
96
  apiKey: z.string().min(1, 'API key is required'),
97
+ environment: z.nativeEnum(Environment).default(Environment.MAINNET),
91
98
  features: z
92
99
  .object({
93
100
  gasFree: GasFreeFeatureConfigSchema.optional(),
@@ -109,9 +116,17 @@ export interface SDKConfig {
109
116
  */
110
117
  apiKey: string;
111
118
 
119
+ /**
120
+ * SDK environment (testnet or mainnet).
121
+ * Determines which network and service endpoints to use.
122
+ * Defaults to mainnet if not specified.
123
+ */
124
+ environment: Environment;
125
+
112
126
  /**
113
127
  * Wallet configuration.
114
128
  * Required for RGB operations and wallet-dependent features (Gas-Free).
129
+ * Network (testnet4 or mainnet) is determined by the environment setting.
115
130
  */
116
131
  wallet?: WalletConfig;
117
132
 
@@ -123,19 +138,23 @@ export interface SDKConfig {
123
138
  */
124
139
  features?: {
125
140
  /** Gas-Free feature configuration */
126
- gasFree?: IFeatureConfig & {
141
+ gasFree?: {
142
+ /** Enable the feature */
143
+ enabled?: boolean;
127
144
  /** Request timeout in milliseconds */
128
145
  timeout?: number;
129
146
  };
130
147
 
131
148
  /** Watch-Tower feature configuration */
132
- watchTower?: IFeatureConfig & {
149
+ watchTower?: {
150
+ /** Enable the feature */
151
+ enabled?: boolean;
133
152
  /** Polling interval in milliseconds */
134
153
  pollingInterval?: number;
135
154
  };
136
155
 
137
156
  /** Custom features */
138
- [key: string]: IFeatureConfig | undefined;
157
+ [key: string]: { enabled?: boolean; [key: string]: unknown } | undefined;
139
158
  };
140
159
 
141
160
  /**
@@ -161,6 +180,7 @@ export interface SDKConfig {
161
180
  * Default SDK configuration
162
181
  */
163
182
  export const DEFAULT_SDK_CONFIG: Partial<SDKConfig> = {
183
+ environment: Environment.MAINNET,
164
184
  features: {},
165
185
  logging: {
166
186
  level: LogLevel.INFO,
@@ -191,6 +211,30 @@ export function validateSDKConfig(config: SDKConfig): void {
191
211
  }
192
212
  throw error;
193
213
  }
214
+
215
+ // Validate API key prefix matches environment
216
+ const apiKey = config.apiKey;
217
+ const environment = config.environment ?? Environment.MAINNET;
218
+
219
+ if (environment === Environment.TESTNET) {
220
+ if (!apiKey.startsWith('pk_test')) {
221
+ throw new Error(
222
+ `API key mismatch: testnet environment requires a testnet API key (prefix: pk_test), but got a key with prefix: ${apiKey.substring(
223
+ 0,
224
+ 7
225
+ )}`
226
+ );
227
+ }
228
+ } else if (environment === Environment.MAINNET) {
229
+ if (!apiKey.startsWith('sk_live')) {
230
+ throw new Error(
231
+ `API key mismatch: mainnet environment requires a production API key (prefix: sk_live), but got a key with prefix: ${apiKey.substring(
232
+ 0,
233
+ 7
234
+ )}`
235
+ );
236
+ }
237
+ }
194
238
  }
195
239
 
196
240
  /**
@@ -202,6 +246,7 @@ export function validateSDKConfig(config: SDKConfig): void {
202
246
  export function mergeWithDefaults(config: SDKConfig): SDKConfig {
203
247
  return {
204
248
  ...config,
249
+ environment: config.environment ?? Environment.MAINNET,
205
250
  features: {
206
251
  ...DEFAULT_SDK_CONFIG.features,
207
252
  ...config.features,
@@ -1,15 +0,0 @@
1
- package com.orbis1sdk
2
-
3
- import com.facebook.react.bridge.ReactApplicationContext
4
-
5
- class Orbis1SdkModule(reactContext: ReactApplicationContext) :
6
- NativeOrbis1SdkSpec(reactContext) {
7
-
8
- override fun multiply(a: Double, b: Double): Double {
9
- return a * b
10
- }
11
-
12
- companion object {
13
- const val NAME = NativeOrbis1SdkSpec.NAME
14
- }
15
- }