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

Show fee rate for gateway #606

Closed
wants to merge 62 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
b080879
feat: begin fedimint cards
Kodylow Nov 16, 2023
f6945d9
feat: add fedmint lightning gateway config option to thunderhub configs
Kodylow Nov 16, 2023
1e2ae26
feat: connect to federation card
Kodylow Nov 17, 2023
bf3e1aa
feat: refactor to gateway context pattern
Kodylow Nov 18, 2023
caf995b
fix: minor run fixes
Kodylow Nov 18, 2023
afb80ee
feat: add nix flake
Kodylow Nov 18, 2023
af8feba
fix: local_data dir for dev
Kodylow Nov 20, 2023
f241ee8
devimint setup scripts
Kodylow Nov 20, 2023
bbd527d
fix: fix gateway password and url assignment from publicRuntimeConfig
Kodylow Nov 23, 2023
1503034
fix: fix peg out command
Kodylow Nov 23, 2023
ea65031
fix: peg in ecash card
Kodylow Nov 24, 2023
8872b23
feat: fedimint 0.2 api updates
Kodylow Nov 28, 2023
3b7ce5d
fix: missing export gatewayApi
Kodylow Nov 28, 2023
fbb2e00
fix: updates
Kodylow Nov 28, 2023
dbd7566
fix: amount or all updates for withdrawAll
Kodylow Nov 28, 2023
4da427c
feat: add fedimints tabs and info
Kodylow Nov 28, 2023
2b6d813
feat: network specific quick actions
Kodylow Nov 30, 2023
375a861
fix: hold
Kodylow Nov 30, 2023
d0d6328
feat: skyler updates
Kodylow Nov 30, 2023
8756338
feat: bump fedimint version for multifederation support
Kodylow Dec 2, 2023
2149c7b
fix: multifederation and leave button
Kodylow Dec 2, 2023
480543d
feat: begin fedimint cards
Kodylow Nov 16, 2023
e69553f
feat: connect to federation card
Kodylow Nov 17, 2023
2609def
feat: refactor to gateway context pattern
Kodylow Nov 18, 2023
ee0e1fe
fix: minor run fixes
Kodylow Nov 18, 2023
d697394
fix: local_data dir for dev
Kodylow Nov 20, 2023
140f09f
devimint setup scripts
Kodylow Nov 20, 2023
c8330cf
fix: fix gateway password and url assignment from publicRuntimeConfig
Kodylow Nov 23, 2023
a19629c
fix: fix peg out command
Kodylow Nov 23, 2023
5b53e64
feat: fedimint 0.2 api updates
Kodylow Nov 28, 2023
cfdf4ae
fix: missing export gatewayApi
Kodylow Nov 28, 2023
70ce4b6
fix: updates
Kodylow Nov 28, 2023
edbb90e
fix: hold
Kodylow Nov 30, 2023
ad437e7
feat: skyler updates
Kodylow Nov 30, 2023
5a4e380
feat: bump fedimint version for multifederation support
Kodylow Dec 2, 2023
7eaa0eb
bump fedimint versioning
Kodylow Dec 5, 2023
abc888a
feat: docker hub publishing updates
Kodylow Dec 8, 2023
90af321
fix: docker workflow releases only
Kodylow Dec 14, 2023
607e9ec
fix: merge marker
Kodylow Dec 14, 2023
13e0f42
fix: network indicator
Kodylow Dec 14, 2023
46e5f01
fix: show total fedimint ecash as sats
Kodylow Dec 14, 2023
db91b63
fix: thunderhub ui with sats only
Kodylow Dec 14, 2023
eb9c73b
feat: docker compose mutinynet setup
Kodylow Dec 21, 2023
75110e5
chore: bump flake nix channel and fedimint version
Kodylow Jan 7, 2024
31046a7
updates
Kodylow Jan 8, 2024
cade383
Fix docker-compose IP
IroncladDev Jan 8, 2024
93c559f
remove unnecessary diffs
IroncladDev Jan 9, 2024
1bb3a06
Merge pull request #17 from IroncladDev/co/fix-compose-ip
Kodylow Jan 9, 2024
8bb29cc
Mutinynet Quick Actions
IroncladDev Jan 9, 2024
807448c
Merge pull request #18 from IroncladDev/co/mutinynet-actions
Kodylow Jan 9, 2024
a3ed8e4
fix
Kodylow Jan 19, 2024
66913a3
Merge pull request #25 from Kodylow/fix-purple-fedimint-logo
Kodylow Jan 19, 2024
7297e93
fix: tb1 placeholder
Kodylow Jan 19, 2024
bafb8bb
Merge pull request #26 from Kodylow/tb1-placeholder
Kodylow Jan 21, 2024
51c8065
fix: quickcard spacing
Kodylow Jan 21, 2024
32f0142
Merge pull request #27 from Kodylow/fix-quickcard-spacing
Kodylow Jan 21, 2024
5eb9dc0
fix: signet nodes for quick open channel
Kodylow Jan 21, 2024
bc9b44e
Merge pull request #28 from Kodylow/quick-open-channel-mutiny
Kodylow Jan 21, 2024
7b18f91
feat: impl leave fed
Kodylow Jan 21, 2024
f13fcf9
Merge branch 'master' into impl-leave-federation
Kodylow Jan 23, 2024
1ece0f2
Merge pull request #29 from Kodylow/impl-leave-federation
Kodylow Jan 23, 2024
34fd3e5
feat: add feerate to fedimmint gateway card
Kodylow Jan 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: fix gateway password and url assignment from publicRuntimeConfig
  • Loading branch information
