Skip to content

Commit

Permalink
Merge pull request #913 from nightly-labs/main
Browse files Browse the repository at this point in the history
add support signMessage in nightly wallet
  • Loading branch information
erditkurteshiSQA authored Sep 18, 2023
2 parents 4bfd4f6 + 6856a35 commit 730c89b
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/change_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Change request
about: Template for change requests
title: ''
labels: task
labels: change-request
assignees: ''

---
Expand Down
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/epic-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Epic Template
about: Epics are milestones or groups of alike issues
title: "[Epic] "
labels: Emerging Tech, Epic, Near BOS
assignees: ''

---

### Description

(Overview of milestone or function governed by this epic)

### Resources

(Relevant documentation, Figma links, and other reference material)

Item 1

Item 2

Item 3

```[tasklist]
### Related Issues
```
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/issue-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Issue Template
about: Issues are general tasks to be compeleted
title: ''
labels: Emerging Tech, Near BOS
assignees: ''

---

### Description

(Summary of task, purpose, impact)

### Optional: User Story

(As a [user], I need [function, outcome, enhancement] that [provides value].)
9 changes: 7 additions & 2 deletions 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 @@ -10,7 +14,8 @@ interface NightlyAccount {
}
export interface NearNightly {
account: NightlyAccount;
connected: boolean;
isConnected: boolean;
signMessage: (params: SignMessageParams) => Promise<SignedMessage>;
signTransaction: (
transaction: NearTransaction
) => Promise<NearSignedTransaction>;
Expand Down
22 changes: 22 additions & 0 deletions packages/nightly/src/lib/nightly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,28 @@ 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,
});

if (_state.wallet.isConnected) {
await _state.wallet.connect();
}

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 730c89b

Please sign in to comment.