From 483113bcf0c382243d19087299cdcc18af084800 Mon Sep 17 00:00:00 2001 From: theocdl Date: Wed, 7 Feb 2024 19:27:06 +0100 Subject: [PATCH] Feat: pay function --- badges/coverage.svg | 2 +- dist/index.js | 11 +++-------- src/main.ts | 17 ++++++++--------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/badges/coverage.svg b/badges/coverage.svg index 8373463..3a6034e 100644 --- a/badges/coverage.svg +++ b/badges/coverage.svg @@ -1 +1 @@ -Coverage: 8.06%Coverage8.06% \ No newline at end of file +Coverage: 7.69%Coverage7.69% \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 1b7a835..4b97329 100644 --- a/dist/index.js +++ b/dist/index.js @@ -11447,25 +11447,20 @@ async function run() { console.log('recipientAddress:', recipientAddress); console.log('privateKey:', privateKey); console.log('amount:', amount); - // TODO: trigger on-chain txs const take = await pattini.take(issueNumber, amount, 'previousCommitHash', recipientAddress); const takeReceipt = await take.wait(1); console.log('take:', takeReceipt.hash); } - else { + else if (action === 'pull_request') { console.log('action:', action); console.log('issueNumber:', issueNumber); console.log('contractAddress:', contractAddress); console.log('pullRequestNumber:', pullRequestNumber); console.log('recipientAddress:', recipientAddress); console.log('privateKey:', privateKey); + const pay = await pattini.pay(issueNumber, parseInt(pullRequestNumber), 'commitHashNew'); + console.log('pay:', pay.hash); } - // pay - // const pullRequestNumber = 88888 - // const commitHash = 'wxyz' - // const pay = await pattini.pay(issueNumber, pullRequestNumber, commitHash) - // const payReceipt = await pay.wait(1) - // console.log('pay:', payReceipt.hash) // core.setOutput('payReceipt', payReceipt.hash) } catch (error) { diff --git a/src/main.ts b/src/main.ts index 3dd8b98..17e5542 100644 --- a/src/main.ts +++ b/src/main.ts @@ -79,7 +79,6 @@ export async function run(): Promise { console.log('privateKey:', privateKey) console.log('amount:', amount) - // TODO: trigger on-chain txs const take = await pattini.take( issueNumber, amount, @@ -89,21 +88,21 @@ export async function run(): Promise { const takeReceipt = await take.wait(1) console.log('take:', takeReceipt.hash) - } else { + } else if (action === 'pull_request') { console.log('action:', action) console.log('issueNumber:', issueNumber) console.log('contractAddress:', contractAddress) console.log('pullRequestNumber:', pullRequestNumber) console.log('recipientAddress:', recipientAddress) console.log('privateKey:', privateKey) - } - // pay - // const pullRequestNumber = 88888 - // const commitHash = 'wxyz' - // const pay = await pattini.pay(issueNumber, pullRequestNumber, commitHash) - // const payReceipt = await pay.wait(1) - // console.log('pay:', payReceipt.hash) + const pay = await pattini.pay( + issueNumber, + parseInt(pullRequestNumber), + 'commitHashNew' + ) + console.log('pay:', pay.hash) + } // core.setOutput('payReceipt', payReceipt.hash) } catch (error) {