Skip to content

Commit

Permalink
become a provider in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
claireolmstead committed Mar 15, 2024
1 parent 1bdcb7a commit 5bd06bb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/components/BecomeAProvider.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import CreateProvider from './CreateProvider.svelte';
import EmailProviderRequest from './EmailProviderRequest.svelte';
import { pageContent } from '$lib/stores/pageContentStore';
import ActivityLogPreview from './ActivityLogPreview.svelte';
let newUser: Account | undefined;
Expand Down
25 changes: 17 additions & 8 deletions src/components/CreateMsa.svelte
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
<script lang="ts">
import type { web3Enable, web3FromSource } from '@polkadot/extension-dapp';
import { dotApi } from '$lib/stores';
import type { MsaInfo } from '$lib/storeTypes';
import { TxnStatus, type Activity, type MsaInfo } from '$lib/storeTypes';
import type { ApiPromise } from '@polkadot/api';
import { getExtension } from '$lib/utils';
import { submitCreateMsa } from '$lib/connections';
import TransactionStatus from '$components/TransactionStatus.svelte';
import { user } from '$lib/stores/userStore';
import { getMsaInfo } from '$lib/polkadotApi';
import { pageContent } from '$lib/stores/pageContentStore';
import LoadingIcon from '$lib/assets/LoadingIcon.svelte';
import ActivityLogPreviewItem from './ActivityLogPreviewItem.svelte';
import { activityLog } from '$lib/stores/activityLogStore';
export let updateUser: () => void;
export let txnStatuses: Array<string> = [];
// a callback for when the user cancels this action
export let cancelAction = () => {
pageContent.login();
};
let recentActivityItem: Activity;
$: {
if (isInProgress) recentActivityItem = $activityLog[0];
}
let isInProgress = false;
// a callback for when a transaction hits a final state
// TODO
let createMsaTxnFinished = async (succeeded: boolean, txnId: string) => {
let createMsaTxnFinished = async (succeeded: boolean) => {
if (succeeded) {
const apiPromise = $dotApi.api as ApiPromise;
const msaInfo: MsaInfo = await getMsaInfo(apiPromise, $user.address);
Expand All @@ -34,7 +40,7 @@
isInProgress = true;
await submitCreateMsa($dotApi.api, await getExtension($user), $user);
// createMsaTxnFinished()
await createMsaTxnFinished(recentActivityItem.txnStatus === TxnStatus.SUCCESS);
};
</script>

Expand All @@ -50,8 +56,11 @@
<LoadingIcon />
{:else}
Create an MSA
{/if}</button
>
{/if}
</button>
<button on:click|preventDefault={cancelAction} class="btn-no-fill">Cancel</button>
</form>
</div>
{#if recentActivityItem}
<ActivityLogPreviewItem activity={recentActivityItem} />
{/if}

0 comments on commit 5bd06bb

Please sign in to comment.