Skip to content

Commit

Permalink
add support sigmMessage in nightly wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
Pawel-Szydlo committed Sep 12, 2023
1 parent 58eb483 commit e7a22cf
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/nightly/src/lib/injected-nightly.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import type { AccountImportData } from "@near-wallet-selector/core";
import type {
AccountImportData,
SignedMessage,
SignMessageParams,
} from "@near-wallet-selector/core";
import type {
SignedTransaction as NearSignedTransaction,
Transaction as NearTransaction,
Expand All @@ -11,6 +15,7 @@ interface NightlyAccount {
export interface NearNightly {
account: NightlyAccount;
connected: boolean;
signMessage: (params: SignMessageParams) => Promise<SignedMessage>;
signTransaction: (
transaction: NearTransaction
) => Promise<NearSignedTransaction>;
Expand Down
18 changes: 18 additions & 0 deletions packages/nightly/src/lib/nightly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,24 @@ const Nightly: WalletBehaviourFactory<InjectedWallet> = async ({
throw new Error(`Method not supported by ${metadata.name}`);
},

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

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

return signature;
},

async signAndSendTransaction({ signerId, receiverId, actions }) {
logger.log("signAndSendTransaction", { signerId, receiverId, actions });

Expand Down

0 comments on commit e7a22cf

Please sign in to comment.