Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion examples/react/contexts/WalletSelectorContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { setupMintbaseWallet } from "@near-wallet-selector/mintbase-wallet";
import { setupBitteWallet } from "@near-wallet-selector/bitte-wallet";
import { setupOKXWallet } from "@near-wallet-selector/okx-wallet";
import { setupEthereumWallets } from "@near-wallet-selector/ethereum-wallets";
import { setupSweatWallet } from "@near-wallet-selector/sweat-wallet";

import type { ReactNode } from "react";
import React, {
Expand All @@ -53,7 +54,6 @@ import { injected, walletConnect } from "@wagmi/connectors";

import { Loading } from "../components/Loading";
import { CONTRACT_ID } from "../constants";

declare global {
interface Window {
selector: WalletSelector;
Expand Down Expand Up @@ -190,6 +190,7 @@ export const WalletSelectorContextProvider: React.FC<{
setupMintbaseWallet({ contractId: CONTRACT_ID }),
setupBitteWallet({ contractId: CONTRACT_ID }),
setupEthereumWallets({ wagmiConfig, web3Modal }),
setupSweatWallet(),
],
});
const _modal = setupModal(_selector, {
Expand Down
2 changes: 2 additions & 0 deletions examples/react/contexts/WalletSelectorExportContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { setupRamperWallet } from "@near-wallet-selector/ramper-wallet";
import { setupNearMobileWallet } from "@near-wallet-selector/near-mobile-wallet";
import { setupMintbaseWallet } from "@near-wallet-selector/mintbase-wallet";
import { setupBitteWallet } from "@near-wallet-selector/bitte-wallet";
import { setupSweatWallet } from "@near-wallet-selector/sweat-wallet";
import { CONTRACT_ID } from "../constants";

declare global {
Expand Down Expand Up @@ -86,6 +87,7 @@ export const ExportAccountSelectorContextProvider: React.FC<{
},
}),
setupNearMobileWallet(),
setupSweatWallet(),
],
});
/**
Expand Down
2 changes: 1 addition & 1 deletion examples/react/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
"export": {
"executor": "@nx/next:export",
"options": {
"buildTarget": "next:build:production"
"buildTarget": "react:build:production"
}
},
"lint": {
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"near-mobile-wallet",
"mintbase-wallet",
"bitte-wallet",
"okx-wallet"
"okx-wallet",
"sweat-wallet"
],
"homepage": "https://github.com/near/wallet-selector#README",
"bugs": {
Expand Down Expand Up @@ -72,6 +73,7 @@
"build:wallet-utils": "nx run-many --target=build --projects=wallet-utils --configuration=production",
"build:welldone-wallet": "nx run-many --target=build --projects=welldone-wallet --configuration=production",
"build:xdefi-wallet": "nx run-many --target=build --projects=xdefi --configuration=production",
"build:sweat-wallet": "nx run-many --target=build --projects=sweat-wallet --configuration=production",
"examples:vanillajs:generateimportmap": "(cd examples/vanillajs && jspm link index.html -o index.html)",
"find:unused": "ts-prune -p tsprune.json",
"postinstall": "yarn build:all",
Expand Down Expand Up @@ -106,6 +108,7 @@
"@noble/hashes": "1.4.0",
"@peersyst/near-mobile-signer": "1.1.4",
"@ramper/near": "0.0.30",
"@sweatco/wallet-selector": "1.0.0-alpha.3",
"@tanstack/react-query": "5.24.8",
"@walletconnect/modal": "2.6.2",
"@walletconnect/sign-client": "2.13.0",
Expand Down
6 changes: 4 additions & 2 deletions packages/modal-ui/src/lib/components/WalletConnecting.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { Fragment } from "react";
import type { Wallet } from "@near-wallet-selector/core";
import LoadingIcon from "../images/connecting-loader.png";
import { ModalHeader } from "./ModalHeader";
import { translate } from "@near-wallet-selector/core";

Expand All @@ -25,7 +24,10 @@ export const WalletConnecting: React.FC<WalletConnectingProps> = ({
<h3 className="connecting-name">{wallet?.metadata.name}</h3>
<div className="connecting-details">
<div className="spinner">
<img src={LoadingIcon} alt="loading-icon" />
<img
src={require("../images/connecting-loader.png")}
alt="loading-icon"
/>
</div>
<span>
{translate("modal.wallet.connectingTo")} {wallet?.metadata.name}
Expand Down
18 changes: 18 additions & 0 deletions packages/sweat-wallet/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
11 changes: 11 additions & 0 deletions packages/sweat-wallet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# sweat-wallet

This library was generated with [Nx](https://nx.dev).

## Building

Run `nx build sweat-wallet` to build the library.

## Running unit tests

Run `nx test sweat-wallet` to execute the unit tests via [Jest](https://jestjs.io).
10 changes: 10 additions & 0 deletions packages/sweat-wallet/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* eslint-disable */
export default {
displayName: "sweat-wallet",
preset: "../../jest.preset.js",
transform: {
"^.+\\.[tj]s$": ["ts-jest", { tsconfig: "<rootDir>/tsconfig.spec.json" }],
},
moduleFileExtensions: ["ts", "js", "html"],
coverageDirectory: "../../coverage/packages/sweat-wallet",
};
5 changes: 5 additions & 0 deletions packages/sweat-wallet/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@near-wallet-selector/sweat-wallet",
"version": "0.0.1",
"description": "Sweat Wallet package for NEAR Wallet Selector."
}
44 changes: 44 additions & 0 deletions packages/sweat-wallet/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "sweat-wallet",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/sweat-wallet/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/sweat-wallet",
"main": "packages/sweat-wallet/src/index.ts",
"tsConfig": "packages/sweat-wallet/tsconfig.lib.json",
"assets": ["packages/sweat-wallet/*.md"]
}
},
"publish": {
"command": "node tools/scripts/publish.mjs sweat-wallet {args.ver} {args.tag}",
"dependsOn": ["build"]
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/sweat-wallet/**/*.ts"]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "packages/sweat-wallet/jest.config.ts",
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
}
},
"tags": ["injected-wallet"]
}
1 change: 1 addition & 0 deletions packages/sweat-wallet/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./lib/sweat-wallet";
1 change: 1 addition & 0 deletions packages/sweat-wallet/src/lib/icon.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAA8UExURf4Jdf+wzP+Wu//z9/8+hv96qv/L3v////8Mdf/l7v4Ndf95qv+jxP8qfv9Oj//Y5f+91f9dmf+Hs/9roRvStz8AAAI4SURBVFjD1ZnbkoMwCIaNJub3UGu77/+ue9FqDhASd+nMLnfF6Td/CQihXVexGYnN3a8MvOnSfohE1ZRx15CAKhEXTJvXQMRl0+bJRECXCOgSAV0ioEsEdImAMlEbCOgSAWUiebpMh9nTtx8uVwWSh9vgD9sPnzldU02ixPP+8fKtkauvEPMHdoq+/NbTJy4rAmWe9y7neW9EiRWen4Bn5vK2HXi7n6CD7JYTNIgSZd6wuYzivbENElPXHnjAmP3QPRz22AgMybYAsCnvfosizGb3nPPWhBfz37xwPlNJYvyxz1PXMsknSkyBjpaCocnsJIkp8NSz0qSMimMSCnBOQ9jTI+ypni+pADu+SKL4MHpGIbuzLGTi46geKbvzQhYkGpqtpg4UJPomieTd1RYyUyxAAnw0haxcgPT1b5r09KXspkArhMyJp1cAShIn8fRKwMaQHa5nFdhYgI4vQA54sQDXKpCJjx2onpXN7vz6yh9h1FkNfRm7tAc0SEw6tS283NkWwIcs7fwvic/CnFMCxgUYOnWQGDr/SvsoSwzZnfP8GPMMs0FggSG7Q+c/jypMe2N9csglhjFkOY9qSDt1ZbgB7chH5ydj2a1pnCN5dh6my3gWV4BpsvRJNpW6qHypcHSofrTxSrcUpt7CZDJsl64BrwlhfFs0mRyucbt4UVG/Sf2By96/uy/rrwj0lxj6axb9RZD+qkp/maa/7tNfSH5gZaq/1P3A2ll/Mf6B1b3EVP3Hogr7Bvz9mPgeLhfRAAAAAElFTkSuQmCC";
25 changes: 25 additions & 0 deletions packages/sweat-wallet/src/lib/sweat-wallet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type {
WalletModuleFactory,
InjectedWallet,
} from "@near-wallet-selector/core";
import { initSweatWallet } from "@sweatco/wallet-selector";

