Skip to content

Commit

Permalink
Merge pull request #383 from CirclesUBI/feature/app-394-enable-send-c…
Browse files Browse the repository at this point in the history
…ircles-before-calculate-max-balance-finishes-2

remove maxFlow check for amount entry step
  • Loading branch information
jaensen authored Aug 29, 2023
2 parents 826ef3b + 7e15557 commit d9757d3
Showing 1 changed file with 1 addition and 80 deletions.
81 changes: 1 addition & 80 deletions shell/src/dapps/o-banking/processes/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,65 +192,7 @@ const processDefinition = (processId: string) =>
onDone: [
{
cond: (context) => !!context.data.recipientProfile,
target: "#getMaxFlow",
},
{
target: "#getMaxFlow",
},
],
onError: "#error",
},
},
getMaxFlow: {
id: "getMaxFlow",
entry: () => {
window.o.publishEvent(<PlatformEvent>{
type: "shell.progress",
message: window.o.i18n("dapps.o-banking.processes.transfer.findMaxFlow.entry.message"),
});
},
invoke: {
id: "getMaxFlow",
src: async (context) => {
let flow: any = {
isValid: false,
};
let amount = "0";

/*
let tries = 0;
while(!flow.isValid && tries < 32) {
flow = await ApiClient.query<TransitivePath, QueryDirectPathArgs>(DirectPathDocument, {
from: context.data.safeAddress,
to: context.data.recipientAddress,
amount: amount,
});
if (!flow.isValid) {
let oldAmount = amount == "0" ? flow.flow : amount
amount = new BN(oldAmount).sub(new BN(oldAmount).div(new BN("32"))).toString();
console.log(`Flow not valid, reducing amount from ${oldAmount} to ${amount}`);
}
tries++;
}*/

flow = await ApiClient.query<TransitivePath, QueryDirectPathArgs>(DirectPathDocument, {
from: context.data.safeAddress,
to: context.data.recipientAddress,
amount: amount,
});

if (!context.data.maxFlows) {
context.data.maxFlows = {};
}
context.data.maxFlows["crc"] = flow.flow;
},
onDone: [
{
cond: (context) => {
console.log('context.data.maxFlows["crc"] == "0"', context.data.maxFlows["crc"]);
return context.data.maxFlows["crc"] == "";
},
target: "#noTrust",
target: "#tokens",
},
{
target: "#tokens",
Expand All @@ -259,27 +201,6 @@ const processDefinition = (processId: string) =>
onError: "#error",
},
},
noTrust: prompt<TransferContext, any>({
id: "noTrust",
field: "__",
component: HtmlViewer,
params: (context) => {
return {
view: {
title: "Not trusted",
description: `${context.data.recipientProfile.displayName} isn't trusting you.`,
submitButtonText: "Go back",
},
html: () => "",
hideNav: false,
};
},
navigation: {
next: "#recipientAddress",
canGoBack: () => false,
canSkip: () => false,
},
}),
tokens: prompt<TransferContext, any>({
field: "tokens",
component: CurrencyTransfer,
Expand Down

0 comments on commit d9757d3

Please sign in to comment.