@fystack/sdk 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -16,7 +16,7 @@ const getBaseURL = (env)=>{
16
16
  case "local":
17
17
  return 'http://localhost:8150';
18
18
  case "sandbox":
19
- return 'https://apex.void.exchange';
19
+ return 'https://api-dev.fystack.io';
20
20
  case "production":
21
21
  return 'https://api.fystack.io';
22
22
  }
@@ -40,7 +40,8 @@ const createAPI = (env)=>{
40
40
  getTransactionStatus: (walletId, transactionId)=>withBaseURL(`/web3/transaction/${walletId}/${transactionId}`),
41
41
  getWalletCreationStatus: (walletId)=>withBaseURL(`/wallets/creation-status/${walletId}`),
42
42
  getWalletAssets: (walletId)=>withBaseURL(`/wallets/${walletId}/assets`),
43
- getDepositAddress: (walletId, addressType)=>withBaseURL(`/wallets/${walletId}/deposit-address?address_type=${addressType}`)
43
+ getDepositAddress: (walletId, addressType)=>withBaseURL(`/wallets/${walletId}/deposit-address?address_type=${addressType}`),
44
+ rescanTransaction: ()=>withBaseURL('/networks/rescan-transaction')
44
45
  }
45
46
  };
46
47
  };
@@ -118,14 +119,63 @@ async function computeHMACForWebhook(apiSecret, event) {
118
119
  }
119
120
  }
120
121
 
