Skip to content

Commit

Permalink
Merge branch 'pa/fix-ethereum-wallets' into ik/worflow-package-publish
Browse files Browse the repository at this point in the history
  • Loading branch information
paouvrard committed Aug 13, 2024
2 parents bde5db8 + 7bb1665 commit eb758a2
Show file tree
Hide file tree
Showing 69 changed files with 1,181 additions and 661 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ testem.log
Thumbs.db

.angular
.npmrc
package-lock.json

# Next.js
.next
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
save-exact=true
legacy-peer-deps=true
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const projectId = "30147604c5f01d0bc4482ab0665b5697";
// TODO: Replace with the NEAR chain after the protocol upgrade.
const near: Chain = {
id: 398,
name: "NEAR wallet playground",
name: "NEAR Protocol Testnet",
nativeCurrency: {
decimals: 18,
name: "NEAR",
Expand Down Expand Up @@ -156,7 +156,7 @@ export class WalletSelectorComponent implements OnInit {
setupNearMobileWallet(),
setupMintbaseWallet({ contractId: CONTRACT_ID }),
setupBitteWallet({ contractId: CONTRACT_ID }),
setupEthereumWallets({ wagmiConfig, web3Modal, devMode: true }),
setupEthereumWallets({ wagmiConfig, web3Modal }),
],
});

