Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Successful payments return amount #26

Closed
wants to merge 1 commit into from
Closed

Successful payments return amount #26

wants to merge 1 commit into from

Conversation

448-OG
Copy link

@448-OG 448-OG commented Apr 17, 2024

On successful payment instead of returning InfoResponse we now return fedimint_core::Amount in functions:

  • handle_rest
  • _await_claim_external_receive_tweaked
  • _await_claim_external_receive
  • _await_invoice

Other functions or methods that return info reponse in a manner that requires detailed information like _info in the router/handlers/fedimint/admin/info.rs have not been modified as I assume all the information is InfoResponse is required.

Resolves: #19

On successful payment instead of returning InfoResponse we now return fedimint_core::Amount in functions:
- handle_rest
- _await_claim_external_receive_tweaked
- _await_claim_external_receive
- _await_invoice

Other functions or methods that return info reponse in a manner that requires detailed information
like `_info` in the router/handlers/fedimint/admin/info.rs have not been modified as I assume all
the information is InfoResponse is required.

Resolves: #19
@Kodylow
Copy link
Member

Kodylow commented Apr 17, 2024

Approach nit: it'd be better to align with something like LNURLPay or give more info on the payment itself besides just the amount. https://github.com/lnurl/luds/blob/legacy/lnurl-pay.md

Alby's "verify" url that they do for LNURLPay payments is generally pretty great, it'll return this for success:

{
status: "OK",
settled: true,
preimage: "0a7c619cc24bfbcc5be36ffc9b22a1517be1ec18b59deef2022eea679fa83109",
pr: "lnbc10n1pnzqg55pp5vvm6vl3s463q4xqd09cyw8t84fjkc36e95hvatn9ng9wr46x339shp56kymqtxr5es99pd82vjjnmssr2l72l379pv87d05c5pd4s2n0ysqcqzzsxqyz5vqsp549eq3383snqkapycuv99yjhzheldz40el8hpuyftut60v5q9kaus9qyyssqx58c5tged0nhz5n4czyg9d9a94z6xh325hsj5dkjd49hduqka3hx095lscgeuatzyqstwayucmwt3qf8njgk6gqzz7p4v0jles78xkcpkx43c4"
}

or this for unpaid:

{
status: "OK",
settled: false,
preimage: null,
pr: "lnbc10n1pnzqghjpp54ra8lw0tuap2wfza6tgjajkeye9pp54yne3y85gat62v7urd024qhp56kymqtxr5es99pd82vjjnmssr2l72l379pv87d05c5pd4s2n0ysqcqzzsxqyz5vqsp590alky2gx75407l3lc2mnge5a69f9a2qmywhq32jnug9gpt2w7as9qyyssqnmda9yf7ejey663dez5394dcnmxz88dxcxf90f68tsff4u2nf5mxvr72n30z27m24fggrmzkszukyum23tmv7hqfm4qwz6x8j0cewasqu9240c"
}

For our purposes we could return operationType and operationInfo instead of pr, but most importantly returning the status / settled similarly to above

@448-OG
Copy link
Author

448-OG commented Apr 19, 2024

Where is OperationType and OperationInfo defined, I cant find any definition of which fields they might contain in the fedimint docs. While I can do something like

&client.operation_log().get_operation(req.operation_id).await.unwrap();

to get the OperationLogEntry , which has a method .outcome() which can be <OperationType>State or serde_json::Value , where is OperationType defined or if I parse to serde_json::Value , which data structure was serialized into the serde_json::Value in the first place ? So that I know which fields are contained in it?
https://docs.rs/fedimint-client/latest/fedimint_client/oplog/struct.OperationLogEntry.html#method.outcome

@Kodylow Kodylow force-pushed the master branch 4 times, most recently from 23c7ae9 to 8a3e77c Compare April 20, 2024 18:53
@448-OG
Copy link
Author

448-OG commented Apr 22, 2024

@Kodylow any updates on this

@Kodylow
Copy link
Member

Kodylow commented Apr 22, 2024

It depends on what you're looking up, what you probably want is to lookup the contract on the federation associated with that operation id

@448-OG 448-OG closed this by deleting the head repository Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Successful payments should return amounts of payments not InfoResponse
2 participants