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

fix: coin98 wallet add signMessage method #1122

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
26 changes: 25 additions & 1 deletion packages/coin98-wallet/src/lib/coin98-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
Account,
Optional,
Transaction,
SignMessageParams,
SignedMessage,
} from "@near-wallet-selector/core";
import { getActiveAccount } from "@near-wallet-selector/core";
import type { InjectedCoin98 } from "./injected-coin98-wallet";
Expand Down Expand Up @@ -105,6 +107,28 @@
return getAccounts();
},

async signMessage({message, nonce, recipient, state}: SignMessageParams): Promise<SignedMessage>{

Check failure on line 110 in packages/coin98-wallet/src/lib/coin98-wallet.ts

View workflow job for this annotation

GitHub Actions / Test Suite

Replace `message,·nonce,·recipient,·state}:·SignMessageParams):·Promise<SignedMessage>` with `⏎······message,⏎······nonce,⏎······recipient,⏎······state,⏎····}:·SignMessageParams):·Promise<SignedMessage>·`
if (!_state.wallet) {
throw new Error("Wallet is not installed");
}

logger.log("Coin98:signMessage", {
message,
nonce,
recipient,
state,
});

const signature = await _state.wallet.near.signMessage({
message,
nonce,
recipient,
state,
});

Check failure on line 128 in packages/coin98-wallet/src/lib/coin98-wallet.ts

View workflow job for this annotation

GitHub Actions / Test Suite

Delete `····`
return signature;
},

async signOut() {
// Ignore if unsuccessful (returns false).
await _state.wallet.near.disconnect();
Expand All @@ -129,7 +153,7 @@
return provider.sendTransaction(signedTransactions[0]);
},

async signAndSendTransactions({ transactions }) {
async signAndSendTransactions({ transactions }) {

Check failure on line 156 in packages/coin98-wallet/src/lib/coin98-wallet.ts

View workflow job for this annotation

GitHub Actions / Test Suite

Delete `····························`
logger.log("signAndSendTransactions", { transactions });

const signedTransactions = await signTransactions(
Expand Down
2 changes: 2 additions & 0 deletions packages/coin98-wallet/src/lib/injected-coin98-wallet.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { SignedMessage, SignMessageParams } from "@near-wallet-selector/core";

Check failure on line 1 in packages/coin98-wallet/src/lib/injected-coin98-wallet.ts

View workflow job for this annotation

GitHub Actions / Test Suite

All imports in the declaration are only used as types. Use `import type`
import type { Signer } from "near-api-js/lib/signer";

interface IConnectParams {
Expand All @@ -10,6 +11,7 @@
signer: Signer;
connect: (params: IConnectParams) => Promise<string>;
disconnect: () => Promise<void>;
signMessage: (params: SignMessageParams) => Promise<SignedMessage>;
}

export interface InjectedCoin98 {
Expand Down
Loading