diff --git a/www/apps/frontend-e2e/src/e2e/app.cy.ts b/www/apps/frontend-e2e/src/e2e/app.cy.ts index 0235d03..a73422b 100644 --- a/www/apps/frontend-e2e/src/e2e/app.cy.ts +++ b/www/apps/frontend-e2e/src/e2e/app.cy.ts @@ -2,9 +2,9 @@ describe('deployer', () => { beforeEach(() => { cy.intercept('/api/users').as('getUsers'); - cy.intercept(/\/api\/deployer\/status\?apiUrl=http:\/\/.+\/rpc/).as('getStatus'); - cy.intercept(/\/api\/deployer\/peers\?apiUrl=http:\/\/.+\/rpc/).as('getPeers'); - cy.intercept(/\/api\/deployer\/getStateRootHash\?apiUrl=http:\/\/.+\/rpc/).as('getStateRootHash'); + cy.intercept(/\/api\/deployer\/status\?apiUrl=http:\/\/.+/).as('getStatus'); + cy.intercept(/\/api\/deployer\/peers\?apiUrl=http:\/\/.+/).as('getPeers'); + cy.intercept(/\/api\/deployer\/getStateRootHash\?apiUrl=http:\/\/.+/).as('getStateRootHash'); cy.visit('/'); }); diff --git a/www/libs/feature/deployer/src/lib/arg-builder/arg-builder.component.spec.ts b/www/libs/feature/deployer/src/lib/arg-builder/arg-builder.component.spec.ts index 0818e70..d38a1e7 100644 --- a/www/libs/feature/deployer/src/lib/arg-builder/arg-builder.component.spec.ts +++ b/www/libs/feature/deployer/src/lib/arg-builder/arg-builder.component.spec.ts @@ -1,14 +1,24 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ArgBuilderComponent } from './arg-builder.component'; +import { DeployerService } from '@casper-data/data-access-deployer'; describe('ArgBuilderComponent', () => { let component: ArgBuilderComponent; let fixture: ComponentFixture; + const getState = jest.fn().mockReturnValue({ subscribe: jest.fn() }); + beforeEach(async () => { await TestBed.configureTestingModule({ imports: [ArgBuilderComponent], + providers: [ + { + provide: DeployerService, useValue: { + getState, + } + }, + ] }).compileComponents(); fixture = TestBed.createComponent(ArgBuilderComponent); diff --git a/www/libs/feature/deployer/src/lib/arg-builder/tabs.ts b/www/libs/feature/deployer/src/lib/arg-builder/tabs.ts index d81a5ba..cd75e91 100644 --- a/www/libs/feature/deployer/src/lib/arg-builder/tabs.ts +++ b/www/libs/feature/deployer/src/lib/arg-builder/tabs.ts @@ -4,37 +4,37 @@ import { CLType } from 'casper-sdk'; const customArg: NamedCLTypeArg = { name: '', - cl_type: CLType.U8(), + cl_type: CLType?.U8(), }; const nameArg: NamedCLTypeArg = { name: 'name', - cl_type: CLType.String() + cl_type: CLType?.String() }; const symbolArg: NamedCLTypeArg = { name: 'symbol', - cl_type: CLType.String() + cl_type: CLType?.String() }; const decimalsArg: NamedCLTypeArg = { name: 'decimals', - cl_type: CLType.U8() + cl_type: CLType?.U8() }; const ownerArg: NamedCLTypeArg = { name: 'owner', - cl_type: CLType.Key() + cl_type: CLType?.Key() }; const spenderArg: NamedCLTypeArg = { name: 'spender', - cl_type: CLType.Key() + cl_type: CLType?.Key() }; const recipientArg: NamedCLTypeArg = { name: 'recipient', - cl_type: CLType.Key() + cl_type: CLType?.Key() }; export const defaultTabs: { @@ -52,46 +52,46 @@ export const defaultTabs: { { ...decimalsArg, install: true }, { name: 'total_supply', - cl_type: CLType.U64(), + cl_type: CLType?.U64(), install: true }, { name: 'enable_mint_burn', - cl_type: CLType.U8(), + cl_type: CLType?.U8(), install: true, optional: true }, { name: 'events_mode', - cl_type: CLType.U8(), + cl_type: CLType?.U8(), install: true, optional: true }, { name: 'admin_list', - cl_type: CLType.List(CLType.Key()), + cl_type: CLType?.List(CLType?.Key()), install: true, optional: true }, { name: 'minter_list', - cl_type: CLType.List(CLType.Key()), + cl_type: CLType?.List(CLType?.Key()), install: true, optional: true }, { name: 'none_list', - cl_type: CLType.List(CLType.Key()), + cl_type: CLType?.List(CLType?.Key()), install: true, optional: true }, { name: 'address', - cl_type: CLType.Key(), + cl_type: CLType?.Key(), }, { name: 'amount', - cl_type: CLType.U256(), + cl_type: CLType?.U256(), }, ownerArg, spenderArg, @@ -105,37 +105,37 @@ export const defaultTabs: { { ...symbolArg, install: true }, { name: 'meta', - cl_type: CLType.String(), + cl_type: CLType?.String(), install: true }, ownerArg, { name: 'token_id', - cl_type: CLType.U256() + cl_type: CLType?.U256() }, { name: 'token_meta', - cl_type: CLType.Map(CLType.String(), CLType.String()) + cl_type: CLType?.Map(CLType?.String(), CLType?.String()) }, { name: 'token_ids', - cl_type: CLType.List(CLType.U256()) + cl_type: CLType?.List(CLType?.U256()) }, { name: 'token_metas', - cl_type: CLType.List( - CLType.Map(CLType.String(), CLType.String()) + cl_type: CLType?.List( + CLType?.Map(CLType?.String(), CLType?.String()) ) }, recipientArg, { name: 'count', - cl_type: CLType.U32() + cl_type: CLType?.U32() }, spenderArg, { name: 'index', - cl_type: CLType.U256() + cl_type: CLType?.U256() }, ] }, @@ -143,188 +143,188 @@ export const defaultTabs: { name: Tabs['CEP-78'], types: [{ name: 'collection_name', - cl_type: CLType.String(), + cl_type: CLType?.String(), install: true, upgrade: true }, { name: 'collection_symbol', - cl_type: CLType.String(), + cl_type: CLType?.String(), install: true }, { name: 'total_token_supply', - cl_type: CLType.U64(), + cl_type: CLType?.U64(), install: true }, { name: 'allow_minting', - cl_type: CLType.Bool(), + cl_type: CLType?.Bool(), install: true, optional: true }, { name: 'minting_mode', - cl_type: CLType.U8(), + cl_type: CLType?.U8(), install: true, optional: true }, { name: 'ownership_mode', - cl_type: CLType.U8(), + cl_type: CLType?.U8(), install: true, }, { name: 'nft_kind', - cl_type: CLType.U8(), + cl_type: CLType?.U8(), install: true, }, { name: 'nft_metadata_kind', - cl_type: CLType.U8(), + cl_type: CLType?.U8(), install: true, }, { name: 'metadata_mutability', - cl_type: CLType.U8(), + cl_type: CLType?.U8(), install: true, }, { name: 'holder_mode', - cl_type: CLType.U8(), + cl_type: CLType?.U8(), install: true, optional: true }, { name: 'owner_reverse_lookup_mode', - cl_type: CLType.U8(), + cl_type: CLType?.U8(), install: true, optional: true }, { name: 'token_id', - cl_type: CLType.U256() + cl_type: CLType?.U256() }, { name: 'token_hash', - cl_type: CLType.Key() + cl_type: CLType?.Key() }, { name: 'named_key_convention', - cl_type: CLType.U8(), + cl_type: CLType?.U8(), upgrade: true }, { name: 'whitelist_mode', - cl_type: CLType.U8(), + cl_type: CLType?.U8(), optional: true, install: true, }, { name: 'identifier_mode', - cl_type: CLType.U8(), + cl_type: CLType?.U8(), install: true, entry_point: true }, { name: 'burn_mode', - cl_type: CLType.U8(), + cl_type: CLType?.U8(), install: true, optional: true }, { name: 'operator_burn_mode', - cl_type: CLType.U8(), + cl_type: CLType?.U8(), install: true, optional: true, upgrade: true }, { name: 'json_schema', - cl_type: CLType.String(), + cl_type: CLType?.String(), install: true, optional: true }, { name: 'receipt_name', - cl_type: CLType.String() + cl_type: CLType?.String() }, { name: 'token_owner', - cl_type: CLType.Key() + cl_type: CLType?.Key() }, { name: 'token_meta_data', - cl_type: CLType.String() + cl_type: CLType?.String() }, { name: 'source_key', - cl_type: CLType.Key() + cl_type: CLType?.Key() }, { name: 'target_key', - cl_type: CLType.Key() + cl_type: CLType?.Key() }, { name: 'operator', - cl_type: CLType.Key() + cl_type: CLType?.Key() }, { name: 'approve_all', - cl_type: CLType.Bool() + cl_type: CLType?.Bool() }, { name: 'access_key_name', - cl_type: CLType.String(), + cl_type: CLType?.String(), upgrade: true }, { name: 'hash_key_name', - cl_type: CLType.String(), + cl_type: CLType?.String(), upgrade: true }, { name: 'acl_white_list', - cl_type: CLType.List(CLType.Key()), + cl_type: CLType?.List(CLType?.Key()), install: true, optional: true }, { name: 'acl_package_mode', - cl_type: CLType.Bool(), + cl_type: CLType?.Bool(), install: true, optional: true, upgrade: true }, { name: 'package_operator_mode', - cl_type: CLType.Bool(), + cl_type: CLType?.Bool(), install: true, optional: true, upgrade: true }, { name: 'additional_required_metadata', - cl_type: CLType.List(CLType.U8()), + cl_type: CLType?.List(CLType?.U8()), install: true, optional: true }, { name: 'optional_metadata', - cl_type: CLType.List(CLType.U8()), + cl_type: CLType?.List(CLType?.U8()), install: true, optional: true }, { name: 'events_mode', - cl_type: CLType.U8(), + cl_type: CLType?.U8(), install: true, optional: true, upgrade: true }, { name: 'transfer_filter_contract', - cl_type: CLType.Key(), + cl_type: CLType?.Key(), install: true, optional: true }, @@ -340,13 +340,13 @@ export const defaultTabs: { }, { name: 'uri', - cl_type: CLType.String(), + cl_type: CLType?.String(), install: true, entry_point: true }, { name: 'events_mode', - cl_type: CLType.U8(), + cl_type: CLType?.U8(), install: true, optional: true, upgrade: true, @@ -354,116 +354,116 @@ export const defaultTabs: { }, { name: 'enable_burn', - cl_type: CLType.Bool(), + cl_type: CLType?.Bool(), install: true, optional: true, entry_point: true }, { name: 'transfer_filter_contract', - cl_type: CLType.Key(), + cl_type: CLType?.Key(), install: true, optional: true }, { name: 'transfer_filter_method', - cl_type: CLType.String(), + cl_type: CLType?.String(), install: true, optional: true }, { name: 'admin_list', - cl_type: CLType.List(CLType.Key()), + cl_type: CLType?.List(CLType?.Key()), install: true, optional: true, entry_point: true }, { name: 'minter_list', - cl_type: CLType.List(CLType.Key()), + cl_type: CLType?.List(CLType?.Key()), install: true, optional: true, entry_point: true }, { name: 'burner_list', - cl_type: CLType.List(CLType.Key()), + cl_type: CLType?.List(CLType?.Key()), install: true, optional: true, entry_point: true }, { name: 'meta_list', - cl_type: CLType.List(CLType.Key()), + cl_type: CLType?.List(CLType?.Key()), install: true, optional: true, entry_point: true }, { name: 'none_list', - cl_type: CLType.List(CLType.Key()), + cl_type: CLType?.List(CLType?.Key()), install: true, optional: true, entry_point: true }, { name: 'package_hash', - cl_type: CLType.Key(), + cl_type: CLType?.Key(), upgrade: true, }, recipientArg, ownerArg, { name: 'id', - cl_type: CLType.U256(), + cl_type: CLType?.U256(), }, { name: 'amount', - cl_type: CLType.U256(), + cl_type: CLType?.U256(), }, { name: 'ids', - cl_type: CLType.List(CLType.U256()), + cl_type: CLType?.List(CLType?.U256()), }, { name: 'amounts', - cl_type: CLType.List(CLType.U256()), + cl_type: CLType?.List(CLType?.U256()), }, { name: 'account', - cl_type: CLType.Key(), + cl_type: CLType?.Key(), }, { name: 'accounts', - cl_type: CLType.List(CLType.Key()), + cl_type: CLType?.List(CLType?.Key()), }, { name: 'operator', - cl_type: CLType.Key() + cl_type: CLType?.Key() }, { name: 'approved', - cl_type: CLType.Bool() + cl_type: CLType?.Bool() }, { name: 'from', - cl_type: CLType.Key() + cl_type: CLType?.Key() }, { name: 'to', - cl_type: CLType.Key() + cl_type: CLType?.Key() }, { name: 'data', - cl_type: CLType.ByteArray() + cl_type: CLType?.ByteArray() }, { name: 'total_supply', - cl_type: CLType.U256(), + cl_type: CLType?.U256(), }, { name: 'total_supplies', - cl_type: CLType.List(CLType.U256()), + cl_type: CLType?.List(CLType?.U256()), }, ] } diff --git a/www/libs/feature/deployer/src/lib/transfer/transfer.component.spec.ts b/www/libs/feature/deployer/src/lib/transfer/transfer.component.spec.ts index dcc0a09..5087922 100644 --- a/www/libs/feature/deployer/src/lib/transfer/transfer.component.spec.ts +++ b/www/libs/feature/deployer/src/lib/transfer/transfer.component.spec.ts @@ -8,6 +8,7 @@ import { TOASTER_TOKEN } from '@casper-util/toaster'; import { ResultService } from '../result/result.service'; import { TransferComponent } from './transfer.component'; +import { SDK_TOKEN } from '@casper-util/wasm'; describe('TransferComponent', () => { let component: TransferComponent; @@ -22,6 +23,9 @@ describe('TransferComponent', () => { { provide: ENV_CONFIG, useValue: config }, + { + provide: SDK_TOKEN, useValue: {}, + }, { provide: HIGHLIGHT_WEBWORKER_FACTORY, useValue: { HIGHLIGHT_WEBWORKER_FACTORY diff --git a/www/libs/ui/argument/src/lib/argument/argument.component.ts b/www/libs/ui/argument/src/lib/argument/argument.component.ts index 28a45db..d6bd27a 100644 --- a/www/libs/ui/argument/src/lib/argument/argument.component.ts +++ b/www/libs/ui/argument/src/lib/argument/argument.component.ts @@ -14,8 +14,8 @@ import { NamedCLTypeArg } from '@casper-api/api-interfaces'; export class ArgumentComponent { @Input() defaultType: NamedCLTypeArg = { name: '', - cl_type: CLType.U8(), + cl_type: CLType?.U8(), }; CLTypeEnum = CLTypeEnum; - types = Object.keys(this.CLTypeEnum).filter(key => isNaN(Number(key))); + types = Object.keys(this.CLTypeEnum || {}).filter(key => isNaN(Number(key))); } diff --git a/www/libs/ui/tabs/src/lib/tabs/tabs.component.ts b/www/libs/ui/tabs/src/lib/tabs/tabs.component.ts index 0d784fb..36964b9 100644 --- a/www/libs/ui/tabs/src/lib/tabs/tabs.component.ts +++ b/www/libs/ui/tabs/src/lib/tabs/tabs.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core'; import { CommonModule } from '@angular/common'; import { Tabs } from './tabs'; diff --git a/www/libs/util/services/watcher/src/lib/watcher.service.ts b/www/libs/util/services/watcher/src/lib/watcher.service.ts index cdba32d..2150369 100644 --- a/www/libs/util/services/watcher/src/lib/watcher.service.ts +++ b/www/libs/util/services/watcher/src/lib/watcher.service.ts @@ -16,9 +16,7 @@ export class WatcherService { watchDeploy(deployHash: string, apiUrl?: string) { const config = this.config; apiUrl = apiUrl?.replace(config['rpc_port'], config['sse_port']); - console.log(apiUrl); let eventsUrl = apiUrl?.includes(config['localhost']) ? config['eventsUrl_localhost'] : ''; - console.log(eventsUrl); eventsUrl += apiUrl?.includes(config['localhost']) ? config['events_main_suffix'] : [ @@ -28,7 +26,6 @@ export class WatcherService { this.api_url, '=', apiUrl, ].join(''); - console.log(eventsUrl); const watcher = new DeployWatcher(eventsUrl || config['eventsUrl_default']); try { const eventHandlerFn = (eventParseResult: EventParseResult) => {