@bitgen/sdk 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.
Files changed (131) hide show
  1. package/dist/cjs/client.d.ts +19 -0
  2. package/dist/cjs/client.d.ts.map +1 -0
  3. package/dist/cjs/client.js +25 -0
  4. package/dist/cjs/client.js.map +1 -0
  5. package/dist/cjs/error.d.ts +24 -0
  6. package/dist/cjs/error.d.ts.map +1 -0
  7. package/dist/cjs/error.js +29 -0
  8. package/dist/cjs/error.js.map +1 -0
  9. package/dist/cjs/http.d.ts +21 -0
  10. package/dist/cjs/http.d.ts.map +1 -0
  11. package/dist/cjs/http.js +71 -0
  12. package/dist/cjs/http.js.map +1 -0
  13. package/dist/cjs/index.d.ts +4 -0
  14. package/dist/cjs/index.d.ts.map +1 -0
  15. package/dist/cjs/index.js +9 -0
  16. package/dist/cjs/index.js.map +1 -0
  17. package/dist/cjs/resources/asset.d.ts +11 -0
  18. package/dist/cjs/resources/asset.d.ts.map +1 -0
  19. package/dist/cjs/resources/asset.js +18 -0
  20. package/dist/cjs/resources/asset.js.map +1 -0
  21. package/dist/cjs/resources/bank.d.ts +13 -0
  22. package/dist/cjs/resources/bank.d.ts.map +1 -0
  23. package/dist/cjs/resources/bank.js +23 -0
  24. package/dist/cjs/resources/bank.js.map +1 -0
  25. package/dist/cjs/resources/order.d.ts +17 -0
  26. package/dist/cjs/resources/order.d.ts.map +1 -0
  27. package/dist/cjs/resources/order.js +30 -0
  28. package/dist/cjs/resources/order.js.map +1 -0
  29. package/dist/cjs/resources/stats.d.ts +11 -0
  30. package/dist/cjs/resources/stats.d.ts.map +1 -0
  31. package/dist/cjs/resources/stats.js +18 -0
  32. package/dist/cjs/resources/stats.js.map +1 -0
  33. package/dist/cjs/resources/transaction.d.ts +19 -0
  34. package/dist/cjs/resources/transaction.d.ts.map +1 -0
  35. package/dist/cjs/resources/transaction.js +32 -0
  36. package/dist/cjs/resources/transaction.js.map +1 -0
  37. package/dist/cjs/resources/user.d.ts +22 -0
  38. package/dist/cjs/resources/user.d.ts.map +1 -0
  39. package/dist/cjs/resources/user.js +37 -0
  40. package/dist/cjs/resources/user.js.map +1 -0
  41. package/dist/cjs/resources/wallet.d.ts +11 -0
  42. package/dist/cjs/resources/wallet.d.ts.map +1 -0
  43. package/dist/cjs/resources/wallet.js +19 -0
  44. package/dist/cjs/resources/wallet.js.map +1 -0
  45. package/dist/cjs/types/index.d.ts +215 -0
  46. package/dist/cjs/types/index.d.ts.map +1 -0
  47. package/dist/cjs/types/index.js +4 -0
  48. package/dist/cjs/types/index.js.map +1 -0
  49. package/dist/cjs/utils.d.ts +7 -0
  50. package/dist/cjs/utils.d.ts.map +1 -0
  51. package/dist/cjs/utils.js +13 -0
  52. package/dist/cjs/utils.js.map +1 -0
  53. package/dist/esm/client.d.ts +19 -0
  54. package/dist/esm/client.d.ts.map +1 -0
  55. package/dist/esm/client.js +21 -0
  56. package/dist/esm/client.js.map +1 -0
  57. package/dist/esm/error.d.ts +24 -0
  58. package/dist/esm/error.d.ts.map +1 -0
  59. package/dist/esm/error.js +24 -0
  60. package/dist/esm/error.js.map +1 -0
  61. package/dist/esm/http.d.ts +21 -0
  62. package/dist/esm/http.d.ts.map +1 -0
  63. package/dist/esm/http.js +67 -0
  64. package/dist/esm/http.js.map +1 -0
  65. package/dist/esm/index.d.ts +4 -0
  66. package/dist/esm/index.d.ts.map +1 -0
  67. package/dist/esm/index.js +3 -0
  68. package/dist/esm/index.js.map +1 -0
  69. package/dist/esm/resources/asset.d.ts +11 -0
  70. package/dist/esm/resources/asset.d.ts.map +1 -0
  71. package/dist/esm/resources/asset.js +14 -0
  72. package/dist/esm/resources/asset.js.map +1 -0
  73. package/dist/esm/resources/bank.d.ts +13 -0
  74. package/dist/esm/resources/bank.d.ts.map +1 -0
  75. package/dist/esm/resources/bank.js +19 -0
  76. package/dist/esm/resources/bank.js.map +1 -0
  77. package/dist/esm/resources/order.d.ts +17 -0
  78. package/dist/esm/resources/order.d.ts.map +1 -0
  79. package/dist/esm/resources/order.js +26 -0
  80. package/dist/esm/resources/order.js.map +1 -0
  81. package/dist/esm/resources/stats.d.ts +11 -0
  82. package/dist/esm/resources/stats.d.ts.map +1 -0
  83. package/dist/esm/resources/stats.js +14 -0
  84. package/dist/esm/resources/stats.js.map +1 -0
  85. package/dist/esm/resources/transaction.d.ts +19 -0
  86. package/dist/esm/resources/transaction.d.ts.map +1 -0
  87. package/dist/esm/resources/transaction.js +28 -0
  88. package/dist/esm/resources/transaction.js.map +1 -0
  89. package/dist/esm/resources/user.d.ts +22 -0
  90. package/dist/esm/resources/user.d.ts.map +1 -0
  91. package/dist/esm/resources/user.js +33 -0
  92. package/dist/esm/resources/user.js.map +1 -0
  93. package/dist/esm/resources/wallet.d.ts +11 -0
  94. package/dist/esm/resources/wallet.d.ts.map +1 -0
  95. package/dist/esm/resources/wallet.js +15 -0
  96. package/dist/esm/resources/wallet.js.map +1 -0
  97. package/dist/esm/types/index.d.ts +215 -0
  98. package/dist/esm/types/index.d.ts.map +1 -0
  99. package/dist/esm/types/index.js +3 -0
  100. package/dist/esm/types/index.js.map +1 -0
  101. package/dist/esm/utils.d.ts +7 -0
  102. package/dist/esm/utils.d.ts.map +1 -0
  103. package/dist/esm/utils.js +10 -0
  104. package/dist/esm/utils.js.map +1 -0
  105. package/dist/types/client.d.ts +19 -0
  106. package/dist/types/client.d.ts.map +1 -0
  107. package/dist/types/error.d.ts +24 -0
  108. package/dist/types/error.d.ts.map +1 -0
  109. package/dist/types/http.d.ts +21 -0
  110. package/dist/types/http.d.ts.map +1 -0
  111. package/dist/types/index.d.ts +4 -0
  112. package/dist/types/index.d.ts.map +1 -0
  113. package/dist/types/resources/asset.d.ts +11 -0
  114. package/dist/types/resources/asset.d.ts.map +1 -0
  115. package/dist/types/resources/bank.d.ts +13 -0
  116. package/dist/types/resources/bank.d.ts.map +1 -0
  117. package/dist/types/resources/order.d.ts +17 -0
  118. package/dist/types/resources/order.d.ts.map +1 -0
  119. package/dist/types/resources/stats.d.ts +11 -0
  120. package/dist/types/resources/stats.d.ts.map +1 -0
  121. package/dist/types/resources/transaction.d.ts +19 -0
  122. package/dist/types/resources/transaction.d.ts.map +1 -0
  123. package/dist/types/resources/user.d.ts +22 -0
  124. package/dist/types/resources/user.d.ts.map +1 -0
  125. package/dist/types/resources/wallet.d.ts +11 -0
  126. package/dist/types/resources/wallet.d.ts.map +1 -0
  127. package/dist/types/types/index.d.ts +215 -0
  128. package/dist/types/types/index.d.ts.map +1 -0
  129. package/dist/types/utils.d.ts +7 -0
  130. package/dist/types/utils.d.ts.map +1 -0
  131. package/package.json +45 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/resources/stats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE3D,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,uBAAuB;IACvB,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC;IAI9B,4CAA4C;IAC5C,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC;CAGzB"}
