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

feat: Ledger sing message support #1

Open
wants to merge 29 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1340183
Merge pull request #1204 from near/dev
Sep 11, 2024
2fd7c12
Merge pull request #1220 from near/dev
gtsonevv Oct 23, 2024
ca6d30d
Remove @near-js/ aliasis from tsconfig.base.json.
kujtimprenku Nov 3, 2024
864fce7
Remove @near-js import and use the near-api-js directly.
kujtimprenku Nov 3, 2024
5fde290
Remove un-necessary peer dependency @near-js/providers.
kujtimprenku Nov 3, 2024
54ae22c
Bump borsh to v1.0.0 and remove the better-sqlite3
kujtimprenku Nov 3, 2024
a63530c
feat: add to devtools projet workflow
thisisjoshford Nov 22, 2024
6d80d51
feat(ledger): add sign message to ledger
JordiParraCrespo Dec 10, 2024
170480b
test(ledger): update test for ledger and ledger-client with sign message
JordiParraCrespo Dec 10, 2024
9e64910
fix(ledger): improve error message
JordiParraCrespo Dec 10, 2024
8c48c13
style(ledger): lint the code
JordiParraCrespo Dec 10, 2024
6611c19
Merge pull request #1229 from kujtimprenku/fix/mintbase-js-and-naj
gtsonevv Dec 13, 2024
5deac85
Merge pull request #1230 from kujtimprenku/fix/remove-near-js-individ…
gtsonevv Dec 13, 2024
37616ba
Merge pull request #1231 from kujtimprenku/feat/bump-borsh-dependency
gtsonevv Dec 13, 2024
8174d32
chore-bump-version-v8.9.15
gtsonevv Dec 13, 2024
b67dbba
Merge pull request #1268 from near/chore-bump-version-v8.9.15
gtsonevv Dec 13, 2024
f7ca952
Merge pull request #1269 from near/dev
gtsonevv Dec 13, 2024
9a0e570
Merge branch 'dev' of github.com:near/wallet-selector into HEAD
JordiParraCrespo Dec 19, 2024
8836b90
fix(ledger): update to new borsh version
JordiParraCrespo Dec 19, 2024
cf89e92
fix: define range of `near-api-js` versions as peerDependency instead…
denbite Dec 30, 2024
f172cdc
feat: meteor wallet in app selector
Elabar Jan 2, 2025
d7e5f73
chore: update readme
Elabar Jan 2, 2025
3a83dd0
chore: code linting
Elabar Jan 2, 2025
93ae2de
Merge pull request #1272 from near/update_peer_dependencies
denbite Jan 7, 2025
86655df
feat: use nonce instead of incremental promise id
Elabar Jan 9, 2025
5cfc978
feat: allow post message for all sites, add a source tag in message
Elabar Jan 9, 2025
2429bd6
feat: pass window location href
Elabar Jan 14, 2025
69ab20d
Merge pull request #1275 from Elabar/meteor-wallet-mobile-app
trechriron Jan 17, 2025
41030ba
Merge branch 'dev' of github.com:near/wallet-selector into ledger/fea…
JordiParraCrespo Jan 17, 2025
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
22 changes: 22 additions & 0 deletions .github/workflows/add-to-devtools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: 'Add to DevTools Project'

on:
issues:
types:
- opened
- reopened
pull_request:
types:
- opened
- reopened

