-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update from cryptogarageinc v0.2.5 Co-authored-by: k-matsuzawa <[email protected]>
- Loading branch information
1 parent
394aa6e
commit c81813c
Showing
20 changed files
with
409 additions
and
249 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -16,20 +16,14 @@ jobs: | |
wasm-test: | ||
name: wasm test | ||
timeout-minutes: 30 | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-18.04 | ||
strategy: | ||
matrix: | ||
node: [8, 12, 14] | ||
node: [8, 12, 14, 15] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/[email protected] | ||
continue-on-error: true | ||
timeout-minutes: 1 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
- name: setup-node retry | ||
uses: actions/[email protected] | ||
- uses: actions/[email protected] | ||
timeout-minutes: 1 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
|
@@ -69,6 +63,9 @@ jobs: | |
run: | | ||
npm set progress=false | ||
npm ci | ||
- name: test | ||
if: matrix.node != 8 | ||
run: npm run test | ||
- name: example | ||
run: | | ||
npm run example | ||
|
@@ -82,7 +79,7 @@ jobs: | |
|
||
doxygen-ubuntu: | ||
name: doxygen-ubuntu | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-18.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
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
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<title>Unblind TxOut</title> | ||
<style> | ||
#main { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
height: 120vh; | ||
font-family: sans-serif; | ||
} | ||
.decoderawtxInput { | ||
width: 99%; | ||
} | ||
.input { | ||
width: 99%; | ||
} | ||
.decodeOutput { | ||
width: 99%; | ||
} | ||
.decode-output { | ||
vertical-align: top; | ||
margin-top: 13px; | ||
} | ||
h1 { | ||
font-size: 32px; | ||
} | ||
h2 { | ||
font-size: 20px; | ||
font-weight: bold; | ||
} | ||
h3 { | ||
font-size: 16px; | ||
margin-bottom: 0px; | ||
padding-bottom: 0px; | ||
} | ||
.xpubkey-label { | ||
font-size: 12px; | ||
display: inline-block; | ||
width: 8em; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="decode"> | ||
<h3 class="decode-title">Unblind TxOut</h3> | ||
<div class="decode-input"> | ||
<div> | ||
<div class="decodetx-label">Input tx hex:</div> | ||
<textarea rows="10" id="inputTx" class="input"></textarea><br> | ||
<!-- txid:vout --> | ||
vout: <input type="number" name="vout" id="vout" value="0" min="0" max="2147483647" step="1" /><br> | ||
<!-- address/descriptor --> | ||
blinding key:<br> | ||
<textarea rows="2" name="key" id="key" class="input"></textarea><br> | ||
|
||
<input type="button" name="decode" id="execDecode" value="Verify" /> | ||
</div> | ||
<div class="decode-output"> | ||
<div class="decode-label">Result:</div> | ||
<textarea rows="10" id="decoded" class="decodeOutput" readonly></textarea> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script src="/cfd-js-wasm/dist/cfdjs_wasm.js"></script> | ||
<script src="/cfd-js-wasm/cfdjs_wasm_jsonapi.js"></script> | ||
<script src="unblind_txout.js"></script> | ||
<p><a href="index.html">back</a></p> | ||
</body> | ||
</html> |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const updateField = async function(event) { | ||
const inputTx = document.getElementById("inputTx"); | ||
const decoded = document.getElementById("decoded"); | ||
const vout = document.getElementById("vout"); | ||
const key = document.getElementById("key"); | ||
|
||
try { | ||
const req = { | ||
tx: inputTx.value, | ||
txouts: [{ | ||
index: vout.value, | ||
blindingKey: key.value, | ||
}], | ||
}; | ||
const resp = await callJsonApi(Module, 'UnblindRawTransaction', req); | ||
decoded.value = JSON.stringify(resp.outputs[0], (key, value) => | ||
typeof value === 'bigint' ? value.toString() : value, ' '); | ||
} catch (e) { | ||
decoded.value = 'Invalid transaction format'; | ||
} | ||
} | ||
|
||
const decodeBtnField = document.getElementById("execDecode"); | ||
decodeBtnField.addEventListener('click', updateField); | ||
|
||
Module['onRuntimeInitialized'] = async function(){ | ||
const decoded = document.getElementById("decoded"); | ||
if (Module['_cfdjsJsonApi']) { | ||
console.log("exist cfdjsJsonApi."); | ||
decoded.value = ""; | ||
} else { | ||
console.log("cfdjsJsonApi not found!"); | ||
decoded.value = "WebAssembly load fail."; | ||
} | ||
} | ||
|
||
window.onload = function() { | ||
const decoded = document.getElementById("decoded"); | ||
if (Module['_cfdjsJsonApi']) { | ||
decoded.value = ""; | ||
} else { | ||
decoded.value = "WebAssembly loading..."; | ||
} | ||
} |
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
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
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
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
const TestHelper = require('./JsonTestHelper'); | ||
|
||
const createTestFunc = (helper) => { | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
return async (cfd, testName, req, isError) => { | ||
let resp; | ||
switch (testName) { | ||
case 'Descriptor.Parse': | ||
resp = cfd.ParseDescriptor(req); | ||
resp = await helper.getResponse(resp); | ||
break; | ||
case 'Descriptor.Checksum': | ||
resp = cfd.AppendDescriptorChecksum(req); | ||
resp = await helper.getResponse(resp); | ||
break; | ||
case 'Descriptor.Create': | ||
resp = cfd.CreateDescriptor(req); | ||
resp = await helper.getResponse(resp); | ||
resp = {...req, ...resp}; | ||
break; | ||
default: | ||
throw new Error('unknown name: ' + testName); | ||
} | ||
return resp; | ||
}; | ||
}; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const createCheckFunc = (helper) => { | ||
return (resp, exp, errorData) => { | ||
if (errorData) { | ||
const errMsg = TestHelper.getErrorMessage(errorData); | ||
expect(resp).toEqual(errMsg); | ||
return; | ||
} | ||
if (exp.descriptor) expect(resp.descriptor).toEqual(exp.descriptor); | ||
|
||
if (exp.type) { | ||
const expStr = JSON.stringify(exp, null, null); | ||
const respStr = JSON.stringify(resp, null, null); | ||
expect(respStr).toEqual(expStr); | ||
} | ||
}; | ||
}; | ||
|
||
TestHelper.doTest('Descriptor', 'descriptor_test', createTestFunc, createCheckFunc); |
Oops, something went wrong.