Skip to content

Commit

Permalink
feat: fetch account info after badge added
Browse files Browse the repository at this point in the history
  • Loading branch information
dawidsowardx committed Dec 21, 2022
1 parent 0ad5783 commit 1b4312d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/components/deploy-package/DeployPackage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
text: ``,
type: 'success'
})()
send({
type: 'SELECT_ACCOUNT'
})
}
$: if (
Expand Down
10 changes: 8 additions & 2 deletions src/components/deploy-package/deploy-package-state-machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ type Context = {
type Events =
| { type: 'UPLOAD_FILES'; abi: File; wasm: File }
| { type: 'REMOVE_FILE' }
| { type: 'SELECT_ACCOUNT'; address: string }
| { type: 'SELECT_ACCOUNT'; address?: string }
| { type: 'SELECT_BADGE'; index: number }
| { type: 'CREATE_BADGE' }
| { type: 'DEPLOY' }
Expand Down Expand Up @@ -165,7 +165,13 @@ export const stateMachine = createMachine<Context, Events, States>(
SELECT_ACCOUNT: {
target: ['.selecting-account.selected', '.selecting-badge.idle'],
actions: assign({
selectedAccountAddress: (_, event) => event.address,
selectedAccountAddress: (context, event) => {
if (!event.address) {
return context.selectedAccountAddress
}

return event.address
},
selectedNft: (_, __) => undefined,
non_fungible_resources: (_, __) => []
})
Expand Down

0 comments on commit 1b4312d

Please sign in to comment.