import iconUrl from "./icon";

export function setupSweatWallet(): WalletModuleFactory<InjectedWallet> {
return async () => {
return {
id: "sweat-wallet",
type: "injected",
metadata: {
iconUrl,
name: "SWEAT Wallet",
description: "SWEAT Wallet for NEAR Protocol",
downloadUrl: "https://sweateconomy.org",
deprecated: false,
available: true,
},
init: initSweatWallet,
};
};
}
22 changes: 22 additions & 0 deletions packages/sweat-wallet/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}
10 changes: 10 additions & 0 deletions packages/sweat-wallet/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"include": ["src/**/*.ts"],
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
}
14 changes: 14 additions & 0 deletions packages/sweat-wallet/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}
3 changes: 3 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
"@near-wallet-selector/here-wallet": [
"packages/here-wallet/src/index.ts"
],
"@near-wallet-selector/sweat-wallet": [
"packages/sweat-wallet/src/index.ts"
],
"@near-wallet-selector/ledger": [
"packages/ledger/src/index.ts"
],
Expand Down
36 changes: 8 additions & 28 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7270,6 +7270,11 @@
dependencies:
"@swc/counter" "^0.1.3"

"@sweatco/wallet-selector@1.0.0-alpha.3":
version "1.0.0-alpha.3"
resolved "https://registry.yarnpkg.com/@sweatco/wallet-selector/-/wallet-selector-1.0.0-alpha.3.tgz#3f992289e3cfb085942c83e2066d16fe1bb81f90"
integrity sha512-H6WgvEGgv56ordgFU62Df3vC2y1OMoV80WddobNXgC6efZXJyQAtSM8hSm/2A6SWseuUqkzsHrnH+BBX8Yqcpg==

"@tanstack/query-core@5.24.8":
version "5.24.8"
resolved "https://registry.yarnpkg.com/@tanstack/query-core/-/query-core-5.24.8.tgz#b407546a726ecd4d60b8682dec2ca84ac9eab81e"
Expand Down Expand Up @@ -21956,16 +21961,7 @@ string-range@~1.2, string-range@~1.2.1:
resolved "https://registry.yarnpkg.com/string-range/-/string-range-1.2.2.tgz#a893ed347e72299bc83befbbf2a692a8d239d5dd"
integrity sha512-tYft6IFi8SjplJpxCUxyqisD3b+R2CSkomrtJYCkvuf1KuCAWgz7YXt4O0jip7efpfCemwHEzTEAO8EuOYgh3w==

"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -22064,14 +22060,7 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -23884,7 +23873,7 @@ wordwrap@^1.0.0:
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -23902,15 +23891,6 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down