Expand Down
4 changes: 2 additions & 2 deletions examples/react/contexts/WalletSelectorContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const projectId = "30147604c5f01d0bc4482ab0665b5697";
// TODO: Replace with the NEAR chain after the protocol upgrade.
const near: Chain = {
id: 398,
name: "NEAR wallet playground",
name: "NEAR Protocol Testnet",
nativeCurrency: {
decimals: 18,
name: "NEAR",
Expand Down Expand Up @@ -176,7 +176,7 @@ export const WalletSelectorContextProvider: React.FC<{
setupNearMobileWallet(),
setupMintbaseWallet({ contractId: CONTRACT_ID }),
setupBitteWallet({ contractId: CONTRACT_ID }),
setupEthereumWallets({ wagmiConfig, web3Modal, devMode: true }),
setupEthereumWallets({ wagmiConfig, web3Modal }),
],
});
const _modal = setupModal(_selector, {
Expand Down
28 changes: 12 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "near-wallet-selector",
"version": "8.9.11",
"private": true,
"version": "8.9.12",
"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 @@ -42,10 +41,6 @@
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/esm/index.d.ts",
"workspaces": [
"packages/*",
"examples/*"
],
"scripts": {
"build:account-export": "nx run-many --target=build --projects=account-export --configuration=production",
"build:all": "nx run-many --target=build --all --exclude=react,angular --configuration=production && node ./scripts/update-package-json.js",
Expand Down Expand Up @@ -95,24 +90,24 @@
"@angular/platform-browser": "16.1.9",
"@angular/platform-browser-dynamic": "16.1.9",
"@angular/router": "16.1.9",
"@here-wallet/core": "1.6.6",
"@jscutlery/semver": "3.1.0",
"@here-wallet/core": "3.3.1",
"@jscutlery/semver": "5.2.2",
"@ledgerhq/hw-transport": "6.30.3",
"@ledgerhq/hw-transport-webhid": "6.28.6",
"@ledgerhq/hw-transport-webhid": "6.29.2",
"@metamask/detect-provider": "2.0.0",
"@meteorwallet/sdk": "1.0.9",
"@mintbase-js/wallet": "0.6.0-beta.10",
"@near-snap/sdk": "0.6.0",
"@near-wallet-selector/wallet-utils": "workspace:latest",
"@noble/ciphers": "0.5.3",
"@noble/hashes": "1.4.0",
"@peersyst/near-mobile-signer": "1.0.12",
"@peersyst/near-mobile-signer": "1.1.0",
"@ramper/near": "0.0.30",
"@tanstack/react-query": "5.24.8",
"@walletconnect/modal": "2.6.2",
"@walletconnect/sign-client": "2.13.0",
"@web3modal/wagmi": "5.0.6",
"better-sqlite3": "11.1.2",
"big.js": "6.1.1",
"big.js": "6.2.1",
"borsh": "0.7.0",
"browserify-fs": "1.0.0",
"bs58": "5.0.0",
Expand All @@ -130,12 +125,12 @@
"qrcode": "1.5.3",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-qr-code": "2.0.12",
"react-qr-code": "2.0.15",
"regenerator-runtime": "0.14.1",
"rxjs": "7.8.1",
"stream-browserify": "3.0.0",
"stream-http": "3.2.0",
"tslib": "2.6.2",
"tslib": "2.6.3",
"url": "0.11.0",
"viem": "2.16.2",
"wagmi": "2.10.9",
Expand All @@ -152,6 +147,7 @@
"@angular/compiler-cli": "16.1.8",
"@angular/language-service": "15.2.9",
"@babel/preset-react": "7.16.7",
"@babel/runtime": "7.24.8",
"@nrwl/js": "16.0.0",
"@nrwl/rollup": "16.0.0",
"@nrwl/tao": "16.0.0",
Expand Down Expand Up @@ -183,8 +179,8 @@
"@types/react": "18.0.25",
"@types/react-dom": "18.0.9",
"@types/regenerator-runtime": "0.13.1",
"@types/w3c-web-hid": "1.0.2",
"@types/w3c-web-usb": "1.0.5",
"@types/w3c-web-hid": "1.0.3",
"@types/w3c-web-usb": "1.0.6",
"@typescript-eslint/eslint-plugin": "5.58.0",
"@typescript-eslint/parser": "5.58.0",
"babel-jest": "29.4.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.11",
"version": "8.9.12",
"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.11",
"version": "8.9.12",
"description": "Bitget wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/bitte-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/bitte-wallet",
"version": "8.9.11",
"version": "8.9.12",
"description": "Bitte 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.11",
"version": "8.9.12",
"description": "Coin 98 wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
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.11",
"version": "8.9.12",
"description": "This is the core package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/lib/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
export const PACKAGE_NAME = "near-wallet-selector";
export const RECENTLY_SIGNED_IN_WALLETS = "recentlySignedInWallets";
export const REMEMBER_RECENT_WALLETS = "rememberRecentWallets";
export const REMEMBER_RECENT_WALLETS_STATE = {
ENABLED: "enabled",
DISABLED: "disabled",
};

export const CONTRACT = "contract";
export const PENDING_CONTRACT = "contract:pending";
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/lib/locale/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"useAWallet": "استخدم محفظة لتأمين وإدارة أصول نير الخاصة بك، وادخل لأي تطبيق يستخدم نير دون الحاجة إلى اسم المستخدم وكلمةالمرور",
"connectionFailed": "اتصال فاشل",
"connectionSuccessful": "اتصال ناجح",
"rememberWallet": "تذكر المحافظ",
"connected": "متصل",
"connectingTo": "جاري الاتصال ب",
"connectingMessage": {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/lib/locale/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"useAWallet": "Използвайте портфейла, за да защитите и управлявате активите си на NEAR както и да използвате всяко приложение на NEAR без нужда от потребителски имена и пароли.",
"connectionFailed": "Свързването неуспешно",
"connectionSuccessful": "Свързването успешно",
"rememberWallet": "Запази портфейлите",
"connected": "Свързан",
"connectingTo": "Свързване към",
"connectingMessage": {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/lib/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"useAWallet": "Use a wallet to secure and manage your NEAR assets, and to log in to any NEAR app without the need for usernames and passwords.",
"connectionFailed": "Connection Failed",
"connectionSuccessful": "Connection Successful",
"rememberWallet": "Remember wallets",
"connected": "Connected",
"connectingTo": "Connecting to",
"connectingMessage": {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/lib/locale/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"useAWallet": "Usa tu Billetera para resguardar y administrar tus activos en NEAR, e Iniciar sesión en cualquier aplicacion NEAR sin la necesidad de nombres de usuarios y contraseñas",
"connectionFailed": "Conexión Fallida",
"connectionSuccessful": "Conexión Existosa",
"rememberWallet": "Recordar las carteras",
"connected": "Conectado",
"connectingTo": "Conectando a ",
"connectingMessage": {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/lib/locale/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"useAWallet": "अपनी NEAR संपत्तियों को सुरक्षित और प्रबंधित करने के लिए वॉलेट का उपयोग करें और किसी भी NEAR ऐप (app) में लॉग इन करें, किसी उपयोगकर्ता (user) नाम और पासवर्ड की आवश्यकता नहीं है।",
"connectionFailed": "कनेक्शन विफल|",
"connectionSuccessful": "कनेक्शन सफल|",
"rememberWallet": "वॉलेटों को याद रखें",
"connected": "वॉलेट जुड़ गया|",
"connectingTo": "वॉलेट जुड़ रहा हे|",
"connectingMessage": {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/lib/locale/hr.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"useAWallet": "Koristite crypto novčanik da biste osigurali i upravljali svojom NEAR imovinom, te se prijavite u bilo koju NEAR aplikaciju bez korisničkog imena i lozinke.",
"connectionFailed": "Neuspješno povezivanje.",
"connectionSuccessful": "Uspješno povezivanje.",
"rememberWallet": "Zapamti novčanike",
"connected": "Povezano.",
"connectingTo": "Povezivanje u tijeku",
"connectingMessage": {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/lib/locale/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"useAWallet": "지갑을 사용하여 NEAR 자산을 보호·관리하고, 아이디와 비밀번호 없이 NEAR 앱에 로그인할 수 있습니다.",
"connectionFailed": "연결 실패",
"connectionSuccessful": "연결 성공",
"rememberWallet": "지갑들 기억하기",
"connected": "Connected",
"connectingTo": "연결 중: ",
"connectingMessage": {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/lib/locale/mk.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"useAWallet": "Користете паричник за да ги заштитите и управувате вашите NEAR средства и да се најавите на која било NEAR апликација без потреба од кориснички имиња и лозинки.",
"connectionFailed": "Поврзувањето не беше успешно.",
"connectionSuccessful": "Успешно поврзување.",
"rememberWallet": "Запомни паричници",
"connected": "Поврзано.",
"connectingTo": "Поврзување со",
"connectingMessage": {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/lib/locale/sl.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"useAWallet": "Uporabite denarnico, da bi zavarovali in upravljali s svoja NEAR digitalna sredstva, in se prijavite v katero koli aplikacijo ekosistema NEAR",
"connectionFailed": "Povezava ni bila uspešna.",
"connectionSuccessful": "Povezava je bila uspešna.",
"rememberWallet": "Zapomni si denarnice",
"connected": "Vaša denarnica je povezana.",
"connectingTo": "Povezovanje z",
"connectingMessage": {
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/lib/locale/sr.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"useAWallet": "Користите новчаник да обезбедите и управљате својим NEAR средствима и да се пријавите у било коју апликацију NEAR без потребе за корисничким именима и лозинкама.",
"connectionFailed": "Веза није успостављена.",
"connectionSuccessful": "Веза је успела.",
"rememberWallet": "Запамти новчанике",
"connected": "Повезан.",
"connectingTo": "Повезивање на",
"connectingMessage": {
Expand Down Expand Up @@ -103,4 +104,4 @@
}
}
}
}
}
1 change: 1 addition & 0 deletions packages/core/src/lib/locale/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"useAWallet": "Sử dụng ví để bảo mật và quản lý tài sản trên NEAR của bạn và đăng nhập vào bất kỳ ứng dụng NEAR nào, không cần tên người dùng và mật khẩu.",
"connectionFailed": "Kết nối thất bại",
"connectionSuccessful": "Kết nối thành công",
"rememberWallet": "Ghi nhớ lựa chọn ví",
"connected": "Đã kết nối",
"connectingTo": "Đang kết nối tới",
"connectingMessage": {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/lib/locale/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"useAWallet": "使用钱包来保护和管理你的 NEAR 资产,无需用户名和密码即可登录任何 NEAR 应用",
"connectionFailed": "连接失败",
"connectionSuccessful": "连接成功",
"rememberWallet": "记住钱包选择",
"connected": "已连接",
"connectingTo": "正在连接"
},
Expand Down
40 changes: 38 additions & 2 deletions packages/core/src/lib/options.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getNetworkPreset, resolveNetwork } from "./options";
import type { NetworkId, Network } from "./options.types";

describe("getNetworkPreset", () => {
it("returns the correct config for 'mainnet'", () => {
it("returns the correct config for 'mainnet' without fallbackRpcUrls", () => {
const networkId: NetworkId = "mainnet";
const network = getNetworkPreset(networkId);

Expand All @@ -15,7 +15,25 @@ describe("getNetworkPreset", () => {
});
});

it("returns the correct config for 'testnet'", () => {
it("returns the correct config for 'mainnet' with fallbackRpcUrls", () => {
const networkId: NetworkId = "mainnet";
const fallbackRpcUrls: Array<string> = [
"https://rpc1.mainnet.near.org",
"https://rpc2.mainnet.near.org",
"https://rpc3.mainnet.near.org",
];
const network = getNetworkPreset(networkId, fallbackRpcUrls);

expect(network).toEqual({
networkId,
nodeUrl: "https://rpc1.mainnet.near.org",
helperUrl: "https://helper.mainnet.near.org",
explorerUrl: "https://nearblocks.io",
indexerUrl: "https://api.kitwallet.app",
});
});

it("returns the correct config for 'testnet' without fallbackRpcUrls", () => {
const networkId: NetworkId = "testnet";
const network = getNetworkPreset(networkId);

Expand All @@ -27,6 +45,24 @@ describe("getNetworkPreset", () => {
indexerUrl: "https://testnet-api.kitwallet.app",
});
});

it("returns the correct config for 'testnet' with fallbackRpcUrls", () => {
const networkId: NetworkId = "testnet";
const fallbackRpcUrls: Array<string> = [
"https://rpc1.testnet.near.org",
"https://rpc2.testnet.near.org",
"https://rpc3.testnet.near.org",
];
const network = getNetworkPreset(networkId, fallbackRpcUrls);

expect(network).toEqual({
networkId,
nodeUrl: "https://rpc1.testnet.near.org",
helperUrl: "https://helper.testnet.near.org",
explorerUrl: "https://testnet.nearblocks.io",
indexerUrl: "https://testnet-api.kitwallet.app",
});
});
});

describe("resolveNetwork", () => {
Expand Down
9 changes: 6 additions & 3 deletions packages/core/src/lib/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@ import type { WalletSelectorParams } from "./wallet-selector.types";
import type { Options, Network, NetworkId } from "./options.types";
import { WebStorageService } from "./services";

export const getNetworkPreset = (networkId: NetworkId): Network => {
export const getNetworkPreset = (
networkId: NetworkId,
fallbackRpcUrls?: Array<string>
): Network => {
switch (networkId) {
case "mainnet":
return {
networkId,
nodeUrl: "https://rpc.mainnet.near.org",
nodeUrl: fallbackRpcUrls?.[0] || "https://rpc.mainnet.near.org",
helperUrl: "https://helper.mainnet.near.org",
explorerUrl: "https://nearblocks.io",
indexerUrl: "https://api.kitwallet.app",
};
case "testnet":
return {
networkId,
nodeUrl: "https://rpc.testnet.near.org",
nodeUrl: fallbackRpcUrls?.[0] || "https://rpc.testnet.near.org",
helperUrl: "https://helper.testnet.near.org",
explorerUrl: "https://testnet.nearblocks.io",
indexerUrl: "https://testnet-api.kitwallet.app",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const setup = (url: string) => {

return {
provider,
service: new Provider(url),
service: new Provider([url]),
};
};

Expand Down
Loading

0 comments on commit eb758a2

Please sign in to comment.