create-near-app 2.0.1 → 3.0.0-pre.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/{common/contracts → contracts}/assemblyscript/README.md +1 -2
  2. package/{common/contracts → contracts}/assemblyscript/as-pect.config.js +0 -0
  3. package/{common/contracts → contracts}/assemblyscript/asconfig.json +0 -0
  4. package/{common/contracts → contracts}/assemblyscript/assembly/__tests__/as-pect.d.ts +0 -0
  5. package/contracts/assemblyscript/assembly/__tests__/main.spec.ts +11 -0
  6. package/{common/contracts → contracts}/assemblyscript/assembly/as_types.d.ts +0 -0
  7. package/contracts/assemblyscript/assembly/index.ts +23 -0
  8. package/{common/contracts → contracts}/assemblyscript/assembly/tsconfig.json +0 -0
  9. package/{common/contracts → contracts}/assemblyscript/package.json +2 -6
  10. package/{common/contracts → contracts}/rust/.cargo/config +0 -0
  11. package/{common/contracts → contracts}/rust/Cargo.toml +4 -5
  12. package/{common/contracts → contracts}/rust/README.md +1 -2
  13. package/contracts/rust/src/lib.rs +72 -0
  14. package/index.js +50 -73
  15. package/integration-tests/rs/Cargo.toml +22 -0
  16. package/integration-tests/rs/src/tests.rs +66 -0
  17. package/integration-tests/ts/ava.config.cjs +9 -0
  18. package/integration-tests/ts/package.json +16 -0
  19. package/integration-tests/ts/src/main.ava.ts +44 -0
  20. package/package.json +23 -24
  21. package/templates/react/README.md +2 -2
  22. package/templates/react/ava.config.cjs +9 -0
  23. package/templates/react/{src → frontend}/App.js +34 -29
  24. package/templates/react/{src → frontend}/__mocks__/fileMock.js +0 -0
  25. package/{common/frontend → templates/react/frontend/assets/css}/global.css +4 -3
  26. package/{common/frontend/assets → templates/react/frontend/assets/img}/favicon.ico +0 -0
  27. package/{common/frontend/assets → templates/react/frontend/assets/img}/logo-black.svg +0 -0
  28. package/{common/frontend/assets → templates/react/frontend/assets/img}/logo-white.svg +0 -0
  29. package/templates/react/{src → frontend/assets/js/near}/config.js +1 -1
  30. package/templates/{vue/src → react/frontend/assets/js/near}/utils.js +14 -4
  31. package/templates/react/{src → frontend}/index.html +3 -3
  32. package/templates/react/frontend/index.js +14 -0
  33. package/templates/react/near.gitignore +1 -1
  34. package/templates/react/package.json +29 -43
  35. package/templates/vanilla/README.md +2 -2
  36. package/templates/vanilla/frontend/assets/css/global.css +189 -0
  37. package/templates/vanilla/frontend/assets/img/favicon.ico +0 -0
  38. package/templates/vanilla/frontend/assets/img/logo-black.svg +1 -0
  39. package/templates/vanilla/frontend/assets/img/logo-white.svg +1 -0
  40. package/templates/vanilla/frontend/assets/js/index.js +74 -0
  41. package/templates/vanilla/{src → frontend/assets/js/near}/config.js +1 -1
  42. package/templates/{angular/src → vanilla/frontend/assets/js/near}/utils.js +14 -4
  43. package/templates/vanilla/{src → frontend}/index.html +22 -27
  44. package/templates/vanilla/near.gitignore +1 -1
  45. package/templates/vanilla/package.json +25 -31
  46. package/utils/rust-setup.js +1 -20
  47. package/utils/tracking.js +1 -2
  48. package/common/contracts/assemblyscript/assembly/__tests__/main.spec.ts +0 -9
  49. package/common/contracts/assemblyscript/assembly/index.ts +0 -34
  50. package/common/contracts/assemblyscript/compile.js +0 -50
  51. package/common/contracts/rust/Cargo.lock +0 -638
  52. package/common/contracts/rust/compile.js +0 -53
  53. package/common/contracts/rust/res/.gitkeep +0 -0
  54. package/common/contracts/rust/src/lib.rs +0 -121
  55. package/templates/angular/.gitpod.yml +0 -6
  56. package/templates/angular/README.md +0 -102
  57. package/templates/angular/angular.json +0 -126
  58. package/templates/angular/extra-webpack.config.ts +0 -7
  59. package/templates/angular/karma.conf.js +0 -40
  60. package/templates/angular/near.gitignore +0 -46
  61. package/templates/angular/neardev/shared-test/test.near.json +0 -1
  62. package/templates/angular/neardev/shared-test-staging/test.near.json +0 -1
  63. package/templates/angular/package.json +0 -63
  64. package/templates/angular/set-contract-name.js +0 -16
  65. package/templates/angular/src/app/app.component.html +0 -87
  66. package/templates/angular/src/app/app.component.spec.ts +0 -107
  67. package/templates/angular/src/app/app.component.ts +0 -88
  68. package/templates/angular/src/app/app.module.ts +0 -21
  69. package/templates/angular/src/app/components/notification/notification.component.html +0 -12
  70. package/templates/angular/src/app/components/notification/notification.component.spec.ts +0 -25
  71. package/templates/angular/src/app/components/notification/notification.component.ts +0 -23
  72. package/templates/angular/src/app/services/window.service.ts +0 -43
  73. package/templates/angular/src/config.d.ts +0 -13
  74. package/templates/angular/src/config.js +0 -62
  75. package/templates/angular/src/contract-name.js +0 -1
  76. package/templates/angular/src/environments/environment.prod.ts +0 -3
  77. package/templates/angular/src/environments/environment.ts +0 -16
  78. package/templates/angular/src/index.html +0 -15
  79. package/templates/angular/src/main.ts +0 -15
  80. package/templates/angular/src/polyfills.ts +0 -64
  81. package/templates/angular/src/styles.scss +0 -1
  82. package/templates/angular/src/test.ts +0 -25
  83. package/templates/angular/src/utils.d.ts +0 -3
  84. package/templates/angular/src/window.d.ts +0 -15
  85. package/templates/angular/tsconfig.app.json +0 -15
  86. package/templates/angular/tsconfig.json +0 -21
  87. package/templates/angular/tsconfig.spec.json +0 -18
  88. package/templates/angular/tslint.json +0 -149
  89. package/templates/react/babel.config.js +0 -3
  90. package/templates/react/neardev/shared-test-staging/test.near.json +0 -1
  91. package/templates/react/src/index.js +0 -13
  92. package/templates/react/src/jest.init.js +0 -1
  93. package/templates/react/src/main.test.js +0 -28
  94. package/templates/react/src/utils.js +0 -39
  95. package/templates/react/src/wallet/login/index.html +0 -28
  96. package/templates/vanilla/neardev/shared-test-staging/test.near.json +0 -1
  97. package/templates/vanilla/src/index.js +0 -113
  98. package/templates/vanilla/src/main.test.js +0 -15
  99. package/templates/vanilla/src/utils.js +0 -39
  100. package/templates/vanilla/src/wallet/login/index.html +0 -28
  101. package/templates/vue/.gitpod.yml +0 -6
  102. package/templates/vue/README.md +0 -101
  103. package/templates/vue/babel.config.js +0 -5
  104. package/templates/vue/copy-dev-account.js +0 -7
  105. package/templates/vue/jest.config.js +0 -7
  106. package/templates/vue/near.gitignore +0 -46
  107. package/templates/vue/neardev/shared-test/test.near.json +0 -1
  108. package/templates/vue/neardev/shared-test-staging/test.near.json +0 -1
  109. package/templates/vue/package.json +0 -86
  110. package/templates/vue/src/App.vue +0 -37
  111. package/templates/vue/src/components/Notification.vue +0 -38
  112. package/templates/vue/src/components/SignedIn.vue +0 -179
  113. package/templates/vue/src/components/SignedOut.vue +0 -34
  114. package/templates/vue/src/config.js +0 -63
  115. package/templates/vue/src/main.js +0 -16
  116. package/templates/vue/tests/unit/Notification.spec.js +0 -26
  117. package/templates/vue/tests/unit/SignedIn.spec.js +0 -24
  118. package/templates/vue/tests/unit/SignedOut.spec.js +0 -17
