-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
👌 IMPROVE: Add derive path support to sign transaction / preview tran…
…saction api
- Loading branch information
1 parent
8aafb43
commit 4a1d46c
Showing
4 changed files
with
21 additions
and
19 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import { mvc } from 'meta-contract' | ||
import { getCurrentAccount, privateKey } from '../account' | ||
import { signTransaction } from '../crypto' | ||
import { getNetwork } from '../network' | ||
|
||
export async function process(params: any, host: string) { | ||
const wif = await getCurrentAccount().then(() => privateKey.value) | ||
const { txid } = signTransaction(wif, params.transaction, true) | ||
const account = await getCurrentAccount() | ||
const network = await getNetwork() | ||
|
||
const { txid } = signTransaction(account!, network, params.transaction, true) | ||
|
||
return { txid } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,13 @@ | ||
import { getAddress, getCurrentAccount, privateKey } from '../account' | ||
import connector from '../connector' | ||
import { signTransaction } from '../crypto' | ||
import { getNetwork } from '../network' | ||
|
||
export async function process(params: any, host: string) { | ||
const wif = await getCurrentAccount().then((account) => privateKey.value) | ||
const account = await getCurrentAccount() | ||
const network = await getNetwork() | ||
|
||
// let sigList = [] | ||
// for (let i = 0; i < params.list.length; i++) { | ||
// sigList[i] = sign(wif, params.list[i]) | ||
// } | ||
if (params.returnsTransaction) { | ||
const { txHex } = signTransaction(wif, params.transaction, params.returnsTransaction) | ||
|
||
return { txHex } | ||
} | ||
|
||
const signature = signTransaction(wif, params.transaction, params.returnsTransaction) | ||
const signature = signTransaction(account!, network, params.transaction) | ||
|
||
return { signature } | ||
} |
Oops, something went wrong.