jobs:
add-to-project:
name: Add issue/PR to project
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
# add to DevTools Project #156
project-url: https://github.com/orgs/near/projects/156
github-token: ${{ secrets.GH_TOKEN }}
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ NEAR Wallet Selector makes it easy for users to interact with your dApp by provi
- [Math Wallet](https://www.npmjs.com/package/@near-wallet-selector/math-wallet) - Injected wallet.
- [Metamask Snap](https://www.npmjs.com/package/@near-wallet-selector/near-snap) - Injected wallet.
- [Meteor Wallet](https://www.npmjs.com/package/@near-wallet-selector/meteor-wallet) - Injected wallet.
- [Meteor Wallet App](https://www.npmjs.com/package/@near-wallet-selector/meteor-wallet-app) - Instant link wallet.
- [Mintbase Wallet](https://www.npmjs.com/package/@near-wallet-selector/mintbase-wallet) - Browser wallet.
- [My NEAR Wallet](https://www.npmjs.com/package/@near-wallet-selector/my-near-wallet) - Browser wallet.
- [Narwallets](https://www.npmjs.com/package/@near-wallet-selector/narwallets) - Injected wallet.
Expand Down Expand Up @@ -64,6 +65,7 @@ yarn add \
@near-wallet-selector/math-wallet \
@near-wallet-selector/nightly \
@near-wallet-selector/meteor-wallet \
@near-wallet-selector/meteor-wallet-app \
@near-wallet-selector/okx-wallet \
@near-wallet-selector/narwallets \
@near-wallet-selector/welldone-wallet \
Expand Down Expand Up @@ -91,6 +93,7 @@ npm install \
@near-wallet-selector/math-wallet \
@near-wallet-selector/nightly \
@near-wallet-selector/meteor-wallet \
@near-wallet-selector/meteor-wallet-app \
@near-wallet-selector/okx-wallet \
@near-wallet-selector/narwallets \
@near-wallet-selector/welldone-wallet \
Expand Down Expand Up @@ -131,6 +134,7 @@ import { setupNearSnap } from "@near-wallet-selector/near-snap";
import { setupMathWallet } from "@near-wallet-selector/math-wallet";
import { setupNightly } from "@near-wallet-selector/nightly";
import { setupMeteorWallet } from "@near-wallet-selector/meteor-wallet";
import { setupMeteorWalletApp } from "@near-wallet-selector/meteor-wallet-app";
import { setupOkxWallet } from "@near-wallet-selector/okx-wallet";
import { setupNarwallets } from "@near-wallet-selector/narwallets";
import { setupWelldoneWallet } from "@near-wallet-selector/welldone-wallet";
Expand All @@ -156,6 +160,7 @@ const selector = await setupWalletSelector({
setupMathWallet(),
setupNightly(),
setupMeteorWallet(),
setupMeteorWalletApp({ contractId: "guest-book.testnet" }),
setupNearSnap(),
setupOkxWallet(),
setupNarwallets(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { setupXDEFI } from "@near-wallet-selector/xdefi";
import { setupMathWallet } from "@near-wallet-selector/math-wallet";
import { setupNightly } from "@near-wallet-selector/nightly";
import { setupMeteorWallet } from "@near-wallet-selector/meteor-wallet";
import { setupMeteorWalletApp } from "@near-wallet-selector/meteor-wallet-app";
import { setupNarwallets } from "@near-wallet-selector/narwallets";
import { setupWelldoneWallet } from "@near-wallet-selector/welldone-wallet";
import { setupHereWallet } from "@near-wallet-selector/here-wallet";
Expand Down Expand Up @@ -63,6 +64,7 @@ export class WalletSelectorExportComponent implements OnInit {
setupMathWallet(),
setupNightly(),
setupMeteorWallet(),
setupMeteorWalletApp({ contractId: CONTRACT_ID }),
setupNarwallets(),
setupWelldoneWallet(),
setupHereWallet(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { setupXDEFI } from "@near-wallet-selector/xdefi";
import { setupMathWallet } from "@near-wallet-selector/math-wallet";
import { setupNightly } from "@near-wallet-selector/nightly";
import { setupMeteorWallet } from "@near-wallet-selector/meteor-wallet";
import { setupMeteorWalletApp } from "@near-wallet-selector/meteor-wallet-app";
import { setupNarwallets } from "@near-wallet-selector/narwallets";
import { setupWelldoneWallet } from "@near-wallet-selector/welldone-wallet";
import { setupHereWallet } from "@near-wallet-selector/here-wallet";
Expand Down Expand Up @@ -122,6 +123,7 @@ export class WalletSelectorComponent implements OnInit {
setupMathWallet(),
setupNightly(),
setupMeteorWallet(),
setupMeteorWalletApp({ contractId: CONTRACT_ID }),
setupOKXWallet(),
setupNarwallets(),
setupWelldoneWallet(),
Expand Down
2 changes: 2 additions & 0 deletions examples/react/contexts/WalletSelectorContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { setupWalletSelector } from "@near-wallet-selector/core";
import { setupHereWallet } from "@near-wallet-selector/here-wallet";
import { setupMathWallet } from "@near-wallet-selector/math-wallet";
import { setupMeteorWallet } from "@near-wallet-selector/meteor-wallet";
import { setupMeteorWalletApp } from "@near-wallet-selector/meteor-wallet-app";
import { setupNarwallets } from "@near-wallet-selector/narwallets";
import type { WalletSelectorModal } from "@near-wallet-selector/modal-ui";
import { setupModal } from "@near-wallet-selector/modal-ui";
Expand Down Expand Up @@ -162,6 +163,7 @@ export const WalletSelectorContextProvider: React.FC<{
setupMathWallet(),
setupNightly(),
setupMeteorWallet(),
setupMeteorWalletApp({ contractId: CONTRACT_ID }),
setupNearSnap(),
setupOKXWallet(),
setupNarwallets(),
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 @@ -17,6 +17,7 @@ import { setupBitgetWallet } from "@near-wallet-selector/bitget-wallet";
import { setupMathWallet } from "@near-wallet-selector/math-wallet";
import { setupNightly } from "@near-wallet-selector/nightly";
import { setupMeteorWallet } from "@near-wallet-selector/meteor-wallet";
import { setupMeteorWalletApp } from "@near-wallet-selector/meteor-wallet-app";
import { setupWelldoneWallet } from "@near-wallet-selector/welldone-wallet";
import { setupNearFi } from "@near-wallet-selector/nearfi";
import { setupWalletConnect } from "@near-wallet-selector/wallet-connect";
Expand Down Expand Up @@ -67,6 +68,7 @@ export const ExportAccountSelectorContextProvider: React.FC<{
setupMathWallet(),
setupNightly(),
setupMeteorWallet(),
setupMeteorWalletApp({ contractId: CONTRACT_ID }),
setupWelldoneWallet(),
setupHereWallet(),
setupCoin98Wallet(),
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "near-wallet-selector",
"version": "8.9.14",
"version": "8.9.15",
"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 @@ -51,6 +51,7 @@
"build:ledger": "nx run-many --target=build --projects=ledger --configuration=production",
"build:math-wallet": "nx run-many --target=build --projects=math-wallet --configuration=production",
"build:meteor-wallet": "nx run-many --target=build --projects=meteor-wallet --configuration=production",
"build:meteor-wallet-app": "nx run-many --target=build --projects=meteor-wallet-app --configuration=production",
"build:mintbase-wallet": "nx run-many --target=build --projects=mintbase-wallet --configuration=production",
"build:bitte-wallet": "nx run-many --target=build --projects=bitte-wallet --configuration=production",
"build:modal-ui": "nx run-many --target=build --projects=modal-ui --configuration=production",
Expand Down Expand Up @@ -107,9 +108,8 @@
"@walletconnect/modal": "2.6.2",
"@walletconnect/sign-client": "2.13.0",
"@web3modal/wagmi": "5.0.6",
"better-sqlite3": "11.3.0",
"big.js": "6.2.2",
"borsh": "0.7.0",
"borsh": "1.0.0",
"browserify-fs": "1.0.0",
"bs58": "5.0.0",
"buffer": "6.0.3",
Expand Down Expand Up @@ -223,4 +223,4 @@
"webpack": "5.75.0",
"webpack-merge": "5.8.0"
}
}
}
4 changes: 2 additions & 2 deletions 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.14",
"version": "8.9.15",
"description": "This is the Export Selector UI package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand All @@ -21,6 +21,6 @@
},
"homepage": "https://github.com/near/wallet-selector/tree/magin/packages/account-export",
"peerDependencies": {
"near-api-js": "4.0.3"
"near-api-js": "^4.0.0 || ^5.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/arepa-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/arepa-wallet",
"version": "8.9.14",
"version": "8.9.15",
"description": "Arepa Wallet 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.14",
"version": "8.9.15",
"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.14",
"version": "8.9.15",
"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.14",
"version": "8.9.15",
"description": "Coin 98 wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
7 changes: 3 additions & 4 deletions 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.14",
"version": "8.9.15",
"description": "This is the core package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand All @@ -20,7 +20,6 @@
},
"homepage": "https://github.com/near/wallet-selector/tree/main/packages/core",
"peerDependencies": {
"near-api-js": "4.0.3",
"@near-js/providers": "latest"
"near-api-js": "^4.0.0 || ^5.0.0"
}
}
}
31 changes: 10 additions & 21 deletions packages/core/src/lib/helpers/verify-signature/payload.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { SignMessageParams } from "../../wallet";
import type { Schema } from "borsh";
import { serialize } from "borsh";

export class Payload {
Expand All @@ -21,27 +22,15 @@ export class Payload {
}
}

export const payloadSchema = new Map([
[
Payload,
{
kind: "struct",
fields: [
["tag", "u32"],
["message", "string"],
["nonce", [32]],
["recipient", "string"],
[
"callbackUrl",
{
kind: "option",
type: "string",
},
],
],
},
],
]);
export const payloadSchema: Schema = {
struct: {
tag: "u32",
message: "string",
nonce: { array: { type: "u8", len: 32 } },
recipient: "string",
callbackUrl: { option: "string" },
},
};

export const serializeNep413 = (
signMessageParams: SignMessageParams
Expand Down
10 changes: 6 additions & 4 deletions packages/core/src/lib/wallet-selector.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { setupWalletSelector } from "./wallet-selector";
import { FailoverRpcProvider } from "@near-js/providers";
import { getNetworkPreset } from "./options";
import { JsonRpcProvider } from "near-api-js/lib/providers";
import {
JsonRpcProvider,
FailoverRpcProvider,
} from "near-api-js/lib/providers";
import type { Network } from "./options.types";
import type { Store } from "./store.types";
import type { WalletModuleFactory } from "./wallet";
Expand Down Expand Up @@ -52,8 +54,8 @@ jest.mock("./store", () => {
};
});

jest.mock("@near-js/providers", () => {
const originalModule = jest.requireActual("@near-js/providers");
jest.mock("near-api-js/lib/providers", () => {
const originalModule = jest.requireActual("near-api-js/lib/providers");
return {
...originalModule,
FailoverRpcProvider: jest.fn(),
Expand Down
2 changes: 1 addition & 1 deletion packages/ethereum-wallets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/ethereum-wallets",
"version": "8.9.14",
"version": "8.9.15",
"description": "Ethereum wallets package for NEAR Wallet Selector.",
"keywords": [
"near",
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.14",
"version": "8.9.15",
"description": "Here wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
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.14",
"version": "8.9.15",
"description": "Ledger package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
Loading
Loading