@@ -0,0 +1,14 @@
1
+ export class StatsResource {
2
+ constructor(http) {
3
+ this.http = http;
4
+ }
5
+ /** Check API health */
6
+ health() {
7
+ return this.http.get('/health');
8
+ }
9
+ /** Get service quotas (user slots, etc.) */
10
+ quotas() {
11
+ return this.http.get('/api/v3/stats');
12
+ }
13
+ }
14
+ //# sourceMappingURL=stats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stats.js","sourceRoot":"","sources":["../../../src/resources/stats.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,aAAa;IACxB,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD,uBAAuB;IACvB,MAAM;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAc,SAAS,CAAC,CAAA;IAC9C,CAAC;IAED,4CAA4C;IAC5C,MAAM;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAQ,eAAe,CAAC,CAAA;IAC9C,CAAC;CACF"}
@@ -0,0 +1,19 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import type { CreateTransactionParams, CreatedTransaction, Transaction, TransactionHistoryFilter, TransactionHistoryItem, UserRef } from '../types/index.js';
3
+ export declare class TransactionResource {
4
+ private readonly http;
5
+ constructor(http: HttpClient);
6
+ /**
7
+ * Create a crypto withdrawal transaction.
8
+ *
9
+ * ⚠ This endpoint throws `BitgenRawError` (not `BitgenError`) for
10
+ * HTTP 500 (invalid_asset) and HTTP 400 (missing field) — both return
11
+ * a plain text body, not a JSON error object.
12
+ */
13
+ create(params: CreateTransactionParams): Promise<CreatedTransaction>;
14
+ /** Get a transaction by its ID */
15
+ get(txId: string): Promise<Transaction>;
16
+ /** Get transaction history for a user */
17
+ history(user: UserRef, filters?: TransactionHistoryFilter): Promise<TransactionHistoryItem[]>;
18
+ }
19
+ //# sourceMappingURL=transaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/resources/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EAClB,WAAW,EACX,wBAAwB,EACxB,sBAAsB,EACtB,OAAO,EACR,MAAM,mBAAmB,CAAA;AAG1B,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAWpE,kCAAkC;IAClC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAIvC,yCAAyC;IACzC,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC;CAM9F"}
@@ -0,0 +1,28 @@
1
+ import { resolveUuid } from '../utils.js';
2
+ export class TransactionResource {
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ /**
7
+ * Create a crypto withdrawal transaction.
8
+ *
9
+ * ⚠ This endpoint throws `BitgenRawError` (not `BitgenError`) for
10
+ * HTTP 500 (invalid_asset) and HTTP 400 (missing field) — both return
11
+ * a plain text body, not a JSON error object.
12
+ */
13
+ create(params) {
14
+ return this.http.post('/api/v3/tx', {
15
+ ...params,
16
+ user: resolveUuid(params.user),
17
+ }, true);
18
+ }
19
+ /** Get a transaction by its ID */
20
+ get(txId) {
21
+ return this.http.get(`/api/v3/tx/${txId}`);
22
+ }
23
+ /** Get transaction history for a user */
24
+ history(user, filters) {
25
+ return this.http.get(`/api/v3/txs/${resolveUuid(user)}`, filters);
26
+ }
27
+ }
28
+ //# sourceMappingURL=transaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/resources/transaction.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,MAAM,OAAO,mBAAmB;IAC9B,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD;;;;;;OAMG;IACH,MAAM,CAAC,MAA+B;QACpC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CACnB,YAAY,EACZ;YACE,GAAG,MAAM;YACT,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;SAC/B,EACD,IAAI,CACL,CAAA;IACH,CAAC;IAED,kCAAkC;IAClC,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAc,cAAc,IAAI,EAAE,CAAC,CAAA;IACzD,CAAC;IAED,yCAAyC;IACzC,OAAO,CAAC,IAAa,EAAE,OAAkC;QACvD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAClB,eAAe,WAAW,CAAC,IAAI,CAAC,EAAE,EAClC,OAAsD,CACvD,CAAA;IACH,CAAC;CACF"}
@@ -0,0 +1,22 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import type { CreateUserParams, UserDetail, UserList, UserListParams, UpdateUserParams, UserRef } from '../types/index.js';
3
+ export declare class UserResource {
4
+ private readonly http;
5
+ constructor(http: HttpClient);
6
+ /** Create a new user — returns their UUID */
7
+ create(params: CreateUserParams): Promise<{
8
+ uuid: string;
9
+ }>;
10
+ /** List all users (paginated) */
11
+ list(params: UserListParams): Promise<UserList>;
12
+ /** Get full user details (profile, wallets, bank) by UUID or User object */
13
+ get(user: UserRef): Promise<UserDetail>;
14
+ /** Update a user's profile — returns nothing on success (204) */
15
+ update(user: UserRef, params: UpdateUserParams): Promise<void>;
16
+ /**
17
+ * Soft-disable a user account.
18
+ * Data is retained — this is not a permanent deletion.
19
+ */
20
+ disable(user: UserRef): Promise<void>;
21
+ }
22
+ //# sourceMappingURL=user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/resources/user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EACV,gBAAgB,EAChB,UAAU,EACV,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,OAAO,EACR,MAAM,mBAAmB,CAAA;AAG1B,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,6CAA6C;IAC7C,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAI3D,iCAAiC;IACjC,IAAI,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IAO/C,4EAA4E;IAC5E,GAAG,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;IAIvC,iEAAiE;IACjE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9D;;;OAGG;IACH,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAGtC"}
@@ -0,0 +1,33 @@
1
+ import { resolveUuid } from '../utils.js';
2
+ export class UserResource {
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ /** Create a new user — returns their UUID */
7
+ create(params) {
8
+ return this.http.post('/api/v3/user', params);
9
+ }
10
+ /** List all users (paginated) */
11
+ list(params) {
12
+ return this.http.get('/api/v3/user', {
13
+ offset: params.offset,
14
+ limit: params.limit,
15
+ });
16
+ }
17
+ /** Get full user details (profile, wallets, bank) by UUID or User object */
18
+ get(user) {
19
+ return this.http.get(`/api/v3/user/${resolveUuid(user)}`);
20
+ }
21
+ /** Update a user's profile — returns nothing on success (204) */
22
+ update(user, params) {
23
+ return this.http.put(`/api/v3/user/${resolveUuid(user)}`, params);
24
+ }
25
+ /**
26
+ * Soft-disable a user account.
27
+ * Data is retained — this is not a permanent deletion.
28
+ */
29
+ disable(user) {
30
+ return this.http.delete(`/api/v3/user/${resolveUuid(user)}`);
31
+ }
32
+ }
33
+ //# sourceMappingURL=user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.js","sourceRoot":"","sources":["../../../src/resources/user.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,MAAM,OAAO,YAAY;IACvB,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD,6CAA6C;IAC7C,MAAM,CAAC,MAAwB;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAmB,cAAc,EAAE,MAAM,CAAC,CAAA;IACjE,CAAC;IAED,iCAAiC;IACjC,IAAI,CAAC,MAAsB;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAW,cAAc,EAAE;YAC7C,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC,CAAA;IACJ,CAAC;IAED,4EAA4E;IAC5E,GAAG,CAAC,IAAa;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAa,gBAAgB,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACvE,CAAC;IAED,iEAAiE;IACjE,MAAM,CAAC,IAAa,EAAE,MAAwB;QAC5C,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAO,gBAAgB,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;IACzE,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,IAAa;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAO,gBAAgB,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACpE,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import type { Wallet, UserRef } from '../types/index.js';
3
+ export declare class WalletResource {
4
+ private readonly http;
5
+ constructor(http: HttpClient);
6
+ /** Get all wallets for a user */
7
+ list(user: UserRef): Promise<Wallet[]>;
8
+ /** Get a specific wallet by user and asset ISO code */
9
+ get(user: UserRef, asset: string): Promise<Wallet>;
10
+ }
11
+ //# sourceMappingURL=wallet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../../src/resources/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAGxD,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,iCAAiC;IACjC,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAItC,uDAAuD;IACvD,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAGnD"}
@@ -0,0 +1,15 @@
1
+ import { resolveUuid } from '../utils.js';
2
+ export class WalletResource {
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ /** Get all wallets for a user */
7
+ list(user) {
8
+ return this.http.get(`/api/v3/wallet/${resolveUuid(user)}`);
9
+ }
10
+ /** Get a specific wallet by user and asset ISO code */
11
+ get(user, asset) {
12
+ return this.http.get(`/api/v3/wallet/${resolveUuid(user)}/${asset}`);
13
+ }
14
+ }
15
+ //# sourceMappingURL=wallet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../../src/resources/wallet.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,MAAM,OAAO,cAAc;IACzB,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD,iCAAiC;IACjC,IAAI,CAAC,IAAa;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAW,kBAAkB,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACvE,CAAC;IAED,uDAAuD;IACvD,GAAG,CAAC,IAAa,EAAE,KAAa;QAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAS,kBAAkB,WAAW,CAAC,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC,CAAA;IAC9E,CAAC;CACF"}
@@ -0,0 +1,215 @@
1
+ export type BitgenEnv = 'sandbox' | 'production' | 'localhost';
2
+ export interface BitgenConfig {
3
+ /** BITGEN-Scope header (UUID) */
4
+ scope: string;
5
+ /** Api-key header */
6
+ apiKey: string;
7
+ /** Target environment — defaults to 'production' */
8
+ env?: BitgenEnv;
9
+ /** Port used when env is 'localhost' — defaults to 3000 */
10
+ port?: number;
11
+ }
12
+ /** Accept either a raw UUID string or a User object */
13
+ export type UserRef = string | User;
14
+ export interface Asset {
15
+ name: string;
16
+ iso: string;
17
+ rank: number;
18
+ price: number;
19
+ marketcap: number;
20
+ percentChange24h: number;
21
+ }
22
+ export interface BankAccount {
23
+ amount: number;
24
+ ref: string;
25
+ }
26
+ export interface BankWithdrawResult {
27
+ txId: string;
28
+ amount: {
29
+ requestedAmount: number;
30
+ finalWithdrawnAmount: number;
31
+ feesAmount: number;
32
+ };
33
+ }
34
+ export type BankOperationDirection = 'ALL' | 'PURCHASE' | 'WITHDRAWAL' | 'DEPOSIT';
35
+ export interface BankOperationsFilter {
36
+ direction?: BankOperationDirection;
37
+ /** Unix timestamp */
38
+ from?: number;
39
+ /** Unix timestamp */
40
+ to?: number;
41
+ }
42
+ export interface BankOperation {
43
+ txId: string;
44
+ amount: number;
45
+ direction: string;
46
+ date: number;
47
+ }
48
+ export type OrderMode = 'BUY' | 'SELL';
49
+ export type OrderStateBuy = 'REGISTERED' | 'ORDERED' | 'PAID';
50
+ export type OrderStateSell = 'REGISTERED' | 'PROCESSING' | 'WAIT_FOR_SELL' | 'ORDERED' | 'COMPLETED' | 'FINISHED';
51
+ export type OrderState = OrderStateBuy | OrderStateSell;
52
+ export interface CreateOrderParams {
53
+ user: UserRef;
54
+ asset: string;
55
+ amount: number;
56
+ mode: OrderMode;
57
+ }
58
+ export interface CreatedOrder {
59
+ tunnel: string;
60
+ state: OrderState;
61
+ }
62
+ export interface OrderData {
63
+ label: string;
64
+ asset: string;
65
+ mode: OrderMode;
66
+ deliveredAmount: number;
67
+ deliveredPrice: number;
68
+ }
69
+ export interface Order {
70
+ createdAt: number;
71
+ state: OrderState;
72
+ owner: string;
73
+ data: OrderData;
74
+ amount: string | number;
75
+ currency: string;
76
+ deliveredAt: number;
77
+ error: string | null;
78
+ /** Present in history list only */
79
+ tunnel?: string;
80
+ }
81
+ export type TransactionState = 'INITIALIZED' | 'SUBMITTED' | 'VALIDATED' | 'CONFIRMED';
82
+ export interface CreateTransactionParams {
83
+ user: UserRef;
84
+ asset: string;
85
+ amount: number;
86
+ targetAddress: string;
87
+ /** Required for some assets e.g. XRP */
88
+ targetTag?: string;
89
+ }
90
+ export interface CreatedTransaction {
91
+ txId: string;
92
+ state: TransactionState;
93
+ }
94
+ export interface Transaction {
95
+ createdAt: number;
96
+ state: TransactionState;
97
+ amount: number;
98
+ owner: string;
99
+ error: string | null;
100
+ targetAddress: string;
101
+ targetTag: string | null;
102
+ asset: string;
103
+ }
104
+ export type TransactionDirection = 'ALL' | 'TRANSACTION_SENT' | 'TRANSACTION_RECEIVED';
105
+ export interface TransactionHistoryFilter {
106
+ /** Filter by asset ISO code — omit for all assets */
107
+ asset?: string;
108
+ direction?: TransactionDirection;
109
+ /** Unix timestamp */
110
+ from?: number;
111
+ /** Unix timestamp */
112
+ to?: number;
113
+ }
114
+ export interface TransactionHistoryItem {
115
+ asset: string;
116
+ direction: TransactionDirection;
117
+ amount: number;
118
+ date: number;
119
+ usdTokenPrice: number;
120
+ }
121
+ export type IdentityState = 'CREATED' | 'PENDING' | 'APPROVED' | 'REJECTED';
122
+ export type UserState = 'ENABLED' | 'DISABLED';
123
+ export interface CreateUserParams {
124
+ email: string;
125
+ iban: string;
126
+ firstname: string;
127
+ lastname: string;
128
+ }
129
+ export interface UserAddress {
130
+ street: string;
131
+ postalCode: string;
132
+ city: string;
133
+ country: string;
134
+ }
135
+ export interface UserAccount {
136
+ createdAt: number;
137
+ email: string;
138
+ firstname: string;
139
+ lastname: string;
140
+ birthdate?: number;
141
+ address?: UserAddress;
142
+ }
143
+ export interface UserIdentity {
144
+ state: IdentityState;
145
+ isVerified: boolean;
146
+ verificationUrl?: string;
147
+ }
148
+ export interface User {
149
+ uuid: string;
150
+ state?: UserState;
151
+ account: UserAccount;
152
+ identity: UserIdentity;
153
+ }
154
+ export interface WalletAssetRef {
155
+ iso: string;
156
+ mode: string;
157
+ }
158
+ export interface ActiveWallet {
159
+ asset: WalletAssetRef;
160
+ address: string;
161
+ tag: string | null;
162
+ balance: number;
163
+ }
164
+ export interface UserDetail {
165
+ user: User;
166
+ active_wallets: ActiveWallet[];
167
+ bank: BankAccount;
168
+ }
169
+ export interface UserListMeta {
170
+ offset: number;
171
+ limit: number;
172
+ total: number;
173
+ }
174
+ export interface UserListParams {
175
+ offset: number;
176
+ limit: number;
177
+ }
178
+ export interface UserList {
179
+ meta: UserListMeta;
180
+ items: User[];
181
+ }
182
+ export interface UpdateUserParams {
183
+ email?: string;
184
+ }
185
+ export interface WalletAsset {
186
+ iso: string;
187
+ mode: string;
188
+ baseUnit: number;
189
+ }
190
+ export interface Wallet {
191
+ asset: WalletAsset;
192
+ address: string;
193
+ tag: string | null;
194
+ balance: number;
195
+ }
196
+ export interface HealthCheck {
197
+ name: string;
198
+ version: string;
199
+ }
200
+ export interface UserQuota {
201
+ total: number;
202
+ remain: number;
203
+ registered: number;
204
+ reset: string;
205
+ }
206
+ export interface Stats {
207
+ users: UserQuota;
208
+ }
209
+ export interface BitgenErrorBody {
210
+ module: string;
211
+ service: string;
212
+ code: number;
213
+ message: string;
214
+ }
215
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,YAAY,GAAG,WAAW,CAAA;AAE9D,MAAM,WAAW,YAAY;IAC3B,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,qBAAqB;IACrB,MAAM,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;AAID,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,WAAW,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;CAChB;AAID,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,SAAS,CAAA;CACjB;AAID,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB"}
@@ -0,0 +1,3 @@
1
+ // ─── Client config ────────────────────────────────────────────────────────────
2
+ export {};
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,iFAAiF"}
@@ -0,0 +1,7 @@
1
+ import type { UserRef } from './types/index.js';
2
+ /**
3
+ * Resolve a UserRef (UUID string or User object) to a UUID string.
4
+ * Used by all resource methods that accept a user parameter.
5
+ */
6
+ export declare function resolveUuid(ref: UserRef): string;
7
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAQ,MAAM,kBAAkB,CAAA;AAErD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAGhD"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Resolve a UserRef (UUID string or User object) to a UUID string.
3
+ * Used by all resource methods that accept a user parameter.
4
+ */
5
+ export function resolveUuid(ref) {
6
+ if (typeof ref === 'string')
7
+ return ref;
8
+ return ref.uuid;
9
+ }
10
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,GAAY;IACtC,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,GAAG,CAAA;IACvC,OAAQ,GAAY,CAAC,IAAI,CAAA;AAC3B,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { AssetResource } from './resources/asset.js';
2
+ import { BankResource } from './resources/bank.js';
3
+ import { OrderResource } from './resources/order.js';
4
+ import { TransactionResource } from './resources/transaction.js';
5
+ import { UserResource } from './resources/user.js';
6
+ import { WalletResource } from './resources/wallet.js';
7
+ import { StatsResource } from './resources/stats.js';
8
+ import type { BitgenConfig } from './types/index.js';
9
+ export declare class BitgenClient {
10
+ readonly asset: AssetResource;
11
+ readonly bank: BankResource;
12
+ readonly order: OrderResource;
13
+ readonly transaction: TransactionResource;
14
+ readonly user: UserResource;
15
+ readonly wallet: WalletResource;
16
+ readonly stats: StatsResource;
17
+ constructor(config: BitgenConfig);
18
+ }
19
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAEpD,qBAAa,YAAY;IACvB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAA;IAC7B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;IAC3B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAA;IAC7B,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAA;IACzC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;IAC3B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAA;IAC/B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAA;gBAEjB,MAAM,EAAE,YAAY;CAWjC"}
@@ -0,0 +1,24 @@
1
+ import type { BitgenErrorBody } from './types/index.js';
2
+ export declare class BitgenError extends Error {
3
+ /** HTTP status code */
4
+ readonly status: number;
5
+ /** BITGEN error code (from body) */
6
+ readonly code: number;
7
+ /** BITGEN service name (e.g. "order", "transaction") */
8
+ readonly service: string;
9
+ /** BITGEN module name (e.g. "create", "read") */
10
+ readonly module: string;
11
+ /** Raw error message from API */
12
+ readonly apiMessage: string;
13
+ constructor(status: number, body: BitgenErrorBody);
14
+ }
15
+ /**
16
+ * Special error for the POST /api/v3/tx endpoint which returns
17
+ * raw HTTP 500 / 400 with a plain text body (not JSON-wrapped).
18
+ */
19
+ export declare class BitgenRawError extends Error {
20
+ readonly status: number;
21
+ readonly rawBody: string;
22
+ constructor(status: number, rawBody: string);
23
+ }
24
+ //# sourceMappingURL=error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAEvD,qBAAa,WAAY,SAAQ,KAAK;IACpC,uBAAuB;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,oCAAoC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,wDAAwD;IACxD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,iCAAiC;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;gBAEf,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe;CASlD;AAED;;;GAGG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;gBAEZ,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAM5C"}
@@ -0,0 +1,21 @@
1
+ import type { BitgenConfig } from './types/index.js';
2
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
3
+ interface RequestOptions {
4
+ method?: HttpMethod;
5
+ body?: unknown;
6
+ query?: Record<string, string | number | boolean | undefined>;
7
+ /** Set to true for endpoints that return raw non-JSON errors (POST /tx) */
8
+ rawErrors?: boolean;
9
+ }
10
+ export declare class HttpClient {
11
+ private readonly baseUrl;
12
+ private readonly headers;
13
+ constructor(config: BitgenConfig);
14
+ request<T>(path: string, options?: RequestOptions): Promise<T>;
15
+ get<T>(path: string, query?: RequestOptions['query']): Promise<T>;
16
+ post<T>(path: string, body: unknown, rawErrors?: boolean): Promise<T>;
17
+ put<T>(path: string, body: unknown): Promise<T>;
18
+ delete<T>(path: string): Promise<T>;
19
+ }
20
+ export {};
21
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAQpD,KAAK,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAA;AAEnD,UAAU,cAAc;IACtB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;IAC7D,2EAA2E;IAC3E,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAQ;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;gBAEpC,MAAM,EAAE,YAAY;IAc1B,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,CAAC,CAAC;IAwCxE,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAIjE,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,UAAQ,GAAG,OAAO,CAAC,CAAC,CAAC;IAInE,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAI/C,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;CAGpC"}
@@ -0,0 +1,4 @@
1
+ export { BitgenClient } from './client.js';
2
+ export { BitgenError, BitgenRawError } from './error.js';
3
+ export type { BitgenConfig, BitgenEnv, UserRef, Asset, BankAccount, BankWithdrawResult, BankOperation, BankOperationDirection, BankOperationsFilter, OrderMode, OrderState, OrderStateBuy, OrderStateSell, CreateOrderParams, CreatedOrder, Order, OrderData, TransactionState, CreateTransactionParams, CreatedTransaction, Transaction, TransactionDirection, TransactionHistoryFilter, TransactionHistoryItem, IdentityState, UserState, CreateUserParams, UpdateUserParams, UserListParams, UserList, UserListMeta, User, UserDetail, UserAccount, UserAddress, UserIdentity, ActiveWallet, Wallet, WalletAsset, HealthCheck, Stats, UserQuota, } from './types/index.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AACxD,YAAY,EAEV,YAAY,EACZ,SAAS,EACT,OAAO,EAEP,KAAK,EAEL,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,sBAAsB,EACtB,oBAAoB,EAEpB,SAAS,EACT,UAAU,EACV,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,KAAK,EACL,SAAS,EAET,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,WAAW,EACX,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,EAEtB,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,IAAI,EACJ,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,YAAY,EAEZ,MAAM,EACN,WAAW,EAEX,WAAW,EACX,KAAK,EACL,SAAS,GACV,MAAM,kBAAkB,CAAA"}
@@ -0,0 +1,11 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import type { Asset } from '../types/index.js';
3
+ export declare class AssetResource {
4
+ private readonly http;
5
+ constructor(http: HttpClient);
6
+ /** Get a single asset by ISO code (e.g. 'BTC', 'ETH') */
7
+ get(iso: string): Promise<Asset>;
8
+ /** List all available assets */
9
+ list(): Promise<Asset[]>;
10
+ }
11
+ //# sourceMappingURL=asset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset.d.ts","sourceRoot":"","sources":["../../../src/resources/asset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE9C,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,yDAAyD;IACzD,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAIhC,gCAAgC;IAChC,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;CAGzB"}
@@ -0,0 +1,13 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import type { BankAccount, BankWithdrawResult, BankOperation, BankOperationsFilter, UserRef } from '../types/index.js';
3
+ export declare class BankResource {
4
+ private readonly http;
5
+ constructor(http: HttpClient);
6
+ /** Get a user's EUR bank account balance and reference */
7
+ get(user: UserRef): Promise<BankAccount>;
8
+ /** Withdraw EUR from a user's bank account */
9
+ withdraw(user: UserRef, amount: number): Promise<BankWithdrawResult>;
10
+ /** Get bank operation history for a user */
11
+ operations(user: UserRef, filters?: BankOperationsFilter): Promise<BankOperation[]>;
12
+ }
13
+ //# sourceMappingURL=bank.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bank.d.ts","sourceRoot":"","sources":["../../../src/resources/bank.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EACV,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACpB,OAAO,EACR,MAAM,mBAAmB,CAAA;AAG1B,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,0DAA0D;IAC1D,GAAG,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC;IAIxC,8CAA8C;IAC9C,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAIpE,4CAA4C;IAC5C,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;CAMpF"}
@@ -0,0 +1,17 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import type { CreateOrderParams, CreatedOrder, Order, UserRef } from '../types/index.js';
3
+ export declare class OrderResource {
4
+ private readonly http;
5
+ constructor(http: HttpClient);
6
+ /**
7
+ * Create a buy or sell order.
8
+ * - BUY: amount is in EUR → delivers the target asset
9
+ * - SELL: amount is in asset units → delivers EUR
10
+ */
11
+ create(params: CreateOrderParams): Promise<CreatedOrder>;
12
+ /** Get the current status of an order by its tunnel ID */
13
+ get(tunnel: string): Promise<Order>;
14
+ /** Get full order history for a user */
15
+ history(user: UserRef): Promise<Order[]>;
16
+ }
17
+ //# sourceMappingURL=order.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../../src/resources/order.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,KAAK,EACL,OAAO,EACR,MAAM,mBAAmB,CAAA;AAG1B,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;IAOxD,0DAA0D;IAC1D,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAInC,wCAAwC;IACxC,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;CAGzC"}
@@ -0,0 +1,11 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import type { HealthCheck, Stats } from '../types/index.js';
3
+ export declare class StatsResource {
4
+ private readonly http;
5
+ constructor(http: HttpClient);
6
+ /** Check API health */
7
+ health(): Promise<HealthCheck>;
8
+ /** Get service quotas (user slots, etc.) */
9
+ quotas(): Promise<Stats>;
10
+ }
11
+ //# sourceMappingURL=stats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/resources/stats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE3D,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,uBAAuB;IACvB,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC;IAI9B,4CAA4C;IAC5C,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC;CAGzB"}
@@ -0,0 +1,19 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import type { CreateTransactionParams, CreatedTransaction, Transaction, TransactionHistoryFilter, TransactionHistoryItem, UserRef } from '../types/index.js';
3
+ export declare class TransactionResource {
4
+ private readonly http;
5
+ constructor(http: HttpClient);
6
+ /**
7
+ * Create a crypto withdrawal transaction.
8
+ *
9
+ * ⚠ This endpoint throws `BitgenRawError` (not `BitgenError`) for
10
+ * HTTP 500 (invalid_asset) and HTTP 400 (missing field) — both return
11
+ * a plain text body, not a JSON error object.
12
+ */
13
+ create(params: CreateTransactionParams): Promise<CreatedTransaction>;
14
+ /** Get a transaction by its ID */
15
+ get(txId: string): Promise<Transaction>;
16
+ /** Get transaction history for a user */
17
+ history(user: UserRef, filters?: TransactionHistoryFilter): Promise<TransactionHistoryItem[]>;
18
+ }
19
+ //# sourceMappingURL=transaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/resources/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EAClB,WAAW,EACX,wBAAwB,EACxB,sBAAsB,EACtB,OAAO,EACR,MAAM,mBAAmB,CAAA;AAG1B,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAWpE,kCAAkC;IAClC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAIvC,yCAAyC;IACzC,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC;CAM9F"}