Skip to content

Commit

Permalink
Merge pull request #687 from near/dev
Browse files Browse the repository at this point in the history
v7.7.0 Release (dev -> main)
  • Loading branch information
kujtimprenkuSQA authored Feb 3, 2023
2 parents f17fcaa + e5737fd commit 051478a
Show file tree
Hide file tree
Showing 91 changed files with 1,597 additions and 265 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ NEAR Wallet Selector makes it easy for users to interact with your dApp by provi
- [Here Wallet](https://www.npmjs.com/package/@near-wallet-selector/here-wallet) - Mobile wallet.
- [NearFi Wallet](https://www.npmjs.com/package/@near-wallet-selector/nearfi) - Mobile wallet.
- [Opto Wallet](https://www.npmjs.com/package/@near-wallet-selector/opto-wallet) - Mobile wallet & Browser wallet.
- [Finer Wallet](https://www.npmjs.com/package/@near-wallet-selector/finer-wallet) - Mobile wallet & Browser wallet.

## Preview

Expand Down Expand Up @@ -67,6 +68,7 @@ yarn add \
@near-wallet-selector/default-wallets \
@near-wallet-selector/coin98-wallet \
@near-wallet-selector/opto-wallet \
@near-wallet-selector/finer-wallet \
@near-wallet-selector/neth \
@near-wallet-selector/xdefi

Expand All @@ -88,6 +90,7 @@ npm install \
@near-wallet-selector/default-wallets \
@near-wallet-selector/coin98-wallet \
@near-wallet-selector/opto-wallet \
@near-wallet-selector/finer-wallet \
@near-wallet-selector/neth \
@near-wallet-selector/xdefi
```
Expand Down Expand Up @@ -123,6 +126,7 @@ import { setupDefaultWallets } from "@near-wallet-selector/default-wallets";
import { setupNearFi } from "@near-wallet-selector/nearfi";
import { setupCoin98Wallet } from "@near-wallet-selector/coin98-wallet";
import { setupOptoWallet } from "@near-wallet-selector/opto-wallet";
import { setupFinerWallet } from "@near-wallet-selector/finer-wallet";
import { setupNeth } from "@near-wallet-selector/neth";
import { setupXDEFI } from "@near-wallet-selector/xdefi";

Expand All @@ -143,6 +147,7 @@ const selector = await setupWalletSelector({
setupNearFi(),
setupCoin98Wallet(),
setupOptoWallet(),
setupFinerWallet(),
setupNeth(),
setupXDEFI(),
setupWalletConnect({
Expand Down
5 changes: 5 additions & 0 deletions examples/angular/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@
"input": "packages/opto-wallet/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/finer-wallet/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/xdefi/assets/",
Expand Down
17 changes: 8 additions & 9 deletions examples/angular/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<main>
<h1>NEAR Guest Book</h1>
<near-wallet-selector-content
*ngIf="!!selector"
[selector]="selector"
[accounts]="accounts"
[accountId]="accountId"
[modal]="modal"
>
</near-wallet-selector-content>
<div class="title-container">
<h1>{{showImport ? "Export Account" : "NEAR Guest Book"}}</h1>
<button (click)="showImport = !showImport" >
{{showImport ? "Back to Log in" : "Try Export Account"}}
</button>
</div>
<near-wallet-selector-wallet-selector *ngIf="!showImport"></near-wallet-selector-wallet-selector>
<near-wallet-selector-wallet-selector-export *ngIf="showImport"></near-wallet-selector-wallet-selector-export>
</main>

106 changes: 2 additions & 104 deletions examples/angular/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,112 +1,10 @@
import type { OnInit } from "@angular/core";
import { Component } from "@angular/core";
import type { WalletSelector, AccountState } from "@near-wallet-selector/core";
import { setupWalletSelector } from "@near-wallet-selector/core";
import { setupDefaultWallets } from "@near-wallet-selector/default-wallets";
import { setupSender } from "@near-wallet-selector/sender";
import { setupXDEFI } from "@near-wallet-selector/xdefi";
import { setupNearFi } from "@near-wallet-selector/nearfi";
import { setupMathWallet } from "@near-wallet-selector/math-wallet";
import { setupNightly } from "@near-wallet-selector/nightly";
import { setupMeteorWallet } from "@near-wallet-selector/meteor-wallet";
import { setupNarwallets } from "@near-wallet-selector/narwallets";
import { setupWelldoneWallet } from "@near-wallet-selector/welldone-wallet";
import { setupNightlyConnect } from "@near-wallet-selector/nightly-connect";
import { setupWalletConnect } from "@near-wallet-selector/wallet-connect";
import { setupCoin98Wallet } from "@near-wallet-selector/coin98-wallet";
import { setupHereWallet } from "@near-wallet-selector/here-wallet";
import { setupNeth } from "@near-wallet-selector/neth";
import { setupOptoWallet } from "@near-wallet-selector/opto-wallet";
import { setupNearWallet } from "@near-wallet-selector/near-wallet";
// import { setupModal } from "@near-wallet-selector/modal-ui";
// import type { WalletSelectorModal } from "@near-wallet-selector/modal-ui";
import { setupModal } from "@near-wallet-selector/modal-ui-js";
import type { WalletSelectorModal } from "@near-wallet-selector/modal-ui-js";
import { CONTRACT_ID } from "../constants";

declare global {
interface Window {
selector: WalletSelector;
modal: WalletSelectorModal;
}
}

@Component({
selector: "near-wallet-selector-root",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.scss"],
})
export class AppComponent implements OnInit {
selector: WalletSelector;
modal: WalletSelectorModal;
accountId: string | null;
accounts: Array<AccountState> = [];

async ngOnInit() {
await this.initialize().catch((err) => {
console.error(err);
alert("Failed to initialise wallet selector");
});
}

async initialize() {
const _selector = await setupWalletSelector({
network: "testnet",
debug: true,
modules: [
...(await setupDefaultWallets()),
setupNearWallet(),
setupSender(),
setupXDEFI(),
setupMathWallet(),
setupNightly(),
setupMeteorWallet(),
setupNarwallets(),
setupWelldoneWallet(),
setupHereWallet(),
setupCoin98Wallet(),
setupNearFi(),
setupNeth({
bundle: false,
}),
setupOptoWallet(),
setupWalletConnect({
projectId: "c4f79cc...",
metadata: {
name: "NEAR Wallet Selector",
description: "Example dApp used by NEAR Wallet Selector",
url: "https://github.com/near/wallet-selector",
icons: ["https://avatars.githubusercontent.com/u/37784886"],
},
}),
setupNightlyConnect({
url: "wss://relay.nightly.app/app",
appMetadata: {
additionalInfo: "",
application: "NEAR Wallet Selector",
description: "Example dApp used by NEAR Wallet Selector",
icon: "https://near.org/wp-content/uploads/2020/09/cropped-favicon-192x192.png",
},
}),
],
});

const _modal = setupModal(_selector, {
contractId: CONTRACT_ID,
onHide: (hideReason) => {
console.log("The reason for hiding modal: ", hideReason);
},
});
const state = _selector.store.getState();

this.accounts = state.accounts;
this.accountId =
state.accounts.find((account) => account.active)?.accountId || null;

window.selector = _selector;
window.modal = _modal;

this.selector = _selector;
this.modal = _modal;
}
export class AppComponent {
showImport: boolean;
}
6 changes: 6 additions & 0 deletions examples/angular/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { SignInComponent } from "./components/sign-in/sign-in.component";
import { MessagesComponent } from "./components/messages/messages.component";
import { FormComponent } from "./components/form/form.component";
import { ContentComponent } from "./components/content/content.component";
import { WalletSelectorComponent } from "./pages/wallet-selector/wallet-selector.component";
import { WalletSelectorExportComponent } from "./pages/wallet-selector-export/wallet-selector-export.component";
import { LoadingComponent } from "./components/loading/loading.component";

@NgModule({
declarations: [
Expand All @@ -15,6 +18,9 @@ import { ContentComponent } from "./components/content/content.component";
MessagesComponent,
FormComponent,
ContentComponent,
WalletSelectorComponent,
WalletSelectorExportComponent,
LoadingComponent,
],
imports: [BrowserModule, FormsModule],
providers: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ export class ContentComponent implements OnInit, OnDestroy {
this.account = account;
});
});

this.modal.on("onHide", ({ hideReason }) => {
console.log(`The reason for hiding the modal ${hideReason}`);
});
}

async addMessages(message: string, donation: string, multiple: boolean) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="lds-ellipsis">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
56 changes: 56 additions & 0 deletions examples/angular/src/app/components/loading/loading.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
.lds-ellipsis {
position: relative;
width: 80px;
height: 80px;
margin: auto;
}
.lds-ellipsis div {
position: absolute;
top: 33px;
width: 13px;
height: 13px;
border-radius: 50%;
background: var(--fg);
animation-timing-function: cubic-bezier(0, 1, 1, 0);

}
.lds-ellipsis div:nth-child(1) {
left: 8px;
animation: lds-ellipsis1 0.6s infinite;
}
.lds-ellipsis div:nth-child(2) {
left: 8px;
animation: lds-ellipsis2 0.6s infinite;
}
.lds-ellipsis div:nth-child(3) {
left: 32px;
animation: lds-ellipsis2 0.6s infinite;
}
.lds-ellipsis div:nth-child(4) {
left: 56px;
animation: lds-ellipsis3 0.6s infinite;
}
@keyframes lds-ellipsis1 {
0% {
transform: scale(0);
}
100% {
transform: scale(1);
}
}
@keyframes lds-ellipsis3 {
0% {
transform: scale(1);
}
100% {
transform: scale(0);
}
}
@keyframes lds-ellipsis2 {
0% {
transform: translate(0, 0);
}
100% {
transform: translate(24px, 0);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Component } from "@angular/core";

@Component({
selector: "near-wallet-selector-loading",
templateUrl: "./loading.component.html",
styleUrls: ["./loading.component.scss"],
})
export class LoadingComponent {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<near-wallet-selector-loading *ngIf="!exportModal || !exportSelector"></near-wallet-selector-loading>
<div *ngIf="exportModal || exportSelector">
<button (click)="show()">Open Modal</button>
<p>
The Export Accounts modal assists users in migrating their accounts to
any Wallet Selector wallet supporting account imports. Any sensitive
data in transit during this process will be encrypted with a
randomly-generated password which the user will be required to copy down
and use in the account import process on the target wallet.
</p>
</div>
Empty file.
Loading

0 comments on commit 051478a

Please sign in to comment.