fedimint-web-sdk
fedimint-web-sdk copied to clipboard
Feature Request: previewFederation
I want to pass an invite code into a previewFederation function to get information about the federation such as API endpoints, federation ID, etc
just work on it, you don't need assignment to start working
@IroncladDev @maan2003 I have investigated the issue and I have a solution, but it requires the fedimint-client rust code to be modified as well along with the webSDK. I am participating in the Summer of bitcoin 2025 and want to know if I am going in the right direction.
yes
So, am I supposed to submit a PR or just submit my solution with explanation along with the proposal only?
submit PRs to fedimint and websdk
Hi @maan2003 , I am interesting in it.
So we need to create a function that give the details of federation by using there invite code. So we need to function in fedimint ( Rust). While we will use that function in websdk by editing the services code ?
Please confirm
Thanks
yes
yes
Thanks
I'm repeating the question or am I misunderstanding something? but isn't this issue same as https://github.com/fedimint/fedimint-web-sdk/pull/128/commits/8b04468ae76f6c74a260cd90e3cb1c8caa7b432a#diff-18a743b7d403b74f4401d46650dc08b502829c007ab40477963c4226707d7884
parseInviteCode(inviteCode): Promise<{ url: string; federation_id: string }>
parseInviteCode takes inviteCode and returns federation ID and endpoints. this is all we want for the preview Federation takes the invite code as a parameter and returns the federation ID and API endpoints.
Please correct me if I'm wrong !
or in previewFederation the extra feature is we have to extract all info of a federation 1>getConfig 2>getFederationId 3>listOperations
this would be the key difference between previewFederation and parseInviteCode?
previewFederation will make requests to federation to get its config and meta WITHOUT joining the federation
parseInviteCode is entirely local function
@maan2003 Got it, thanks ! I have implemented the logic in fedimint-client-wasm in the fedimint backend; now how can we use the functionality in web-sdk? Can we use it locally by using the build pkg in web-sdk, or do we have to deploy it first to use it? Please guide on this .
where is the fedimint PR? you have to rebuild wasm from that commit
I didn't make the PR yet. OK, so firstly, have to make a Fedimint PR, then use that commit and rebuild WASM from that to use in the web SDK? But for this that PR have to merged ? Am I on the right path?
Yes
OK, thanks, and there's no way we can test the functionality locally by using the build files from Fedimint and using that in web-SDK for testing purposes, or the only way is for the Fedimint PR to be merged, and then only can we use the functionality?
you can test locally, by build wasm locally and copying it over
but would recommend opening a fedimint draft PR
Sure, Thank you for responding to the questions!
@maan2003 I have submitted a Draft PR for the backend logic for previewFederation. Would you please review it ? https://github.com/fedimint/fedimint/pull/7136
@maan2003 The project details on the Summer of Bitcoin page mention that we need to propose a solution to this issue. I have already included the details in my proposal on how we can plan to tackle it. Could you please clarify whether implementation is also required?
the competency tests are entirely optional. Yes, having a PR for it would be nice.
@MrImmortal09 you have already proved your competency with rest of PRs, so feel free to skip it.
Successfully implemented previewFederation in the backend. @maan2003 @alexlwn123, is there any other data I should include?
Shortened Json output:
{
"config": {
"api_endpoints": {
"0": {
"name": "Devimint Guardian 0",
"url": "ws://127.0.0.1:10033/"
},
"1": {
"name": "Devimint Guardian 1",
"url": "ws://127.0.0.1:10037/"
},
"2": {
"name": "Devimint Guardian 2",
"url": "ws://127.0.0.1:10041/"
},
"3": {
"name": "Devimint Guardian 3",
"url": "ws://127.0.0.1:10045/"
}
},
"broadcast_public_keys": {
"0": "03f7ecf3c94131a05cfa13d32bca5feac79fcabda720e3c2dd987bf6f1c3a69c0e",
"1": "027039664c2b14625b2ce952829aa8de9cb1a0c96d2163517f07e4abaa93058a4c",
"2": "0310fd5a11ade059176f86cc8c7c6fe5af962bbe9fc3e839eab61863df52010586",
"3": "028b0a41597552249b04b96ea3a74b298a6b333d17c0425dea2d022da57c905607"
},
"consensus_version": {
"major": 2,
"minor": 1
},
"meta": {
"federation_name": "Devimint Federation"
},
"modules": {
"0": {
"config": "a very big string here",
"kind": "ln",
"version": {
"major": 2,
"minor": 0
}
},
"1": {
"config": "very big string here",
"kind": "mint",
"version": {
"major": 2,
"minor": 0
}
},
"2": {
"config": "02fd0157fd012877736828736f727465646d756c746928332c...",
"kind": "wallet",
"version": {
"major": 2,
"minor": 2
}
"----->" : " few more configs here "
}
}
},
"federation_id": "a56c0abad73973088995e28265ce43d365db9414a78a140a715073beee3ae81c",
"pref_url": "ws://127.0.0.1:10041/"
}
is there any other data I should include?
@MrImmortal09
Nice! Couple questions
- What does
perf_urlmean? Is it just one of the guardian endpoints? - Thinking we should decode the hex data in the config field. Do you think it'd be better to do this on the rust side or the js?
- What does
perf_urlmean? Is it just one of the guardian endpoints?- Thinking we should decode the hex data in the config field. Do you think it'd be better to do this on the rust side or the js?
Yes, the perf_url is one of the guardian endpoints — I used that term for debugging purposes. Regarding decoding the hex data, I believe it’s more appropriate to handle it on the Rust side. Decoding it in JavaScript would likely be more complex, as it would require manual parsing. Handling it in Rust allows us to return clean, structured JSON to the frontend and avoid redundant effort.
closed per https://github.com/fedimint/fedimint/pull/7200 & https://github.com/fedimint/fedimint-web-sdk/pull/155
Awesome