121
- var WalletAddressType;
122
- (function(WalletAddressType) {
123
- WalletAddressType["Evm"] = "evm";
124
- WalletAddressType["Sol"] = "sol";
125
- })(WalletAddressType || (WalletAddressType = {}));
122
+ // Wallets
123
+ var WalletType;
124
+ (function(WalletType) {
125
+ WalletType["Standard"] = "standard";
126
+ WalletType["MPC"] = "mpc";
127
+ })(WalletType || (WalletType = {}));
128
+ var WalletPurpose;
129
+ (function(WalletPurpose) {
130
+ WalletPurpose["General"] = "general";
131
+ WalletPurpose["Gastank"] = "gas_tank";
132
+ WalletPurpose["Deployment"] = "deployment";
133
+ WalletPurpose["Custody"] = "custody";
134
+ WalletPurpose["User"] = "user";
135
+ WalletPurpose["Payment"] = "payment";
136
+ })(WalletPurpose || (WalletPurpose = {}));
137
+ var WalletCreationStatus;
138
+ (function(WalletCreationStatus) {
139
+ WalletCreationStatus["Pending"] = "pending";
140
+ WalletCreationStatus["Success"] = "success";
141
+ WalletCreationStatus["Error"] = "error";
142
+ })(WalletCreationStatus || (WalletCreationStatus = {}));
143
+ var AddressType;
144
+ (function(AddressType) {
145
+ AddressType["Evm"] = "evm";
146
+ AddressType["Solana"] = "sol";
147
+ AddressType["Tron"] = "tron";
148
+ })(AddressType || (AddressType = {}));
149
+ var DestinationType;
150
+ (function(DestinationType) {
151
+ DestinationType["InternalWallet"] = "internal_wallet";
152
+ DestinationType["AddressBook"] = "address_book";
153
+ })(DestinationType || (DestinationType = {}));
154
+ var TxStatus;
155
+ (function(TxStatus) {
156
+ TxStatus["Pending"] = "pending";
157
+ TxStatus["Completed"] = "completed";
158
+ TxStatus["Confirmed"] = "confirmed";
159
+ TxStatus["Failed"] = "failed";
160
+ TxStatus["PendingApproval"] = "pending_approval";
161
+ TxStatus["Rejected"] = "rejected";
162
+ })(TxStatus || (TxStatus = {}));
163
+ var TxApprovalStatus;
164
+ (function(TxApprovalStatus) {
165
+ TxApprovalStatus["Pending"] = "pending";
166
+ TxApprovalStatus["Approved"] = "approved";
167
+ TxApprovalStatus["Rejected"] = "rejected";
168
+ })(TxApprovalStatus || (TxApprovalStatus = {}));
169
+
126
170
  async function composeAPIHeaders(credentials, httpMethod, apiEndpoint, body = {}) {
127
171
  if (credentials.apiSecret == '') {
128
- // If APISecret is not provided, fallback to cookie mode with no headers
172
+ // If APISecret is not provided, use authToken
173
+ if (credentials.authToken) {
174
+ return {
175
+ Authorization: credentials.authToken
176
+ };
177
+ }
178
+ // fallback to cookie mode with no headers
129
179
  return {};
130
180
  }
131
181
  const currentTimestampInSeconds = Math.floor(Date.now() / 1000);
@@ -147,7 +197,7 @@ async function composeAPIHeaders(credentials, httpMethod, apiEndpoint, body = {}
147
197
  return headers;
148
198
  }
149
199
  class APIService {
150
- async getWalletDetail(addressType = "evm", walletId) {
200
+ async getWalletDetail(addressType = AddressType.Evm, walletId) {
151
201
  const endpoint = this.API.endpoints.getWalletDetail(walletId);
152
202
  const headers = await composeAPIHeaders(this.credentials, 'GET', endpoint);
153
203
  console.info('headers', headers);
@@ -218,6 +268,16 @@ class APIService {
218
268
  const response = await get(endpoint, headers);
219
269
  return response.data;
220
270
  }
271
+ /**
272
+ * Rescans a transaction on a specific network
273
+ * @param params Transaction hash and network ID
274
+ * @returns API response
275
+ */ async rescanTransaction(params) {
276
+ const endpoint = this.API.endpoints.rescanTransaction();
277
+ const transformedParams = transformRescanTransactionParams(params);
278
+ const headers = await composeAPIHeaders(this.credentials, 'POST', endpoint, transformedParams);
279
+ await post(endpoint, transformedParams, headers);
280
+ }
221
281
  constructor(credentials, environment){
222
282
  this.credentials = credentials;
223
283
  this.Webhook = new WebhookService(credentials);
@@ -319,7 +379,26 @@ function transformWalletDetail(data) {
319
379
  function transformCreateWalletPayload(data) {
320
380
  return {
321
381
  name: data.name,
322
- wallet_type: data.walletType
382
+ wallet_type: data.walletType,
383
+ ...data.walletPurpose !== undefined && {
384
+ wallet_purpose: data.walletPurpose
385
+ },
386
+ ...data.sweepTaskParams !== undefined && {
387
+ sweep_task_params: {
388
+ min_trigger_value_usd: data.sweepTaskParams?.minTriggerValueUsd,
389
+ destination_wallet_id: data.sweepTaskParams?.destinationWalletId,
390
+ destination_type: data.sweepTaskParams?.destinationType
391
+ }
392
+ },
393
+ ...data.sweepTaskId !== undefined && {
394
+ sweep_task_id: data.sweepTaskId
395
+ }
396
+ };
397
+ }
398
+ function transformRescanTransactionParams(data) {
399
+ return {
400
+ tx_hash: data.txHash,
401
+ network_id: data.networkId
323
402
  };
324
403
  }
325
404
  BigInt.prototype.toJSON = function() {
@@ -380,47 +459,6 @@ class StatusPoller {
380
459
  }
381
460
  }
382
461
 
383
- class TransactionError extends Error {
384
- constructor(message, code, transactionId, originalError){
385
- super(message);
386
- this.code = code;
387
- this.transactionId = transactionId;
388
- this.originalError = originalError;
389
- this.name = 'TransactionError';
390
- }
391
- }
392
- var TxStatus;
393
- (function(TxStatus) {
394
- TxStatus["Pending"] = "pending";
395
- TxStatus["Completed"] = "completed";
396
- TxStatus["Confirmed"] = "confirmed";
397
- TxStatus["Failed"] = "failed";
398
- TxStatus["PendingApproval"] = "pending_approval";
399
- TxStatus["Rejected"] = "rejected";
400
- })(TxStatus || (TxStatus = {}));
401
- var TxApprovalStatus;
402
- (function(TxApprovalStatus) {
403
- TxApprovalStatus["Pending"] = "pending";
404
- TxApprovalStatus["Approved"] = "approved";
405
- TxApprovalStatus["Rejected"] = "rejected";
406
- })(TxApprovalStatus || (TxApprovalStatus = {}));
407
- var WalletType;
408
- (function(WalletType) {
409
- WalletType["Standard"] = "standard";
410
- WalletType["MPC"] = "mpc";
411
- })(WalletType || (WalletType = {}));
412
- var WalletCreationStatus;
413
- (function(WalletCreationStatus) {
414
- WalletCreationStatus["Pending"] = "pending";
415
- WalletCreationStatus["Success"] = "success";
416
- WalletCreationStatus["Error"] = "error";
417
- })(WalletCreationStatus || (WalletCreationStatus = {}));
418
- var AddressType;
419
- (function(AddressType) {
420
- AddressType["Evm"] = "evm";
421
- AddressType["Solana"] = "sol";
422
- })(AddressType || (AddressType = {}));
423
-
424
462
  class FystackSDK {
425
463
  log(message) {
426
464
  if (this.enableLogging) {
@@ -433,10 +471,13 @@ class FystackSDK {
433
471
  * @param waitForCompletion Whether to wait for the wallet creation to complete
434
472
  * @returns Promise with wallet ID and status
435
473
  */ async createWallet(options, waitForCompletion = true) {
436
- const { name, walletType = WalletType.Standard } = options;
474
+ const { name, walletType = WalletType.Standard, sweepTaskParams, walletPurpose, sweepTaskId } = options;
437
475
  const response = await this.apiService.createWallet({
438
476
  name,
439
- walletType
477
+ walletType,
478
+ walletPurpose,
479
+ sweepTaskParams,
480
+ sweepTaskId
440
481
  });
441
482
  if (waitForCompletion && response.status === WalletCreationStatus.Pending) {
442
483
  return this.waitForWalletCreation(response.wallet_id);
@@ -499,6 +540,17 @@ class FystackSDK {
499
540
  const depositAddressInfo = await this.apiService.getDepositAddress(walletId, addressType);
500
541
  return depositAddressInfo;
501
542
  }
543
+ /**
544
+ * Rescans a transaction on a specific network
545
+ * @param params Transaction hash and network ID
546
+ * @returns Promise that resolves when the rescan is initiated
547
+ */ async rescanTransaction(params) {
548
+ validateUUID(params.networkId, 'networkId');
549
+ if (!params.txHash || params.txHash.trim() === '') {
550
+ throw new Error('Invalid transaction hash provided');
551
+ }
552
+ await this.apiService.rescanTransaction(params);
553
+ }
502
554
  constructor(options){
503
555
  const { credentials, environment = Environment.Production, logger = false } = options;
504
556
  this.apiService = new APIService(credentials, environment);
@@ -506,6 +558,16 @@ class FystackSDK {
506
558
  }
507
559
  }
508
560
 
561
+ class TransactionError extends Error {
562
+ constructor(message, code, transactionId, originalError){
563
+ super(message);
564
+ this.code = code;
565
+ this.transactionId = transactionId;
566
+ this.originalError = originalError;
567
+ this.name = 'TransactionError';
568
+ }
569
+ }
570
+
509
571
  class EtherSigner extends AbstractSigner {
510
572
  setWallet(walletId) {
511
573
  if (!walletId || walletId.trim() === '') {
@@ -526,10 +588,10 @@ class EtherSigner extends AbstractSigner {
526
588
  if (this.address) {
527
589
  return this.address;
528
590
  }
529
- if (!this.APICredentials.apiKey && !this.walletDetail.WalletID) {
591
+ if (!this.APICredentials.apiKey && !this.APICredentials.authToken && !this.walletDetail.WalletID) {
530
592
  throw new Error('Wallet detail not found, use setWallet(walletId) to set wallet first!');
531
593
  }
532
- const detail = await this.APIService.getWalletDetail(WalletAddressType.Evm, this.walletDetail?.WalletID);
594
+ const detail = await this.APIService.getWalletDetail(AddressType.Evm, this.walletDetail?.WalletID);
533
595
  this.walletDetail = detail;
534
596
  if (detail?.Address) {
535
597
  // cache the address
@@ -787,10 +849,10 @@ class SolanaSigner {
787
849
  if (this.address) {
788
850
  return this.address;
789
851
  }
790
- if (!this.APIKey && !this.walletDetail?.WalletID) {
852
+ if (!this.APICredentials.apiKey && !this.APICredentials.apiSecret && !this.walletDetail?.WalletID) {
791
853
  throw new Error('Wallet detail not found, use setWallet(walletId) to set wallet first!');
792
854
  }
793
- const detail = await this.APIService.getWalletDetail(WalletAddressType.Sol, this.walletDetail?.WalletID);
855
+ const detail = await this.APIService.getWalletDetail(AddressType.Solana, this.walletDetail?.WalletID);
794
856
  this.walletDetail = detail;
795
857
  if (detail?.Address) {
796
858
  // cache the address
@@ -930,10 +992,11 @@ class SolanaSigner {
930
992
  }
931
993
  }
932
994
  constructor(credentials, environment, pollerOptions){
995
+ this.APICredentials = credentials;
933
996
  this.APIKey = credentials.apiKey;
934
997
  this.APIService = new APIService(credentials, environment);
935
998
  this.pollerOptions = pollerOptions;
936
999
  }
937
1000
  }
938
1001
 
939
- export { APIService, AddressType, DEFAULT_POLLER_OPTIONS, Environment, EtherSigner, FystackSDK, PaymentService, SolanaSigner, StatusPoller, TransactionError, TxApprovalStatus, TxStatus, WalletAddressType, WalletCreationStatus, WalletType, WebhookService, createAPI, get, post, transformCreateWalletPayload, transformWalletDetail };
1002
+ export { APIService, AddressType, DEFAULT_POLLER_OPTIONS, DestinationType, Environment, EtherSigner, FystackSDK, PaymentService, SolanaSigner, StatusPoller, TransactionError, TxApprovalStatus, TxStatus, WalletCreationStatus, WalletPurpose, WalletType, WebhookService, createAPI, get, post, transformCreateWalletPayload, transformRescanTransactionParams, transformWalletDetail };
package/dist/index.mjs CHANGED
@@ -16,7 +16,7 @@ const getBaseURL = (env)=>{
16
16
  case "local":
17
17
  return 'http://localhost:8150';
18
18
  case "sandbox":
19
- return 'https://apex.void.exchange';
19
+ return 'https://api-dev.fystack.io';
20
20
  case "production":
21
21
  return 'https://api.fystack.io';
22
22
  }
@@ -40,7 +40,8 @@ const createAPI = (env)=>{
40
40
  getTransactionStatus: (walletId, transactionId)=>withBaseURL(`/web3/transaction/${walletId}/${transactionId}`),
41
41
  getWalletCreationStatus: (walletId)=>withBaseURL(`/wallets/creation-status/${walletId}`),
42
42
  getWalletAssets: (walletId)=>withBaseURL(`/wallets/${walletId}/assets`),
43
- getDepositAddress: (walletId, addressType)=>withBaseURL(`/wallets/${walletId}/deposit-address?address_type=${addressType}`)
43
+ getDepositAddress: (walletId, addressType)=>withBaseURL(`/wallets/${walletId}/deposit-address?address_type=${addressType}`),
44
+ rescanTransaction: ()=>withBaseURL('/networks/rescan-transaction')
44
45
  }
45
46
  };
46
47
  };
@@ -118,14 +119,63 @@ async function computeHMACForWebhook(apiSecret, event) {
118
119
  }
119
120
  }
120
121
 
121
- var WalletAddressType;
122
- (function(WalletAddressType) {
123
- WalletAddressType["Evm"] = "evm";
124
- WalletAddressType["Sol"] = "sol";
125
- })(WalletAddressType || (WalletAddressType = {}));
122
+ // Wallets
123
+ var WalletType;
124
+ (function(WalletType) {
125
+ WalletType["Standard"] = "standard";
126
+ WalletType["MPC"] = "mpc";
127
+ })(WalletType || (WalletType = {}));
128
+ var WalletPurpose;
129
+ (function(WalletPurpose) {
130
+ WalletPurpose["General"] = "general";
131
+ WalletPurpose["Gastank"] = "gas_tank";
132
+ WalletPurpose["Deployment"] = "deployment";
133
+ WalletPurpose["Custody"] = "custody";
134
+ WalletPurpose["User"] = "user";
135
+ WalletPurpose["Payment"] = "payment";
136
+ })(WalletPurpose || (WalletPurpose = {}));
137
+ var WalletCreationStatus;
138
+ (function(WalletCreationStatus) {
139
+ WalletCreationStatus["Pending"] = "pending";
140
+ WalletCreationStatus["Success"] = "success";
141
+ WalletCreationStatus["Error"] = "error";
142
+ })(WalletCreationStatus || (WalletCreationStatus = {}));
143
+ var AddressType;
144
+ (function(AddressType) {
145
+ AddressType["Evm"] = "evm";
146
+ AddressType["Solana"] = "sol";
147
+ AddressType["Tron"] = "tron";
148
+ })(AddressType || (AddressType = {}));
149
+ var DestinationType;
150
+ (function(DestinationType) {
151
+ DestinationType["InternalWallet"] = "internal_wallet";
152
+ DestinationType["AddressBook"] = "address_book";
153
+ })(DestinationType || (DestinationType = {}));
154
+ var TxStatus;
155
+ (function(TxStatus) {
156
+ TxStatus["Pending"] = "pending";
157
+ TxStatus["Completed"] = "completed";
158
+ TxStatus["Confirmed"] = "confirmed";
159
+ TxStatus["Failed"] = "failed";
160
+ TxStatus["PendingApproval"] = "pending_approval";
161
+ TxStatus["Rejected"] = "rejected";
162
+ })(TxStatus || (TxStatus = {}));
163
+ var TxApprovalStatus;
164
+ (function(TxApprovalStatus) {
165
+ TxApprovalStatus["Pending"] = "pending";
166
+ TxApprovalStatus["Approved"] = "approved";
167
+ TxApprovalStatus["Rejected"] = "rejected";
168
+ })(TxApprovalStatus || (TxApprovalStatus = {}));
169
+
126
170
  async function composeAPIHeaders(credentials, httpMethod, apiEndpoint, body = {}) {
127
171
  if (credentials.apiSecret == '') {
128
- // If APISecret is not provided, fallback to cookie mode with no headers
172
+ // If APISecret is not provided, use authToken
173
+ if (credentials.authToken) {
174
+ return {
175
+ Authorization: credentials.authToken
176
+ };
177
+ }
178
+ // fallback to cookie mode with no headers
129
179
  return {};
130
180
  }
131
181
  const currentTimestampInSeconds = Math.floor(Date.now() / 1000);
@@ -147,7 +197,7 @@ async function composeAPIHeaders(credentials, httpMethod, apiEndpoint, body = {}
147
197
  return headers;
148
198
  }
149
199
  class APIService {
150
- async getWalletDetail(addressType = "evm", walletId) {
200
+ async getWalletDetail(addressType = AddressType.Evm, walletId) {
151
201
  const endpoint = this.API.endpoints.getWalletDetail(walletId);
152
202
  const headers = await composeAPIHeaders(this.credentials, 'GET', endpoint);
153
203
  console.info('headers', headers);
@@ -218,6 +268,16 @@ class APIService {
218
268
  const response = await get(endpoint, headers);
219
269
  return response.data;
220
270
  }
271
+ /**
272
+ * Rescans a transaction on a specific network
273
+ * @param params Transaction hash and network ID
274
+ * @returns API response
275
+ */ async rescanTransaction(params) {
276
+ const endpoint = this.API.endpoints.rescanTransaction();
277
+ const transformedParams = transformRescanTransactionParams(params);
278
+ const headers = await composeAPIHeaders(this.credentials, 'POST', endpoint, transformedParams);
279
+ await post(endpoint, transformedParams, headers);
280
+ }
221
281
  constructor(credentials, environment){
222
282
  this.credentials = credentials;
223
283
  this.Webhook = new WebhookService(credentials);
@@ -319,7 +379,26 @@ function transformWalletDetail(data) {
319
379
  function transformCreateWalletPayload(data) {
320
380
  return {
321
381
  name: data.name,
322
- wallet_type: data.walletType
382
+ wallet_type: data.walletType,
383
+ ...data.walletPurpose !== undefined && {
384
+ wallet_purpose: data.walletPurpose
385
+ },
386
+ ...data.sweepTaskParams !== undefined && {
387
+ sweep_task_params: {
388
+ min_trigger_value_usd: data.sweepTaskParams?.minTriggerValueUsd,
389
+ destination_wallet_id: data.sweepTaskParams?.destinationWalletId,
390
+ destination_type: data.sweepTaskParams?.destinationType
391
+ }
392
+ },
393
+ ...data.sweepTaskId !== undefined && {
394
+ sweep_task_id: data.sweepTaskId
395
+ }
396
+ };
397
+ }
398
+ function transformRescanTransactionParams(data) {
399
+ return {
400
+ tx_hash: data.txHash,
401
+ network_id: data.networkId
323
402
  };
324
403
  }
325
404
  BigInt.prototype.toJSON = function() {
@@ -380,47 +459,6 @@ class StatusPoller {
380
459
  }
381
460
  }
382
461
 
383
- class TransactionError extends Error {
384
- constructor(message, code, transactionId, originalError){
385
- super(message);
386
- this.code = code;
387
- this.transactionId = transactionId;
388
- this.originalError = originalError;
389
- this.name = 'TransactionError';
390
- }
391
- }
392
- var TxStatus;
393
- (function(TxStatus) {
394
- TxStatus["Pending"] = "pending";
395
- TxStatus["Completed"] = "completed";
396
- TxStatus["Confirmed"] = "confirmed";
397
- TxStatus["Failed"] = "failed";
398
- TxStatus["PendingApproval"] = "pending_approval";
399
- TxStatus["Rejected"] = "rejected";
400
- })(TxStatus || (TxStatus = {}));
401
- var TxApprovalStatus;
402
- (function(TxApprovalStatus) {
403
- TxApprovalStatus["Pending"] = "pending";
404
- TxApprovalStatus["Approved"] = "approved";
405
- TxApprovalStatus["Rejected"] = "rejected";
406
- })(TxApprovalStatus || (TxApprovalStatus = {}));
407
- var WalletType;
408
- (function(WalletType) {
409
- WalletType["Standard"] = "standard";
410
- WalletType["MPC"] = "mpc";
411
- })(WalletType || (WalletType = {}));
412
- var WalletCreationStatus;
413
- (function(WalletCreationStatus) {
414
- WalletCreationStatus["Pending"] = "pending";
415
- WalletCreationStatus["Success"] = "success";
416
- WalletCreationStatus["Error"] = "error";
417
- })(WalletCreationStatus || (WalletCreationStatus = {}));
418
- var AddressType;
419
- (function(AddressType) {
420
- AddressType["Evm"] = "evm";
421
- AddressType["Solana"] = "sol";
422
- })(AddressType || (AddressType = {}));
423
-
424
462
  class FystackSDK {
425
463
  log(message) {
426
464
  if (this.enableLogging) {
@@ -433,10 +471,13 @@ class FystackSDK {
433
471
  * @param waitForCompletion Whether to wait for the wallet creation to complete
434
472
  * @returns Promise with wallet ID and status
435
473
  */ async createWallet(options, waitForCompletion = true) {
436
- const { name, walletType = WalletType.Standard } = options;
474
+ const { name, walletType = WalletType.Standard, sweepTaskParams, walletPurpose, sweepTaskId } = options;
437
475
  const response = await this.apiService.createWallet({
438
476
  name,
439
- walletType
477
+ walletType,
478
+ walletPurpose,
479
+ sweepTaskParams,
480
+ sweepTaskId
440
481
  });
441
482
  if (waitForCompletion && response.status === WalletCreationStatus.Pending) {
442
483
  return this.waitForWalletCreation(response.wallet_id);
@@ -499,6 +540,17 @@ class FystackSDK {
499
540
  const depositAddressInfo = await this.apiService.getDepositAddress(walletId, addressType);
500
541
  return depositAddressInfo;
501
542
  }
543
+ /**
544
+ * Rescans a transaction on a specific network
545
+ * @param params Transaction hash and network ID
546
+ * @returns Promise that resolves when the rescan is initiated
547
+ */ async rescanTransaction(params) {
548
+ validateUUID(params.networkId, 'networkId');
549
+ if (!params.txHash || params.txHash.trim() === '') {
550
+ throw new Error('Invalid transaction hash provided');
551
+ }
552
+ await this.apiService.rescanTransaction(params);
553
+ }
502
554
  constructor(options){
503
555
  const { credentials, environment = Environment.Production, logger = false } = options;
504
556
  this.apiService = new APIService(credentials, environment);
@@ -506,6 +558,16 @@ class FystackSDK {
506
558
  }
507
559
  }
508
560
 
561
+ class TransactionError extends Error {
562
+ constructor(message, code, transactionId, originalError){
563
+ super(message);
564
+ this.code = code;
565
+ this.transactionId = transactionId;
566
+ this.originalError = originalError;
567
+ this.name = 'TransactionError';
568
+ }
569
+ }
570
+
509
571
  class EtherSigner extends AbstractSigner {
510
572
  setWallet(walletId) {
511
573
  if (!walletId || walletId.trim() === '') {
@@ -526,10 +588,10 @@ class EtherSigner extends AbstractSigner {
526
588
  if (this.address) {
527
589
  return this.address;
528
590
  }
529
- if (!this.APICredentials.apiKey && !this.walletDetail.WalletID) {
591
+ if (!this.APICredentials.apiKey && !this.APICredentials.authToken && !this.walletDetail.WalletID) {
530
592
  throw new Error('Wallet detail not found, use setWallet(walletId) to set wallet first!');
531
593
  }
532
- const detail = await this.APIService.getWalletDetail(WalletAddressType.Evm, this.walletDetail?.WalletID);
594
+ const detail = await this.APIService.getWalletDetail(AddressType.Evm, this.walletDetail?.WalletID);
533
595
  this.walletDetail = detail;
534
596
  if (detail?.Address) {
535
597
  // cache the address
@@ -787,10 +849,10 @@ class SolanaSigner {
787
849
  if (this.address) {
788
850
  return this.address;
789
851
  }
790
- if (!this.APIKey && !this.walletDetail?.WalletID) {
852
+ if (!this.APICredentials.apiKey && !this.APICredentials.apiSecret && !this.walletDetail?.WalletID) {
791
853
  throw new Error('Wallet detail not found, use setWallet(walletId) to set wallet first!');
792
854
  }
793
- const detail = await this.APIService.getWalletDetail(WalletAddressType.Sol, this.walletDetail?.WalletID);
855
+ const detail = await this.APIService.getWalletDetail(AddressType.Solana, this.walletDetail?.WalletID);
794
856
  this.walletDetail = detail;
795
857
  if (detail?.Address) {
796
858
  // cache the address
@@ -930,10 +992,11 @@ class SolanaSigner {
930
992
  }
931
993
  }
932
994
  constructor(credentials, environment, pollerOptions){
995
+ this.APICredentials = credentials;
933
996
  this.APIKey = credentials.apiKey;
934
997
  this.APIService = new APIService(credentials, environment);
935
998
  this.pollerOptions = pollerOptions;
936
999
  }
937
1000
  }
938
1001
 
939
- export { APIService, AddressType, DEFAULT_POLLER_OPTIONS, Environment, EtherSigner, FystackSDK, PaymentService, SolanaSigner, StatusPoller, TransactionError, TxApprovalStatus, TxStatus, WalletAddressType, WalletCreationStatus, WalletType, WebhookService, createAPI, get, post, transformCreateWalletPayload, transformWalletDetail };
1002
+ export { APIService, AddressType, DEFAULT_POLLER_OPTIONS, DestinationType, Environment, EtherSigner, FystackSDK, PaymentService, SolanaSigner, StatusPoller, TransactionError, TxApprovalStatus, TxStatus, WalletCreationStatus, WalletPurpose, WalletType, WebhookService, createAPI, get, post, transformCreateWalletPayload, transformRescanTransactionParams, transformWalletDetail };