1- import { Contract , ContractBuilder } from './contract' ;
2- import { CommonOptions , withCommonDefaults } from './common-options' ;
1+ import type { Contract } from './contract' ;
2+ import { ContractBuilder } from './contract' ;
3+ import type { CommonOptions } from './common-options' ;
4+ import { withCommonDefaults } from './common-options' ;
35import { defaults as commonDefaults } from './common-options' ;
46import { setAccountUpgradeable } from './set-upgradeable' ;
57import { setInfo } from './set-info' ;
68import { defineComponents } from './utils/define-components' ;
79import { printContract } from './print' ;
810import { addSRC5Component } from './common-components' ;
911
10-
1112export const accountTypes = [ 'stark' , 'eth' ] as const ;
12- export type Account = typeof accountTypes [ number ] ;
13+ export type Account = ( typeof accountTypes ) [ number ] ;
1314
1415export const defaults : Required < AccountOptions > = {
1516 name : 'MyAccount' ,
@@ -19,7 +20,7 @@ export const defaults: Required<AccountOptions> = {
1920 pubkey : true ,
2021 outsideExecution : true ,
2122 upgradeable : commonDefaults . upgradeable ,
22- info : commonDefaults . info
23+ info : commonDefaults . info ,
2324} as const ;
2425
2526export function printAccount ( opts : AccountOptions = defaults ) : string {
@@ -42,8 +43,8 @@ function withDefaults(opts: AccountOptions): Required<AccountOptions> {
4243 declare : opts . declare ?? defaults . declare ,
4344 deploy : opts . deploy ?? defaults . deploy ,
4445 pubkey : opts . pubkey ?? defaults . pubkey ,
45- outsideExecution : opts . outsideExecution ?? defaults . outsideExecution
46- }
46+ outsideExecution : opts . outsideExecution ?? defaults . outsideExecution ,
47+ } ;
4748}
4849
4950export function buildAccount ( opts : AccountOptions ) : Contract {
@@ -157,11 +158,14 @@ function addAccountMixin(c: ContractBuilder, accountType: Account) {
157158}
158159
159160function getBaseCompAndCompType ( accountType : Account ) : [ string , typeof componentType ] {
160- const [ baseComponent , componentType ] = accountType === 'stark' ? [ 'AccountComponent' , components . AccountComponent ] : [ 'EthAccountComponent' , components . EthAccountComponent ] ;
161+ const [ baseComponent , componentType ] =
162+ accountType === 'stark'
163+ ? [ 'AccountComponent' , components . AccountComponent ]
164+ : [ 'EthAccountComponent' , components . EthAccountComponent ] ;
161165 return [ baseComponent , componentType ] ;
162166}
163167
164- const components = defineComponents ( {
168+ const components = defineComponents ( {
165169 AccountComponent : {
166170 path : 'openzeppelin::account' ,
167171 substorage : {
@@ -172,11 +176,13 @@ const components = defineComponents( {
172176 name : 'AccountEvent' ,
173177 type : 'AccountComponent::Event' ,
174178 } ,
175- impls : [ {
176- name : 'AccountInternalImpl' ,
177- embed : false ,
178- value : 'AccountComponent::InternalImpl<ContractState>' ,
179- } ] ,
179+ impls : [
180+ {
181+ name : 'AccountInternalImpl' ,
182+ embed : false ,
183+ value : 'AccountComponent::InternalImpl<ContractState>' ,
184+ } ,
185+ ] ,
180186 } ,
181187 EthAccountComponent : {
182188 path : 'openzeppelin::account::eth_account' ,
@@ -188,11 +194,13 @@ const components = defineComponents( {
188194 name : 'EthAccountEvent' ,
189195 type : 'EthAccountComponent::Event' ,
190196 } ,
191- impls : [ {
192- name : 'EthAccountInternalImpl' ,
193- embed : false ,
194- value : 'EthAccountComponent::InternalImpl<ContractState>' ,
195- } ]
197+ impls : [
198+ {
199+ name : 'EthAccountInternalImpl' ,
200+ embed : false ,
201+ value : 'EthAccountComponent::InternalImpl<ContractState>' ,
202+ } ,
203+ ] ,
196204 } ,
197205 SRC9Component : {
198206 path : 'openzeppelin::account::extensions' ,
@@ -204,13 +212,16 @@ const components = defineComponents( {
204212 name : 'SRC9Event' ,
205213 type : 'SRC9Component::Event' ,
206214 } ,
207- impls : [ {
208- name : 'OutsideExecutionV2Impl' ,
209- value : 'SRC9Component::OutsideExecutionV2Impl<ContractState>' ,
210- } , {
211- name : 'OutsideExecutionInternalImpl' ,
212- embed : false ,
213- value : 'SRC9Component::InternalImpl<ContractState>' ,
214- } ]
215- }
215+ impls : [
216+ {
217+ name : 'OutsideExecutionV2Impl' ,
218+ value : 'SRC9Component::OutsideExecutionV2Impl<ContractState>' ,
219+ } ,
220+ {
221+ name : 'OutsideExecutionInternalImpl' ,
222+ embed : false ,
223+ value : 'SRC9Component::InternalImpl<ContractState>' ,
224+ } ,
225+ ] ,
226+ } ,
216227} ) ;
0 commit comments