You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/token.js
+7-2Lines changed: 7 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@ import { getVersion } from '~/safe';
18
18
* @param {Object} userOptions - search arguments
19
19
* @param {string} pathfinderType - pathfinder execution type
20
20
* @param {number} pathfinderMaxTransferSteps - default pathfinder server max transfer steps
21
+
* @param {Boolean} returnIterativeFirstMatch - if true, the pathfinder service iteratively optimizes the result and returns the first match with 'value'. Only available when pathfinderType is 'cli'
21
22
*
22
23
* @return {Object[]} - transaction steps
23
24
*/
@@ -27,6 +28,7 @@ export async function findTransitiveTransfer(
27
28
userOptions,
28
29
pathfinderType,
29
30
pathfinderMaxTransferSteps,
31
+
returnIterativeFirstMatch=false,
30
32
){
31
33
letresult;
32
34
if(pathfinderType=='cli'){
@@ -39,6 +41,7 @@ export async function findTransitiveTransfer(
39
41
utils,
40
42
userOptions,
41
43
pathfinderMaxTransferSteps,
44
+
returnIterativeFirstMatch,
42
45
);
43
46
}
44
47
returnresult;
@@ -109,6 +112,7 @@ async function findTransitiveTransferCli(web3, utils, userOptions) {
* @param {BN} userOptions.value - value of Circles tokens
111
114
* @param {number} userOptions.maxTransfers - limit of steps returned by the pathfinder service
115
+
* @param {Boolean} returnIterativeFirstMatch - if true, the pathfinder service iteratively optimizes the result and returns the first match with 'value'. Only available when pathfinderType is 'cli'
112
116
*
113
117
* @return {Object[]} - transaction steps
114
118
*/
@@ -117,6 +121,7 @@ async function findTransitiveTransferServer(
117
121
utils,
118
122
userOptions,
119
123
pathfinderMaxTransferSteps,
124
+
returnIterativeFirstMatch,
120
125
){
121
126
constoptions=checkOptions(userOptions,{
122
127
from: {
@@ -136,7 +141,6 @@ async function findTransitiveTransferServer(
136
141
137
142
try{
138
143
constresponse=awaitutils.requestPathfinderAPI({
139
-
method: 'POST',
140
144
data: {
141
145
id: crypto.randomUUID(),
142
146
method: 'compute_transfer',
@@ -145,9 +149,9 @@ async function findTransitiveTransferServer(
145
149
to: options.to,
146
150
value: options.value.toString(),
147
151
max_transfers: options.maxTransfers,
152
+
iterative: returnIterativeFirstMatch,
148
153
},
149
154
},
150
-
isTrailingSlash: false,
151
155
});
152
156
returnresponse.result;
153
157
}catch(error){
@@ -586,6 +590,7 @@ export default function createTokenModule(
0 commit comments