@flashbacktech/flashbackclient 0.1.51 → 0.1.52

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.
@@ -71,47 +71,80 @@ const getHorizonServer = (network) => {
71
71
  };
72
72
  exports.getHorizonServer = getHorizonServer;
73
73
  const executeWalletTransaction = async (context, wallet_address, method, additionalArgs = []) => {
74
- const response = await prepareTransaction(context, wallet_address, {
75
- method,
76
- args: [{ value: wallet_address, type: "address" }, ...additionalArgs],
77
- });
78
- if (response.isSuccess) {
79
- if (response.isReadOnly) {
80
- return response;
74
+ try {
75
+ console.log('executeWalletTransaction: Starting execution', { method, wallet_address, additionalArgs });
76
+ console.log('executeWalletTransaction: Calling prepareTransaction...');
77
+ const response = await prepareTransaction(context, wallet_address, {
78
+ method,
79
+ args: [{ value: wallet_address, type: "address" }, ...additionalArgs],
80
+ });
81
+ console.log('executeWalletTransaction: prepareTransaction response:', { isSuccess: response.isSuccess, isReadOnly: response.isReadOnly });
82
+ if (response.isSuccess) {
83
+ if (response.isReadOnly) {
84
+ console.log('executeWalletTransaction: Transaction is read-only, returning response');
85
+ return response;
86
+ }
87
+ console.log('executeWalletTransaction: Transaction is not read-only, signing...');
88
+ const signedTxXDR = await context.signTransaction(response.result);
89
+ console.log('executeWalletTransaction: Transaction signed successfully');
90
+ console.log('executeWalletTransaction: Sending transaction...');
91
+ const sendResponse = await sendTransaction(context, signedTxXDR);
92
+ console.log('executeWalletTransaction: Transaction sent successfully:', sendResponse);
93
+ return {
94
+ isSuccess: true,
95
+ isReadOnly: false,
96
+ result: sendResponse,
97
+ };
81
98
  }
82
- const signedTxXDR = await context.signTransaction(response.result);
83
- const sendResponse = await sendTransaction(context, signedTxXDR);
84
- return {
85
- isSuccess: true,
86
- isReadOnly: false,
87
- result: sendResponse,
88
- };
99
+ console.log('executeWalletTransaction: prepareTransaction failed, returning response');
100
+ return response;
101
+ }
102
+ catch (error) {
103
+ console.error('executeWalletTransaction: Error occurred:', error);
104
+ console.error('executeWalletTransaction: Error stack:', error instanceof Error ? error.stack : 'No stack trace');
105
+ throw error;
89
106
  }
90
- return response;
91
107
  };
92
108
  exports.executeWalletTransaction = executeWalletTransaction;
93
109
  const executeMultiWalletTransactions = async (context, wallet_address, methods, extraOperations = []) => {
94
- const contractCalls = methods.map(({ method, additionalArgs = [] }) => ({
95
- method,
96
- args: [
97
- { value: wallet_address, type: "address" },
98
- ...additionalArgs,
99
- ],
100
- }));
101
- const response = await prepareTransaction(context, wallet_address, contractCalls, extraOperations);
102
- if (response.isSuccess) {
103
- if (response.isReadOnly) {
104
- return response;
110
+ try {
111
+ console.log('executeMultiWalletTransactions: Starting execution', { wallet_address, methodsCount: methods.length, extraOperationsCount: extraOperations.length });
112
+ const contractCalls = methods.map(({ method, additionalArgs = [] }) => ({
113
+ method,
114
+ args: [
115
+ { value: wallet_address, type: "address" },
116
+ ...additionalArgs,
117
+ ],
118
+ }));
119
+ console.log('executeMultiWalletTransactions: Contract calls prepared:', contractCalls);
120
+ console.log('executeMultiWalletTransactions: Calling prepareTransaction...');
121
+ const response = await prepareTransaction(context, wallet_address, contractCalls, extraOperations);
122
+ console.log('executeMultiWalletTransactions: prepareTransaction response:', { isSuccess: response.isSuccess, isReadOnly: response.isReadOnly });
123
+ if (response.isSuccess) {
124
+ if (response.isReadOnly) {
125
+ console.log('executeMultiWalletTransactions: Transaction is read-only, returning response');
126
+ return response;
127
+ }
128
+ console.log('executeMultiWalletTransactions: Transaction is not read-only, signing...');
129
+ const signedTxXDR = await context.signTransaction(response.result);
130
+ console.log('executeMultiWalletTransactions: Transaction signed successfully');
131
+ console.log('executeMultiWalletTransactions: Sending transaction...');
132
+ const sendResponse = await sendTransaction(context, signedTxXDR);
133
+ console.log('executeMultiWalletTransactions: Transaction sent successfully:', sendResponse);
134
+ return {
135
+ isSuccess: true,
136
+ isReadOnly: false,
137
+ result: sendResponse,
138
+ };
105
139
  }
106
- const signedTxXDR = await context.signTransaction(response.result);
107
- const sendResponse = await sendTransaction(context, signedTxXDR);
108
- return {
109
- isSuccess: true,
110
- isReadOnly: false,
111
- result: sendResponse,
112
- };
140
+ console.log('executeMultiWalletTransactions: prepareTransaction failed, returning response');
141
+ return response;
142
+ }
143
+ catch (error) {
144
+ console.error('executeMultiWalletTransactions: Error occurred:', error);
145
+ console.error('executeMultiWalletTransactions: Error stack:', error instanceof Error ? error.stack : 'No stack trace');
146
+ throw error;
113
147
  }
114
- return response;
115
148
  };
116
149
  exports.executeMultiWalletTransactions = executeMultiWalletTransactions;
117
150
  const prepareTransaction = async (context, address, contractCalls, extraOperations = []) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashbacktech/flashbackclient",
3
- "version": "0.1.51",
3
+ "version": "0.1.52",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"