Skip to content

Commit

Permalink
fix: passing selected plugin to renderer when applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
dafuga committed Nov 8, 2023
1 parent bbd9118 commit d6ee816
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/account-creation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export interface CreateAccountResponse {
}

export interface CreateAccountContextOptions {
accountCreationPlugin?: AccountCreationPlugin
accountCreationPlugins?: AccountCreationPlugin[]
appName?: NameType
// client: APIClient
Expand All @@ -81,6 +82,7 @@ export interface UserInterfaceAccountCreationRequirements {
}

export class CreateAccountContext {
accountCreationPlugin?: AccountCreationPlugin
accountCreationPlugins: AccountCreationPlugin[] = []
appName?: string
chain?: ChainDefinition
Expand All @@ -105,6 +107,9 @@ export class CreateAccountContext {
if (options.accountCreationPlugins) {
this.accountCreationPlugins = options.accountCreationPlugins
}
if (options.accountCreationPlugin) {
this.accountCreationPlugin = options.accountCreationPlugin
}
if (options.uiRequirements) {
this.uiRequirements = options.uiRequirements
}
Expand Down
3 changes: 2 additions & 1 deletion src/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export class SessionKit {
throw new Error('No account creation plugins available.')
}

// Eestablish defaults based on options
// Establish defaults based on options
let chain = options?.chain
let requiresChainSelect = !chain
let requiresPluginSelect = !options?.pluginId
Expand Down Expand Up @@ -212,6 +212,7 @@ export class SessionKit {
}

const context = new CreateAccountContext({
accountCreationPlugin,
accountCreationPlugins: this.accountCreationPlugins,
appName: this.appName,
chain,
Expand Down

0 comments on commit d6ee816

Please sign in to comment.