Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4.1.0 Release (dev -> main) #326

Merged
merged 69 commits into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
5991d70
Added tests for signTransaction, fixed setup function
amirsaran3 May 26, 2022
27b1cd6
Uncommented afterEach
amirsaran3 May 26, 2022
b12468e
Added signAndSendTransactions test, modified getAccounts test
amirsaran3 May 26, 2022
7978054
removed comments
amirsaran3 May 26, 2022
d8f90f3
Initial changes
amirsaran3 May 26, 2022
682644f
Resolved conflicts
amirsaran3 May 26, 2022
1c180d4
Refactored modal types
amirsaran3 May 26, 2022
32696cc
Resolved review comments
amirsaran3 May 30, 2022
15f3936
Fixed store issue
amirsaran3 May 30, 2022
da3733f
Added release script.
lewis-sqa May 30, 2022
3b11963
Merge pull request #311 from near/add-release-script
lewis-sqa May 30, 2022
ccc27ae
Resolved review comments
amirsaran3 May 30, 2022
84b2c30
Set initial value of contract to null
amirsaran3 May 31, 2022
e66df4a
Fixed imports
amirsaran3 May 31, 2022
f55909e
Merge pull request #305 from near/SQAC-150-ledger-wallet-unit-testing
amirsaran3 May 31, 2022
ba14606
Merge branch 'dev' of https://github.com/near-projects/wallet-selecto…
amirsaran3 May 31, 2022
ba60f16
Added wallet connecting component
kujtimprenkuSQA Jun 1, 2022
1d6e9a5
Improved connecting flow for ledger, aligned with other options
kujtimprenkuSQA Jun 1, 2022
2e85056
add Nightly wallet
NorbertBodziony Jun 1, 2022
6d89c98
Added WalletConnectingModalRoute, made params otional
amirsaran3 Jun 2, 2022
29b148f
Merge pull request #315 from near/SQAC-154-refactor-ledger-route-for-…
amirsaran3 Jun 2, 2022
4f56e90
Merged with dev and aligned changes
kujtimprenkuSQA Jun 2, 2022
727169f
Added modalInstance and walletSelectorInstance with logic
amirsaran3 Jun 2, 2022
8dd8c76
Merge pull request #313 from near/SQAC-156/improve-connecting-flow
kujtimprenkuSQA Jun 2, 2022
5b9d809
Merge branch 'dev' of https://github.com/near-projects/wallet-selecto…
amirsaran3 Jun 2, 2022
0a96377
Merge pull request #316 from near/SQAC-149-prevent-side-effects-of-mu…
amirsaran3 Jun 3, 2022
6633aee
move eager connect to internal part of wallet
NorbertBodziony Jun 3, 2022
90a14ee
fix unused import
NorbertBodziony Jun 3, 2022
cf0793d
Added support for multiple derivation paths in UI
kujtimprenkuSQA Jun 3, 2022
2eefdf3
Removed commented styles
kujtimprenkuSQA Jun 3, 2022
064e995
fix getAccounts method
NorbertBodziony Jun 6, 2022
9045fcc
add nightly to Readme
NorbertBodziony Jun 6, 2022
922a791
use injected provider
NorbertBodziony Jun 6, 2022
829537d
refactor wallet setup
NorbertBodziony Jun 6, 2022
5786021
add eagerConnect option
NorbertBodziony Jun 6, 2022
2927fe1
Used function parameter to setState for derivation paths
kujtimprenkuSQA Jun 6, 2022
908ab20
Merge pull request #317 from near/SQAC-163/ui-support-multiple-deriva…
lewis-sqa Jun 7, 2022
7109ec9
Cleaned up patch for MathAccount.
lewis-sqa Jun 9, 2022
33be60d
Merge pull request #319 from near/SQAC-165/math-wallet-update
lewis-sqa Jun 13, 2022
ab2bec6
Centered text in wallet options
kujtimprenkuSQA Jun 13, 2022
fc28d94
Throw error and show alert message for deprecated wallets
kujtimprenkuSQA Jun 14, 2022
2179e38
Sorted wallets, moved deprecated wallets at the end.
kujtimprenkuSQA Jun 14, 2022
4603fac
Changed backround color for deprecated wallets
kujtimprenkuSQA Jun 14, 2022
55b918e
use interfaces instead of classes
NorbertBodziony Jun 14, 2022
8911f2c
Added option to Network
kujtimprenkuSQA Jun 14, 2022
33bb320
enforce installed extension
NorbertBodziony Jun 14, 2022
680d1f9
Moved away form multiple ternary operators as suggested.
kujtimprenkuSQA Jun 14, 2022
ab817e8
Fix linting
kujtimprenkuSQA Jun 14, 2022
b24746a
Fixed tests
kujtimprenkuSQA Jun 14, 2022
a061094
Merge pull request #323 from near/SQAC-153/handle-depricated-wallets-ui
kujtimprenkuSQA Jun 14, 2022
6c4be60
Merge pull request #324 from near/SQAC-169/add-indexer-url
kujtimprenkuSQA Jun 14, 2022
8f6e442
revert change in WalletOptions
NorbertBodziony Jun 14, 2022
45125a1
CR refactor
NorbertBodziony Jun 14, 2022
60049ca
Merge pull request #314 from nightly-labs/dev
lewis-sqa Jun 14, 2022
13bfa92
Switched to opacity.
lewis-sqa Jun 15, 2022
993d8af
Converted Nightly icon to greyscale.
lewis-sqa Jun 15, 2022
d09e8f4
Improved wording for deprecated wallet alert.
lewis-sqa Jun 15, 2022
b176f4b
Improved accounts logic.
lewis-sqa Jun 15, 2022
db4aa17
Switched to use Signer interface.
lewis-sqa Jun 15, 2022
d4fd4e9
Minor formatting.
lewis-sqa Jun 15, 2022
a82b0d7
Retracted store url until official release.
lewis-sqa Jun 15, 2022
17f40eb
Updated main docs.
lewis-sqa Jun 15, 2022
c62ee8a
Updated examples.
lewis-sqa Jun 15, 2022
dfda6e0
Bumped version to 4.1.0.
lewis-sqa Jun 15, 2022
21ea120
Minor tweak to keywords.
lewis-sqa Jun 15, 2022
a7f53a7
Updated example to better integrate multiple transactions.
lewis-sqa Jun 15, 2022
a809b16
Minor refactor.
lewis-sqa Jun 15, 2022
d0b8bf0
Aligned Angular example with React.
lewis-sqa Jun 15, 2022
388bfd1
Merge pull request #325 from near/release-fixes
lewis-sqa Jun 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ NEAR Wallet Selector makes it easy for users to interact with your dApp by provi
- [My NEAR Wallet](https://www.npmjs.com/package/@near-wallet-selector/my-near-wallet) - Browser wallet.
- [Sender](https://www.npmjs.com/package/@near-wallet-selector/sender) - Injected wallet.
- [Math Wallet](https://www.npmjs.com/package/@near-wallet-selector/math-wallet) - Injected wallet.
- [Nightly](https://www.npmjs.com/package/@near-wallet-selector/nightly) - Injected wallet.
- [Ledger](https://www.npmjs.com/package/@near-wallet-selector/ledger) - Hardware wallet.
- [WalletConnect](https://www.npmjs.com/package/@near-wallet-selector/wallet-connect) - Bridge wallet.

Expand Down Expand Up @@ -36,6 +37,7 @@ yarn add \
@near-wallet-selector/my-near-wallet \
@near-wallet-selector/sender \
@near-wallet-selector/math-wallet \
@near-wallet-selector/nightly \
@near-wallet-selector/ledger \
@near-wallet-selector/wallet-connect

Expand All @@ -45,6 +47,7 @@ npm install \
@near-wallet-selector/my-near-wallet \
@near-wallet-selector/sender \
@near-wallet-selector/math-wallet \
@near-wallet-selector/nightly \
@near-wallet-selector/ledger \
@near-wallet-selector/wallet-connect
```
Expand All @@ -68,6 +71,7 @@ import { setupNearWallet } from "@near-wallet-selector/near-wallet";
import { setupMyNearWallet } from "@near-wallet-selector/my-near-wallet";
import { setupSender } from "@near-wallet-selector/sender";
import { setupMathWallet } from "@near-wallet-selector/math-wallet";
import { setupNightly } from "@near-wallet-selector/nightly";
import { setupLedger } from "@near-wallet-selector/ledger";
import { setupWalletConnect } from "@near-wallet-selector/wallet-connect";

Expand All @@ -77,8 +81,9 @@ const selector = await setupWalletSelector({
setupNearWallet(),
setupMyNearWallet(),
setupSender(),
setupLedger(),
setupMathWallet(),
setupNightly(),
setupLedger(),
setupWalletConnect({
projectId: "c4f79cc...",
metadata: {
Expand Down
5 changes: 5 additions & 0 deletions examples/angular/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
"input": "packages/sender/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/nightly/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/ledger/assets/",
Expand Down
8 changes: 5 additions & 3 deletions examples/angular/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import type { WalletSelector, AccountState } from "@near-wallet-selector/core";
import { setupNearWallet } from "@near-wallet-selector/near-wallet";
import { setupMyNearWallet } from "@near-wallet-selector/my-near-wallet";
import { setupSender } from "@near-wallet-selector/sender";
import { setupLedger } from "@near-wallet-selector/ledger";
import { setupMathWallet } from "@near-wallet-selector/math-wallet";
import { setupNightly } from "@near-wallet-selector/nightly";
import { setupLedger } from "@near-wallet-selector/ledger";
import { setupWalletConnect } from "@near-wallet-selector/wallet-connect";
import { setupModal } from "@near-wallet-selector/modal-ui";
import type { WalletSelectorModal } from "@near-wallet-selector/modal-ui";
Expand Down Expand Up @@ -68,10 +69,11 @@ export class AppComponent implements OnInit {
setupNearWallet(),
setupMyNearWallet(),
setupSender(),
setupLedger(),
setupMathWallet(),
setupNightly(),
setupLedger(),
setupWalletConnect({
projectId: "d43d7d0e46eea5ee28e1f75e1131f984",
projectId: "c4f79cc...",
metadata: {
name: "NEAR Wallet Selector",
description: "Example dApp used by NEAR Wallet Selector",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<ng-container *ngIf="account">
<div>
<button (click)="signOut()">Log out</button>
<button (click)="switchProvider()">Switch Provider</button>
<button (click)="onSendMultipleTransactions()">
Send Multiple Transactions
</button>
<button (click)="switchWallet()">Switch Wallet</button>
<button *ngIf="accounts.length > 1" (click)="switchAccount()">
Switch Account
</button>
Expand Down
117 changes: 56 additions & 61 deletions examples/angular/src/app/components/content/content.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type { Account } from "../../interfaces/account";
import { distinctUntilChanged, map, Subscription } from "rxjs";
import type { WalletSelectorModal } from "@near-wallet-selector/modal-ui";
import { CONTRACT_ID } from "../../../constants";
import { Transaction } from "@near-wallet-selector/core";

const SUGGESTED_DONATION = "0";
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
Expand Down Expand Up @@ -77,7 +78,7 @@ export class ContentComponent implements OnInit, OnDestroy {
});
}

switchProvider() {
switchWallet() {
this.modal.show();
}

Expand Down Expand Up @@ -114,48 +115,6 @@ export class ContentComponent implements OnInit, OnDestroy {
});
}

async onSendMultipleTransactions() {
const { contract } = this.selector.store.getState();
const wallet = await this.selector.wallet();

wallet.signAndSendTransactions({
transactions: [
{
// Deploy your own version of https://github.com/near-examples/rust-counter using Gitpod to get a valid receiverId.
receiverId: "dev-1648806797290-14624341764914",
actions: [
{
type: "FunctionCall",
params: {
methodName: "increment",
args: {},
gas: BOATLOAD_OF_GAS,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
deposit: utils.format.parseNearAmount("0")!,
},
},
],
},
{
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
receiverId: contract!.contractId,
actions: [
{
type: "FunctionCall",
params: {
methodName: "addMessage",
args: { text: "Hello World!" },
gas: BOATLOAD_OF_GAS,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
deposit: utils.format.parseNearAmount("0")!,
},
},
],
},
],
});
}

syncAccountState(
currentAccountId: string | null,
newAccounts: Array<AccountState>
Expand Down Expand Up @@ -201,39 +160,75 @@ export class ContentComponent implements OnInit, OnDestroy {
});
}

async onSubmit(e: Submitted) {
const { fieldset, message, donation } = e.target.elements;
async addMessages(message: string, donation: string, multiple: boolean) {
const { contract } = this.selector.store.getState();
const wallet = await this.selector.wallet();

fieldset.disabled = true;
if (!multiple) {
return wallet
.signAndSendTransaction({
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
signerId: this.accountId!,
actions: [
{
type: "FunctionCall",
params: {
methodName: "addMessage",
args: { text: message },
gas: BOATLOAD_OF_GAS,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
deposit: utils.format.parseNearAmount(donation)!,
},
},
],
})
.catch((err) => {
alert("Failed to add message");
console.log("Failed to add message");

// TODO: optimistically update page with new message,
// update blockchain data in background
// add uuid to each message, so we know which one is already known
throw err;
});
}

const wallet = await this.selector.wallet();
const transactions: Array<Transaction> = [];

wallet
.signAndSendTransaction({
for (let i = 0; i < 2; i += 1) {
transactions.push({
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
signerId: this.accountId!,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
receiverId: contract!.contractId,
actions: [
{
type: "FunctionCall",
params: {
methodName: "addMessage",
args: { text: message.value },
gas: BOATLOAD_OF_GAS as string,
args: {
text: `${message} (${i + 1}/2)`,
},
gas: BOATLOAD_OF_GAS,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
deposit: utils.format.parseNearAmount(donation.value || "0")!,
deposit: utils.format.parseNearAmount(donation)!,
},
},
],
})
.catch((err) => {
alert("Failed to add message");
console.log("Failed to add message");
throw err;
})
});
}

return wallet.signAndSendTransactions({ transactions }).catch((err) => {
alert("Failed to add messages");
console.log("Failed to add messages");

throw err;
});
}

async onSubmit(e: Submitted) {
const { fieldset, message, donation, multiple } = e.target.elements;

fieldset.disabled = true;

this.addMessages(message.value, donation.value || "0", multiple.checked)
.then(() => {
return this.getMessages()
.then((nextMessages) => {
Expand Down
4 changes: 4 additions & 0 deletions examples/angular/src/app/components/form/form.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
/>
<span title="NEAR Tokens">Ⓝ</span>
</p>
<p>
<label htmlFor="multiple">Multiple Transactions:</label>
<input id="multiple" type="checkbox" />
</p>
<button type="submit">Sign</button>
</fieldset>
</form>
4 changes: 4 additions & 0 deletions examples/angular/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ input[type="number"] {
}
}

input[type="checkbox"] {
margin: 0 1em;
}

button, input {
background: transparent;
color: inherit;
Expand Down
5 changes: 5 additions & 0 deletions examples/react/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
"input": "packages/sender/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/nightly/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/ledger/assets/",
Expand Down
Loading