@flashbacktech/flashbackclient 0.1.50 → 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.
|
@@ -13,7 +13,7 @@ export declare class BucketOps {
|
|
|
13
13
|
* @param params - Bucket creation parameters
|
|
14
14
|
* @returns Promise resolving to the created bucket ID
|
|
15
15
|
*/
|
|
16
|
-
createBucket: (provider_id: string, params: BucketCreateParams) => Promise<
|
|
16
|
+
createBucket: (provider_id: string, params: BucketCreateParams) => Promise<any>;
|
|
17
17
|
/**
|
|
18
18
|
* Creates a bucket from an existing bucket object
|
|
19
19
|
* @param bucket - Existing bucket object to clone
|
|
@@ -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
|
-
|
|
75
|
-
method,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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 = []) => {
|