Kodylow committed Dec 14, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit bbd527dedac4e3a5ea832fe370f30b27a113332b
1 change: 1 addition & 0 deletions .direnv/flake-profile
1 change: 1 addition & 0 deletions .direnv/flake-profile-1-link
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
3 changes: 1 addition & 2 deletions scripts/mprocs-nix-gateway.sh
Original file line number Diff line number Diff line change
@@ -26,12 +26,11 @@ accounts:
certificatePath: $FM_LND_TLS_CERT
EOF

echo $TEMP_FILE
# -----------
# Fedimint Config
# -----------
export ACCOUNT_CONFIG_PATH=$TEMP_FILE
export FM_GATEWAY_URL=$FM_GATEWAY_API_ADDR
export FM_GATEWAY_API=$FM_GATEWAY_API_ADDR
export FM_GATEWAY_PASSWORD=$FM_GATEWAY_PASSWORD

npm run start:dev
2 changes: 1 addition & 1 deletion src/client/next.config.js
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ module.exports = {
disableLnMarkets: process.env.DISABLE_LNMARKETS === 'true',
noVersionCheck: process.env.NO_VERSION_CHECK === 'true',
logoutUrl: process.env.LOGOUT_URL || '',
fmGatewayUrl: process.env.FM_GATEWAY_URL || '',
fmGatewayUrl: process.env.FM_GATEWAY_API || '',
fmGatewayPassword: process.env.FM_GATEWAY_PASSWORD || '',
},
};
51 changes: 10 additions & 41 deletions src/client/src/api/GatewayApi.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,16 @@
// import { publicRuntimeConfig } from '../../next.config';
// import { publicRuntimeConfig } from '../../next.config';
import getConfig from 'next/config';
import { GatewayInfo, Federation } from './types';

const SESSION_STORAGE_KEY = 'gateway-ui-key';
// const SESSION_STORAGE_KEY = 'gateway-ui-key';

const { publicRuntimeConfig } = getConfig();

// GatewayApi is an implementation of the ApiInterface
export class GatewayApi {
private baseUrl: string | undefined = process.env.FM_GATEWAY_API;

// Tests a provided password, or the one in the environment config, or the one in session storage
testPassword = async (password?: string): Promise<boolean> => {
const tempPassword =
password || this.getPassword() || process.env.FM_GATEWAY_PASSWORD;

if (!tempPassword) {
return false;
}

// Replace with temp password to check.
sessionStorage.setItem(SESSION_STORAGE_KEY, tempPassword);

try {
await this.fetchInfo();
return true;
} catch (err) {
// TODO: make sure error is auth error, not unrelated
console.error(err);
this.clearPassword();
return false;
}
};

private getPassword = (): string | null => {
return sessionStorage.getItem(SESSION_STORAGE_KEY);
};

clearPassword = () => {
sessionStorage.removeItem(SESSION_STORAGE_KEY);
};
private baseUrl: string | undefined = publicRuntimeConfig.fmGatewayUrl;
private password: string | undefined = publicRuntimeConfig.fmGatewayPassword;

private post = async (api: string, body: unknown): Promise<Response> => {
if (this.baseUrl === undefined) {
@@ -44,18 +19,11 @@ export class GatewayApi {
);
}

const password = this.getPassword();
if (!password) {
throw new Error(
'Misconfigured Gateway API. Make sure gateway password is configured appropriately'
);
}

return fetch(`${this.baseUrl}/${api}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${password}`,
Authorization: `Bearer ${this.password}`,
},
body: JSON.stringify(body),
});
@@ -72,6 +40,7 @@ export class GatewayApi {

throw responseToError(res);
} catch (error) {
console.log(`baseUrl`, this.baseUrl);
return Promise.reject({ message: 'Error fetching gateway info', error });
}
};
Original file line number Diff line number Diff line change
@@ -37,6 +37,10 @@ export const FedimintGatewayCard = ({
});
};

const formatFederationId = (id: string) => {
return `${id.slice(0, 6)}...${id.slice(-6)}`;
};

return (
<CardWithTitle>
<Card>
@@ -77,7 +81,10 @@ export const FedimintGatewayCard = ({
'Federation',
gatewayInfo.federations[0].config.meta.federation_name
)}
{renderLine('ID', gatewayInfo.federations[0].federation_id)}
{renderLine(
'ID',
formatFederationId(gatewayInfo.federations[0].federation_id)
)}
</div>
)}
</Card>