Skip to content

Commit

Permalink
Merge pull request #1094 from near/dev
Browse files Browse the repository at this point in the history
v8.9.7 Release (dev → main)
  • Loading branch information
trechriron authored Apr 9, 2024
2 parents 0c558b4 + bb7520e commit 594f530
Show file tree
Hide file tree
Showing 32 changed files with 321 additions and 48 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "near-wallet-selector",
"version": "8.9.6",
"version": "8.9.7",
"description": "NEAR Wallet Selector makes it easy for users to interact with your dApp by providing an abstraction over various wallets within the NEAR ecosystem",
"keywords": [
"near",
Expand Down Expand Up @@ -84,7 +84,7 @@
"@angular/platform-browser": "15.2.9",
"@angular/platform-browser-dynamic": "15.2.9",
"@angular/router": "15.2.9",
"@here-wallet/core": "^1.5.1",
"@here-wallet/core": "^1.6.6",
"@jscutlery/semver": "3.1.0",
"@ledgerhq/hw-transport": "6.30.3",
"@ledgerhq/hw-transport-webhid": "6.28.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/account-export/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/account-export",
"version": "8.9.6",
"version": "8.9.7",
"description": "This is the Export Selector UI package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/bitget-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/bitget-wallet",
"version": "8.9.6",
"version": "8.9.7",
"description": "Bitget wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/coin98-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/coin98-wallet",
"version": "8.9.6",
"version": "8.9.7",
"description": "Coin 98 wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
11 changes: 10 additions & 1 deletion packages/core/docs/api/wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,16 @@ There are four wallet types:

**Description**

Returns meta information about the wallet such as `name`, `description`, `iconUrl` , `deprecated` and `available` but can include wallet-specific properties such as `downloadUrl` and `useUrlAccountImport` for injected wallets or `contractId`, `runOnStartup` for instant-link wallets and `walletUrl` for browser wallets.
Returns meta information about the wallet such as `name`, `description`, `iconUrl` , `deprecated` and `available` but can include wallet-specific properties such as `downloadUrl`, `useUrlAccountImport` and `topLevelInjected` for injected wallets or `contractId`, `runOnStartup` for instant-link wallets and `walletUrl` for browser wallets.

- `name`: Displayed in modal-ui as wallet name
- `description`: Displayed in modal-ui as wallet description
- `iconUrl`: Displayed in modal-ui as wallet icon
- `deprecated`: Makes the wallet unselectable via modal-ui
- `available`: Makes the wallet unselectable via modal-ui, use if the wallet cannot be selected in the user's environment.
- `downloadUrl`: Link to download injected wallet, available via modal-ui
- `useUrlAccountImport`: If `true`, then this injected wallet supports @account-export api and will be available in the account export modal window
- `topLevelInjected`: If the value `true` is passed for an injected wallet, modal-ui will call the signIn method of this wallet immediately upon initializing setupModal. This will allow wallet applications that open the dApp in the internal browser to immediately log in with the user's wallet.

**Example**

Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/core",
"version": "8.9.6",
"version": "8.9.7",
"description": "This is the core package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/lib/wallet/wallet.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ export type BrowserWallet = BaseWallet<

export type InjectedWalletMetadata = BaseWalletMetadata & {
downloadUrl: string;
topLevelInjected?: boolean;
useUrlAccountImport?: boolean;
};

Expand Down
2 changes: 1 addition & 1 deletion packages/here-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/here-wallet",
"version": "8.9.6",
"version": "8.9.7",
"description": "Here wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
9 changes: 8 additions & 1 deletion packages/here-wallet/src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import type { HereProvider, HereStrategy } from "@here-wallet/core";
import {
waitInjectedHereWallet,
type HereProvider,
type HereStrategy,
} from "@here-wallet/core";
import type { WalletModuleFactory } from "@near-wallet-selector/core";
import type { HereWallet } from "./types";
import { initHereWallet } from "./selector";
Expand All @@ -20,6 +24,8 @@ export function setupHereWallet({
defaultProvider,
}: Options = {}): WalletModuleFactory<HereWallet> {
return async () => {
const isInjected = await waitInjectedHereWallet;

return {
id: "here-wallet",
type: "injected",
Expand All @@ -28,6 +34,7 @@ export function setupHereWallet({
description: "Mobile wallet for NEAR Protocol",
useUrlAccountImport: true,
downloadUrl: "https://herewallet.app",
topLevelInjected: isInjected != null,
iconUrl,
deprecated,
available: true,
Expand Down
15 changes: 7 additions & 8 deletions packages/here-wallet/src/lib/selector.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { NetworkId } from "@near-wallet-selector/core";
import { HereWallet } from "@here-wallet/core";
import { HereWallet, waitInjectedHereWallet } from "@here-wallet/core";
import type BN from "bn.js";

import type { SelectorInit } from "./types";
Expand Down Expand Up @@ -66,8 +66,11 @@ export const initHereWallet: SelectorInit = async (config) => {
async signIn(data) {
logger.log("HereWallet:signIn");

const contractId = data.contractId !== "" ? data.contractId : undefined;
await here.signIn({ ...data, contractId: contractId });
const isInjected = await waitInjectedHereWallet;
if (!isInjected) {
const contractId = data.contractId !== "" ? data.contractId : undefined;
await here.signIn({ ...data, contractId: contractId });
}

emitter.emit("signedIn", {
contractId: data.contractId,
Expand Down Expand Up @@ -101,12 +104,8 @@ export const initHereWallet: SelectorInit = async (config) => {
logger.log("HereWallet:signAndSendTransaction", data);

const { contract } = store.getState();
if (!here.isSignedIn || !contract) {
throw new Error("Wallet not signed in");
}

return await here.signAndSendTransaction({
receiverId: contract.contractId,
receiverId: contract?.contractId,
...data,
});
},
Expand Down
2 changes: 1 addition & 1 deletion packages/ledger/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/ledger",
"version": "8.9.6",
"version": "8.9.7",
"description": "Ledger package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/math-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/math-wallet",
"version": "8.9.6",
"version": "8.9.7",
"description": "Math wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/meteor-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/meteor-wallet",
"version": "8.9.6",
"version": "8.9.7",
"description": "Meteor wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/mintbase-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/mintbase-wallet",
"version": "8.9.6",
"version": "8.9.7",
"description": "Mintbase wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/modal-ui-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/modal-ui-js",
"version": "8.9.6",
"version": "8.9.7",
"description": "Modal UI package for NEAR wallet Selector",
"keywords": [
"near",
Expand Down
18 changes: 18 additions & 0 deletions packages/modal-ui-js/src/lib/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,24 @@ export const setupModal = (
): WalletSelectorModal => {
const emitter = new EventEmitter<ModalEvents>();

selector.store.getState().modules.forEach(async (module) => {
if ("topLevelInjected" in module.metadata) {
if (!module.metadata.topLevelInjected) {
return;
}

const wallet = await module.wallet();
if (wallet.type !== "injected") {
return;
}

await wallet.signIn({
contractId: options.contractId,
methodNames: options.methodNames,
});
}
});

modalState = {
container: document.getElementById(MODAL_ELEMENT_ID)!,
selector,
Expand Down
2 changes: 1 addition & 1 deletion packages/modal-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/modal-ui",
"version": "8.9.6",
"version": "8.9.7",
"description": "Modal UI package for NEAR wallet Selector",
"keywords": [
"near",
Expand Down
18 changes: 18 additions & 0 deletions packages/modal-ui/src/lib/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,24 @@ export const setupModal = (

const emitter = new EventEmitter<ModalEvents>();

selector.store.getState().modules.forEach(async (module) => {
if ("topLevelInjected" in module.metadata) {
if (!module.metadata.topLevelInjected) {
return;
}

const wallet = await module.wallet();
if (wallet.type !== "injected") {
return;
}

await wallet.signIn({
contractId: options.contractId,
methodNames: options.methodNames,
});
}
});

const render = (visible = false) => {
root!.render(
<Modal
Expand Down
2 changes: 1 addition & 1 deletion packages/my-near-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/my-near-wallet",
"version": "8.9.6",
"version": "8.9.7",
"description": "My Near Wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/narwallets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/narwallets",
"version": "8.9.6",
"version": "8.9.7",
"description": "This is the Narwallets package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/near-mobile-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/near-mobile-wallet",
"version": "8.9.6",
"version": "8.9.7",
"description": "NEAR Mobile wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/near-snap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/near-snap",
"version": "8.9.6",
"version": "8.9.7",
"description": "Metamask snap to interact with Near dapps.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/nearfi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/nearfi",
"version": "8.9.6",
"version": "8.9.7",
"description": "Nearfi package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/neth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/neth",
"version": "8.9.6",
"version": "8.9.7",
"description": "Control NEAR accounts with ETH accounts",
"author": "mattlockyer",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion packages/nightly/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/nightly",
"version": "8.9.6",
"version": "8.9.7",
"description": "Nightly wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/ramper-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/ramper-wallet",
"version": "8.9.6",
"version": "8.9.7",
"description": "Ramper wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/sender/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/sender",
"version": "8.9.6",
"version": "8.9.7",
"description": "Sender wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/wallet-connect/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/wallet-connect",
"version": "8.9.6",
"version": "8.9.7",
"description": "Wallet Connect package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/wallet-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/wallet-utils",
"version": "8.9.6",
"version": "8.9.7",
"description": "Wallet utils package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/welldone-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/welldone-wallet",
"version": "8.9.6",
"version": "8.9.7",
"description": "Welldone wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/xdefi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/xdefi",
"version": "8.9.6",
"version": "8.9.7",
"description": "This is the XDEFI package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
Loading

0 comments on commit 594f530

Please sign in to comment.