Skip to content

Commit

Permalink
Merge pull request #142 from stakwork/fix-key-x
Browse files Browse the repository at this point in the history
Fix key x
  • Loading branch information
Evanfeenstra authored Jan 5, 2021
2 parents bec235c + 18df4c5 commit 5fc7eff
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 9 deletions.
Binary file added dist/public/favicon.ico
Binary file not shown.
5 changes: 3 additions & 2 deletions dist/src/controllers/contacts.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/src/controllers/contacts.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/src/controllers/queries.js.map

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion dist/src/helpers.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/src/helpers.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/controllers/contacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,10 @@ export const receiveContactKey = async (payload) => {
console.log("DID NOT FIND SENDER")
}

if (msgIncludedContactKey && sender) {
if (msgIncludedContactKey) {
helpers.sendContactKeys({
contactIds: [sender.id],
contactPubKey: sender_contact_key,
contactIds: sender ? [sender.id] : [],
sender: owner,
type: constants.message_types.contact_key_confirmation,
})
Expand Down
7 changes: 7 additions & 0 deletions src/controllers/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ import { Op } from 'sequelize'
import fetch from 'node-fetch'
import * as helpers from '../helpers'

/*
make the keysend go over the just-created channel
add columns: txid for the onchain payment
commit_fee, local_reserve, remote_reserve, hardcoded AMT
*/


type QueryType = 'onchain_address'
export interface Query {
type: QueryType
Expand Down
14 changes: 13 additions & 1 deletion src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,21 @@ export const findOrCreateChat = async (params) => {
return chat
}

export const sendContactKeys = async ({ type, contactIds, sender, success, failure, dontActuallySendContactKey }:{type:number,contactIds:number[],sender:any,success?:Function,failure?:Function,dontActuallySendContactKey?:boolean}) => {
export const sendContactKeys = async ({ type, contactIds, sender, success, failure, dontActuallySendContactKey, contactPubKey }:{type:number,contactIds:number[],sender:any,success?:Function,failure?:Function,dontActuallySendContactKey?:boolean,contactPubKey?:string}) => {
const msg = newkeyexchangemsg(type, sender, dontActuallySendContactKey||false)

if(contactPubKey) { // dont use ids here
performKeysendMessage({
sender,
destination_key: contactPubKey,
amount: 3,
msg,
success,
failure
})
return
}

let yes: any = null
let no: any = null
let cids = contactIds || []
Expand Down

0 comments on commit 5fc7eff

Please sign in to comment.