forked from leather-io/extension
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: clean up, restructure, dead code
- Loading branch information
Showing
108 changed files
with
1,319 additions
and
1,436 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { fetcher } from '@common/api/wrapped-fetch'; | ||
|
||
export async function fetchNamesByAddress(networkUrl: string, address: string): Promise<string[]> { | ||
const res = await fetcher(networkUrl + `/v1/addresses/stacks/${address}`); | ||
const data = await res.json(); | ||
return data?.names || []; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/common/hooks/use-account-balances.ts → ...mon/hooks/account/use-account-balances.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/common/hooks/use-account-info.ts → src/common/hooks/account/use-account-info.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/common/hooks/use-account-names.ts → ...common/hooks/account/use-account-names.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
src/common/hooks/use-switch-account.ts → ...ommon/hooks/account/use-switch-account.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { useAuthRequest } from '@common/hooks/auth/use-auth-request'; | ||
|
||
export const useAppDetails = () => { | ||
const { appName: name, appIcon: icon, appURL: url } = useAuthRequest(); | ||
return { name, icon, url }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { useRecoilValue } from 'recoil'; | ||
import { authRequestState } from '@store/onboarding'; | ||
|
||
export function useAuthRequest() { | ||
return useRecoilValue(authRequestState); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { useWallet } from '@common/hooks/use-wallet'; | ||
import { useRecoilCallback, waitForAll } from 'recoil'; | ||
import { currentAccountState } from '@store/accounts'; | ||
import { | ||
pendingTransactionState, | ||
signedTransactionState, | ||
transactionBroadcastErrorState, | ||
} from '@store/transactions'; | ||
import { requestTokenState } from '@store/transactions/requests'; | ||
import { currentNetworkState } from '@store/networks'; | ||
import { finalizeTxSignature } from '@common/utils'; | ||
import { handleBroadcastTransaction } from '@common/transactions/transactions'; | ||
|
||
export function useTransactionBroadcast() { | ||
const { doSetLatestNonce } = useWallet(); | ||
return useRecoilCallback( | ||
({ snapshot, set }) => | ||
async () => { | ||
const { account, signedTransaction, pendingTransaction, requestToken, network } = | ||
await snapshot.getPromise( | ||
waitForAll({ | ||
signedTransaction: signedTransactionState, | ||
account: currentAccountState, | ||
pendingTransaction: pendingTransactionState, | ||
requestToken: requestTokenState, | ||
network: currentNetworkState, | ||
}) | ||
); | ||
|
||
if (!pendingTransaction || !account || !requestToken || !signedTransaction) { | ||
set(transactionBroadcastErrorState, 'No pending transaction found.'); | ||
return; | ||
} | ||
|
||
try { | ||
const result = await handleBroadcastTransaction( | ||
signedTransaction, | ||
pendingTransaction, | ||
network.url | ||
); | ||
await doSetLatestNonce(signedTransaction); | ||
finalizeTxSignature(requestToken, result); | ||
} catch (error) { | ||
set(transactionBroadcastErrorState, error.message); | ||
} | ||
}, | ||
[doSetLatestNonce] | ||
); | ||
} |
11 changes: 7 additions & 4 deletions
11
src/common/hooks/use-transaction-error.ts → ...ooks/transaction/use-transaction-error.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/common/hooks/use-transaction-fee.ts → .../hooks/transaction/use-transaction-fee.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ommon/hooks/use-transaction-page-title.ts → ...transaction/use-transaction-page-title.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.