@@ -1,107 +0,0 @@
1
- import { TestBed, ComponentFixture, waitForAsync } from '@angular/core/testing'
2
- import { FormsModule } from '@angular/forms'
3
- import { By } from '@angular/platform-browser'
4
-
5
- import { setUpTestConnection, generateUniqueString, createAccount } from 'near-api-js/test/test-utils'
6
- import { WalletConnection } from 'near-api-js'
7
-
8
- import { AppComponent } from './app.component'
9
- import { WINDOW } from './services/window.service'
10
-
11
- describe('AppComponent', () => {
12
- let app: AppComponent
13
- let fixture: ComponentFixture<AppComponent>
14
- let spyWindow: jasmine.SpyObj<Window>
15
- let mockWindow
16
-
17
- beforeAll(waitForAsync(async (): Promise<void> => {
18
- const near = await setUpTestConnection()
19
- const walletConnection = new WalletConnection(near, 'test')
20
-
21
- mockWindow = {
22
- accountId: 'test.near',
23
- contract: {
24
- account: createAccount(near),
25
- contractId: generateUniqueString('test'),
26
- getGreeting(): string {
27
- return 'Hello'
28
- },
29
- setGreeting(): void {}
30
- },
31
- walletConnection
32
- }
33
- }))
34
-
35
- beforeEach(waitForAsync(() => {
36
- TestBed.configureTestingModule({
37
- imports: [FormsModule],
38
- declarations: [
39
- AppComponent
40
- ],
41
- providers: [
42
- {
43
- provide: WINDOW,
44
- useValue: mockWindow
45
- }
46
- ]
47
- }).compileComponents()
48
- }))
49
-
50
- beforeEach(() => {
51
- fixture = TestBed.createComponent(AppComponent)
52
- app = fixture.componentInstance
53
- spyWindow = TestBed.inject(WINDOW) as jasmine.SpyObj<Window>
54
- fixture.detectChanges()
55
- })
56
-
57
- it('should create the app', () => {
58
- expect(app).toBeTruthy()
59
- })
60
-
61
- describe('signedOut', () => {
62
- it('should display welcome message', () => {
63
- const compiled = fixture.nativeElement
64
- const h1 = compiled.querySelector('main h1')
65
-
66
- expect(h1.textContent).toContain('Welcome to NEAR!')
67
- })
68
-
69
- it('should call the `login` method on `Sign in` action', () => {
70
- const btn = fixture.debugElement.queryAll(By.css('button')).find(el => el.nativeElement.textContent === 'Sign in')
71
- const spyLogin = spyOn(app, 'login')
72
- btn.triggerEventHandler('click', null)
73
-
74
- expect(spyLogin).toHaveBeenCalledTimes(1)
75
- })
76
- })
77
-
78
- describe('signedIn', () => {
79
- beforeEach(async () => {
80
- spyOn(spyWindow.walletConnection, 'isSignedIn').and.returnValue(true)
81
- spyOn(spyWindow.walletConnection, 'getAccountId').and.returnValue('test.near')
82
- await app.fetchGreeting()
83
- fixture.detectChanges()
84
- })
85
-
86
- it('should display greeting text', () => {
87
- const compiled = fixture.nativeElement
88
- const h1 = compiled.querySelector('main h1')
89
-
90
- expect(h1.textContent).toContain('Hello test.near')
91
- })
92
-
93
- it('should call the `logout` method on `Sign out` action', () => {
94
- const btn = fixture.debugElement.queryAll(By.css('button')).find(el => el.nativeElement.textContent === 'Sign out')
95
- const spyLogout = spyOn(app, 'logout')
96
- btn.triggerEventHandler('click', null)
97
-
98
- expect(spyLogout).toHaveBeenCalledTimes(1)
99
- })
100
-
101
- it('should contain the current greeting value', () => {
102
- const input = fixture.debugElement.query(By.css('input#greeting'))
103
-
104
- expect(input.nativeElement.value).toBe('Hello')
105
- })
106
- })
107
- })
@@ -1,88 +0,0 @@
1
- import { Component, Inject, OnInit } from '@angular/core'
2
-
3
- import { login, logout } from '../utils'
4
- import { WINDOW } from './services/window.service'
5
-
6
- @Component({
7
- selector: 'app-root',
8
- templateUrl: './app.component.html'
9
- })
10
- export class AppComponent implements OnInit {
11
- greeting: string
12
- newGreeting: string
13
- showNotification = false
14
-
15
- get accountId(): string {
16
- return this.window.walletConnection.getAccountId()
17
- }
18
-
19
- get signedIn(): boolean {
20
- return this.window.walletConnection.isSignedIn()
21
- }
22
-
23
- get contractId(): string {
24
- return this.window.contract.contractId
25
- }
26
-
27
- get buttonDisabled(): boolean {
28
- const newGreeting = this.newGreeting?.trim()
29
- return !newGreeting || newGreeting === this.greeting
30
- }
31
-
32
- constructor(@Inject(WINDOW) private window: Window) {}
33
-
34
- ngOnInit(): void {
35
- this.fetchGreeting()
36
- }
37
-
38
- login(): void {
39
- login()
40
- }
41
-
42
- logout(): void {
43
- logout()
44
- }
45
-
46
- async fetchGreeting(): Promise<void> {
47
- if (this.signedIn) {
48
- this.greeting = this.newGreeting = await this.window.contract.getGreeting({ accountId: this.accountId })
49
- }
50
- }
51
-
52
- async onSubmit(event): Promise<void> {
53
- event.preventDefault()
54
-
55
- // get elements from the form using their id attribute
56
- const { fieldset, greeting } = event.target.elements
57
-
58
- // disable the form while the value gets updated on-chain
59
- fieldset.disabled = true
60
-
61
- try {
62
- // make an update call to the smart contract
63
- await this.window.contract.setGreeting({ message: greeting.value })
64
- } catch (e) {
65
- alert(
66
- 'Something went wrong! ' +
67
- 'Maybe you need to sign out and back in? ' +
68
- 'Check your browser console for more info.'
69
- )
70
- throw e
71
- } finally {
72
- // re-enable the form, whether the call succeeded or failed
73
- fieldset.disabled = false
74
- }
75
-
76
- // update local `greeting` variable to match persisted value
77
- this.greeting = this.newGreeting
78
-
79
- // show notification
80
- this.showNotification = true
81
-
82
- // remove notification again after css animation completes
83
- // this allows it to be shown again next time the form is submitted
84
- setTimeout(() => {
85
- this.showNotification = false
86
- }, 11000)
87
- }
88
- }
@@ -1,21 +0,0 @@
1
- import { BrowserModule } from '@angular/platform-browser'
2
- import { NgModule } from '@angular/core'
3
- import { FormsModule } from '@angular/forms'
4
-
5
- import { AppComponent } from './app.component'
6
- import { NotificationComponent } from './components/notification/notification.component'
7
- import { WINDOW_PROVIDERS } from './services/window.service'
8
-
9
- @NgModule({
10
- declarations: [
11
- AppComponent,
12
- NotificationComponent
13
- ],
14
- imports: [
15
- BrowserModule,
16
- FormsModule
17
- ],
18
- providers: [WINDOW_PROVIDERS],
19
- bootstrap: [AppComponent]
20
- })
21
- export class AppModule { }
@@ -1,12 +0,0 @@
1
- <aside>
2
- <a target="_blank" rel="noreferrer" [href]="accountUrl">
3
- {{ accountId }}
4
- </a>
5
- <a target="_blank" rel="noreferrer" [href]="contractUrl">
6
- {{ contractId }}
7
- </a>
8
- <footer>
9
- <div>✔ Succeeded</div>
10
- <div>Just now</div>
11
- </footer>
12
- </aside>
@@ -1,25 +0,0 @@
1
- import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'
2
-
3
- import { NotificationComponent } from './notification.component'
4
-
5
- describe('NotificationComponent', () => {
6
- let component: NotificationComponent
7
- let fixture: ComponentFixture<NotificationComponent>
8
-
9
- beforeEach(waitForAsync(() => {
10
- TestBed.configureTestingModule({
11
- declarations: [ NotificationComponent ]
12
- })
13
- .compileComponents()
14
- }))
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(NotificationComponent)
18
- component = fixture.componentInstance
19
- fixture.detectChanges()
20
- })
21
-
22
- it('should create', () => {
23
- expect(component).toBeTruthy()
24
- })
25
- })
@@ -1,23 +0,0 @@
1
- import { Component, ChangeDetectionStrategy, Input } from '@angular/core'
2
-
3
- import getConfig from '../../../config'
4
- const { networkId } = getConfig(process.env.NODE_ENV || 'development')
5
-
6
- @Component({
7
- selector: 'app-notification[accountId][contractId]',
8
- templateUrl: './notification.component.html',
9
- changeDetection: ChangeDetectionStrategy.OnPush
10
- })
11
- export class NotificationComponent {
12
- @Input() accountId: string
13
- @Input() contractId: string
14
- urlPrefix = `https://explorer.${networkId}.near.org/accounts`
15
-
16
- get accountUrl(): string {
17
- return `${this.urlPrefix}/${this.accountId}`
18
- }
19
-
20
- get contractUrl(): string {
21
- return `${this.urlPrefix}/${this.contractId}`
22
- }
23
- }
@@ -1,43 +0,0 @@
1
- import { isPlatformBrowser } from '@angular/common'
2
- import { ClassProvider, FactoryProvider, InjectionToken, PLATFORM_ID } from '@angular/core'
3
-
4
- /* Create a new injection token for injecting the window into a component. */
5
- export const WINDOW = new InjectionToken('WindowToken')
6
-
7
- /* Define abstract class for obtaining reference to the global window object. */
8
- export abstract class WindowRef {
9
- get nativeWindow(): Window | {} {
10
- throw new Error('Not implemented.')
11
- }
12
- }
13
-
14
- /* Define class that implements the abstract class and returns the native window object. */
15
- export class BrowserWindowRef extends WindowRef {
16
- get nativeWindow(): Window | {} {
17
- return window
18
- }
19
- }
20
-
21
- /* Create an factory function that returns the native window object. */
22
- export function windowFactory(browserWindowRef: BrowserWindowRef, platformId: {}): Window | {} {
23
- if (isPlatformBrowser(platformId)) {
24
- return browserWindowRef.nativeWindow
25
- }
26
- return {}
27
- }
28
-
29
- /* Create a injectable provider for the WindowRef token that uses the BrowserWindowRef class. */
30
- const browserWindowProvider: ClassProvider = {
31
- provide: WindowRef,
32
- useClass: BrowserWindowRef
33
- }
34
-
35
- /* Create an injectable provider that uses the windowFactory function for returning the native window object. */
36
- const windowProvider: FactoryProvider = {
37
- provide: WINDOW,
38
- useFactory: windowFactory,
39
- deps: [WindowRef, PLATFORM_ID]
40
- }
41
-
42
- /* Create an array of providers. */
43
- export const WINDOW_PROVIDERS = [browserWindowProvider, windowProvider]
@@ -1,13 +0,0 @@
1
- interface NetworkConfig {
2
- networkId: string
3
- nodeUrl: string
4
- contractName: string
5
- walletUrl?: string
6
- helperUrl?: string
7
- explorerUrl?: string
8
- keyPath?: string
9
- masterAccount?: string
10
- }
11
-
12
- declare function getConfig(env: string): NetworkConfig
13
- export default getConfig
@@ -1,62 +0,0 @@
1
- const CONTRACT_NAME = require('./contract-name')
2
-
3
- function getConfig(env) {
4
- switch (env) {
5
- case 'production':
6
- case 'mainnet':
7
- return {
8
- networkId: 'mainnet',
9
- nodeUrl: 'https://rpc.mainnet.near.org',
10
- contractName: CONTRACT_NAME,
11
- walletUrl: 'https://wallet.near.org',
12
- helperUrl: 'https://helper.mainnet.near.org',
13
- explorerUrl: 'https://explorer.mainnet.near.org',
14
- }
15
- case 'development':
16
- case 'testnet':
17
- return {
18
- networkId: 'testnet',
19
- nodeUrl: 'https://rpc.testnet.near.org',
20
- contractName: CONTRACT_NAME,
21
- walletUrl: 'https://wallet.testnet.near.org',
22
- helperUrl: 'https://helper.testnet.near.org',
23
- explorerUrl: 'https://explorer.testnet.near.org',
24
- }
25
- case 'betanet':
26
- return {
27
- networkId: 'betanet',
28
- nodeUrl: 'https://rpc.betanet.near.org',
29
- contractName: CONTRACT_NAME,
30
- walletUrl: 'https://wallet.betanet.near.org',
31
- helperUrl: 'https://helper.betanet.near.org',
32
- explorerUrl: 'https://explorer.betanet.near.org',
33
- }
34
- case 'local':
35
- return {
36
- networkId: 'local',
37
- nodeUrl: 'http://localhost:3030',
38
- keyPath: `${process.env.HOME}/.near/validator_key.json`,
39
- walletUrl: 'http://localhost:4000/wallet',
40
- contractName: CONTRACT_NAME,
41
- }
42
- case 'test':
43
- case 'ci':
44
- return {
45
- networkId: 'shared-test',
46
- nodeUrl: 'https://rpc.ci-testnet.near.org',
47
- contractName: CONTRACT_NAME,
48
- masterAccount: 'test.near',
49
- }
50
- case 'ci-betanet':
51
- return {
52
- networkId: 'shared-test-staging',
53
- nodeUrl: 'https://rpc.ci-betanet.near.org',
54
- contractName: CONTRACT_NAME,
55
- masterAccount: 'test.near',
56
- }
57
- default:
58
- throw Error(`Unconfigured environment '${env}'. Can be configured in src/config.js.`)
59
- }
60
- }
61
-
62
- module.exports = getConfig
@@ -1 +0,0 @@
1
- module.exports = ''
@@ -1,3 +0,0 @@
1
- export const environment = {
2
- production: true
3
- }
@@ -1,16 +0,0 @@
1
- // This file can be replaced during build by using the `fileReplacements` array.
2
- // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3
- // The list of file replacements can be found in `angular.json`.
4
-
5
- export const environment = {
6
- production: false
7
- }
8
-
9
- /*
10
- * For easier debugging in development mode, you can import the following file
11
- * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12
- *
13
- * This import should be commented out in production mode because it will have a negative impact
14
- * on performance if an error is thrown.
15
- */
16
- // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
@@ -1,15 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <title>Welcome to NEAR with Angular</title>
6
- <base href="/">
7
- <meta name="viewport" content="width=device-width, initial-scale=1">
8
- <link rel="icon" type="image/x-icon" href="assets/favicon.ico">
9
- <link rel="apple-touch-icon" href="assets/favicon.ico" />
10
- </head>
11
- <body>
12
- <noscript>You need to enable JavaScript to run this app.</noscript>
13
- <app-root></app-root>
14
- </body>
15
- </html>
@@ -1,15 +0,0 @@
1
- import { enableProdMode } from '@angular/core'
2
- import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
3
-
4
- import { AppModule } from './app/app.module'
5
- import { environment } from './environments/environment'
6
- import { initContract } from './utils'
7
-
8
- if (environment.production) {
9
- enableProdMode()
10
- }
11
-
12
- window.nearInitPromise = initContract()
13
- .then(() => {
14
- platformBrowserDynamic().bootstrapModule(AppModule).catch(err => console.error(err))
15
- })
@@ -1,64 +0,0 @@
1
- /**
2
- * This file includes polyfills needed by Angular and is loaded before the app.
3
- * You can add your own extra polyfills to this file.
4
- *
5
- * This file is divided into 2 sections:
6
- * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7
- * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8
- * file.
9
- *
10
- * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11
- * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12
- * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13
- *
14
- * Learn more in https://angular.io/guide/browser-support
15
- */
16
-
17
- /***************************************************************************************************
18
- * BROWSER POLYFILLS
19
- */
20
-
21
- /** IE10 and IE11 requires the following for NgClass support on SVG elements */
22
- // import 'classlist.js'; // Run `npm install --save classlist.js`.
23
-
24
- /**
25
- * Web Animations `@angular/platform-browser/animations`
26
- * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
27
- * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
28
- */
29
- // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
30
-
31
- /**
32
- * By default, zone.js will patch all possible macroTask and DomEvents
33
- * user can disable parts of macroTask/DomEvents patch by setting following flags
34
- * because those flags need to be set before `zone.js` being loaded, and webpack
35
- * will put import in the top of bundle, so user need to create a separate file
36
- * in this directory (for example: zone-flags.ts), and put the following flags
37
- * into that file, and then add the following code before importing zone.js.
38
- * import './zone-flags';
39
- *
40
- * The flags allowed in zone-flags.ts are listed here.
41
- *
42
- * The following flags will work for all browsers.
43
- *
44
- * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
45
- * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
46
- * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
47
- *
48
- * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
49
- * with the following flag, it will bypass `zone.js` patch for IE/Edge
50
- *
51
- * (window as any).__Zone_enable_cross_context_check = true;
52
- *
53
- */
54
-
55
- /***************************************************************************************************
56
- * Zone JS is required by default for Angular itself.
57
- */
58
- import 'zone.js/dist/zone' // Included with Angular CLI.
59
-
60
-
61
- /***************************************************************************************************
62
- * APPLICATION IMPORTS
63
- */
64
- (window as any).global = window
@@ -1 +0,0 @@
1
- /* You can add global styles to this file, and also import other style files */
@@ -1,25 +0,0 @@
1
- // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
-
3
- import 'zone.js/dist/zone-testing'
4
- import { getTestBed } from '@angular/core/testing'
5
- import {
6
- BrowserDynamicTestingModule,
7
- platformBrowserDynamicTesting
8
- } from '@angular/platform-browser-dynamic/testing'
9
-
10
- declare const require: {
11
- context(path: string, deep?: boolean, filter?: RegExp): {
12
- keys(): string[]
13
- <T>(id: string): T
14
- }
15
- }
16
-
17
- // First, initialize the Angular testing environment.
18
- getTestBed().initTestEnvironment(
19
- BrowserDynamicTestingModule,
20
- platformBrowserDynamicTesting()
21
- )
22
- // Then we find all the tests.
23
- const context = require.context('./', true, /\.spec\.ts$/)
24
- // And load the modules.
25
- context.keys().map(context)
@@ -1,3 +0,0 @@
1
- export declare function initContract(): Promise<void>
2
- export declare function login(): void
3
- export declare function logout(): void
@@ -1,15 +0,0 @@
1
- import { Contract, WalletConnection } from 'near-api-js'
2
-
3
- interface MyContract extends Contract {
4
- setGreeting(value: { message: string }): void
5
- getGreeting(value: { accountId: string }): string | null
6
- }
7
-
8
- declare global {
9
- interface Window {
10
- walletConnection: WalletConnection
11
- accountId: string
12
- contract: MyContract
13
- nearInitPromise: Promise<void>
14
- }
15
- }
@@ -1,15 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "./tsconfig.json",
4
- "compilerOptions": {
5
- "outDir": "./out-tsc/app",
6
- "types": ["node"]
7
- },
8
- "files": [
9
- "src/main.ts",
10
- "src/polyfills.ts"
11
- ],
12
- "include": [
13
- "src/**/*.d.ts"
14
- ]
15
- }
@@ -1,21 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "compileOnSave": false,
4
- "compilerOptions": {
5
- "baseUrl": "./",
6
- "outDir": "./dist/out-tsc",
7
- "sourceMap": true,
8
- "declaration": false,
9
- "downlevelIteration": true,
10
- "experimentalDecorators": true,
11
- "moduleResolution": "node",
12
- "importHelpers": true,
13
- "target": "es2015",
14
- "module": "es2020",
15
- "allowSyntheticDefaultImports": true,
16
- "lib": [
17
- "es2018",
18
- "dom"
19
- ]
20
- }
21
- }
@@ -1,18 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "./tsconfig.json",
4
- "compilerOptions": {
5
- "outDir": "./out-tsc/spec",
6
- "types": [
7
- "jasmine", "node"
8
- ]
9
- },
10
- "files": [
11
- "src/test.ts",
12
- "src/polyfills.ts"
13
- ],
14
- "include": [
15
- "src/**/*.spec.ts",
16
- "src/**/*.d.ts"
17
- ]
18
- }