version bump sk/awcp/parasite to add tx_sign_yesprop
There is now an explicit function to have superhero sign the transaction *and* propagate it into the network. JR will simply reject these requests.
This commit is contained in:
+34
-4
@@ -1143,12 +1143,42 @@ type Params_A2W_tx_sign_yesprop
|
|||||||
* (layer 4)
|
* (layer 4)
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* {
|
* ```json
|
||||||
* "signedTransaction": "tx_+KILAfhCuEDxWnvffMvyrkFWnrImYej38rh99vM9f6pORl/yWTvU97nvUcY8/ck8lgtPA8w5odGSDb9LGY/JSZXsmsXhgKkHuFr4WAwBoQG7Nu65aM7NHt5yM5jz67sd02TQqjFNBwIN6tkQsRD5RKEBe2bmwwUHCDbk6XkgUj3D6lnLv9hsWLoHA+qLzQq4p2wKhg8m9WHIAAABh2hhaW5hbmF7X54G"
|
* "transactionHash": {
|
||||||
* }
|
* "blockHash": "mh_uJZ65APpLtiagJKjTNPZL1g1LJ7oqc2uG44qVqp1gVWwWUgLb",
|
||||||
|
* "blockHeight": 806313,
|
||||||
|
* "hash": "th_o3cudpezVywd99a7VMef9Yg7XPixTFueaCqGjdsnqLM99a78t",
|
||||||
|
* "signatures": [
|
||||||
|
* "sg_U36NDTFJFP4QEWCdjyhELDUDxsVGZNkq3DrcBCxby4NPUsPjQsFDG7VHN9s7TNUsEAd7qdC5aEjZKrqsKyfqA8apNrotz"
|
||||||
|
* ],
|
||||||
|
* "tx": {
|
||||||
|
* "amount": 10,
|
||||||
|
* "fee": 16800000000000,
|
||||||
|
* "nonce": 13,
|
||||||
|
* "payload": "ba_aGFpbmFuYWbkNu8=",
|
||||||
|
* "recipientId": "ak_wM8yFU8eSETXU7VSN48HMDmevGoCMiuveQZgkPuRn1nTiRqyv",
|
||||||
|
* "senderId": "ak_2XhCkjzTwcq1coXSSzHJoMZkUzTwnjH88zmPGkkowUsFNTo9UE",
|
||||||
|
* "type": "SpendTx",
|
||||||
|
* "version": 1
|
||||||
|
* },
|
||||||
|
* "rawTx": "tx_+KILAfhCuEDOpyHRaYj8MnRwqOzMyRJSh4qud6jRK01wiAWfRHBDo/4e9klk7MsvM0Cr0ENaNkqKfwCDcaga/iDnogN5cukNuFr4WAwBoQHJY35GAOerO8Lmf8ZA6CN2RET0MFXaXVV4pJo3WvoY3KEBe2bmwwUHCDbk6XkgUj3D6lnLv9hsWLoHA+qLzQq4p2wKhg9HjghAAAANh2hhaW5hbmHkTCSc"
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
*/
|
*/
|
||||||
type Result_W2A_tx_sign_yesprop
|
type Result_W2A_tx_sign_yesprop
|
||||||
= {signedTransaction : string};
|
= {transactionHash : {blockHash : string,
|
||||||
|
blockHeight : number,
|
||||||
|
hash : string,
|
||||||
|
signatures : Array<string>,
|
||||||
|
tx : {amount : number,
|
||||||
|
fee : number,
|
||||||
|
nonce : number,
|
||||||
|
payload : string,
|
||||||
|
recipientId : string,
|
||||||
|
senderId : string,
|
||||||
|
type : string,
|
||||||
|
version : number},
|
||||||
|
rawTx : string}};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{type, library}.
|
{type, library}.
|
||||||
{realm, local}.
|
{realm, local}.
|
||||||
{name, parasite}.
|
{name, parasite}.
|
||||||
{version, "0.2.0"}.
|
{version, "0.2.2"}.
|
||||||
{deps, []}.
|
{deps, []}.
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import * as ae_compiler from './ae_compiler.js'
|
|||||||
// CONSTANTS
|
// CONSTANTS
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
export const MIN_FEE = 16660000000000;
|
export const MIN_FEE = 16800000000000;
|
||||||
export const MIN_CONTRACT_FEE = 79080000000000;
|
export const MIN_CONTRACT_FEE = 79080000000000;
|
||||||
export const MIN_GAS_PRICE = 1000000000;
|
export const MIN_GAS_PRICE = 1000000000;
|
||||||
export const URL_MAINNET = "https://mainnet.aeternity.io/v3";
|
export const URL_MAINNET = "https://mainnet.aeternity.io/v3";
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ export {
|
|||||||
// connect
|
// connect
|
||||||
connect,
|
connect,
|
||||||
address,
|
address,
|
||||||
|
tx_sign_yesprop,
|
||||||
tx_sign_noprop,
|
tx_sign_noprop,
|
||||||
msg_sign,
|
msg_sign,
|
||||||
|
|
||||||
|
|||||||
@@ -62,11 +62,17 @@
|
|||||||
<ol>
|
<ol>
|
||||||
<li><pre class="pv-spendtx-base64"></pre></li>
|
<li><pre class="pv-spendtx-base64"></pre></li>
|
||||||
</ol>
|
</ol>
|
||||||
<button id="sign-spendtx">Sign Transaction</button>
|
|
||||||
|
<button id="sign-spendtx">Sign Transaction but do not propagate</button>
|
||||||
<h5>Result:</h5>
|
<h5>Result:</h5>
|
||||||
<pre id="sign-spendtx-result"></pre>
|
<pre id="sign-spendtx-result"></pre>
|
||||||
<h2>4.4 Propagate the transaction (parasite)</h2>
|
|
||||||
<h2>4.5 Verify the transaction was propagated (parasite)</h2>
|
<br>
|
||||||
|
<button id="sign-spendtx-prop">Sign Transaction and have superhero propagate transaction</button>
|
||||||
|
<h5>Result:</h5>
|
||||||
|
<pre id="sign-spendtx-prop-result"></pre>
|
||||||
|
<h2>4.4 Propagate the transaction (parasite) FIXME</h2>
|
||||||
|
<h2>4.5 Verify the transaction was propagated (parasite) FIXME</h2>
|
||||||
|
|
||||||
|
|
||||||
<h1>5. Sign a message</h1>
|
<h1>5. Sign a message</h1>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{type, library}.
|
{type, library}.
|
||||||
{realm, local}.
|
{realm, local}.
|
||||||
{name, sidekick_examples}.
|
{name, sidekick_examples}.
|
||||||
{version, "0.1.0"}.
|
{version, "0.2.2"}.
|
||||||
{deps, ["local-awcp-0.2.1",
|
{deps, ["local-awcp-0.2.2",
|
||||||
"local-parasite-0.2.0",
|
"local-parasite-0.2.2",
|
||||||
"local-sidekick-0.2.1"]}.
|
"local-sidekick-0.2.2"]}.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import * as ae_node from './jex_include/local-parasite-0.2.0/dist/ae_node.js';
|
import * as ae_node from './jex_include/local-parasite-0.2.2/dist/ae_node.js';
|
||||||
import * as awcp from './jex_include/local-awcp-0.2.1/dist/awcp.js';
|
import * as awcp from './jex_include/local-awcp-0.2.2/dist/awcp.js';
|
||||||
import * as sk from './jex_include/local-sidekick-0.2.1/dist/sidekick.js';
|
import * as sk from './jex_include/local-sidekick-0.2.2/dist/sidekick.js';
|
||||||
|
|
||||||
var pv_address: string;
|
var pv_address: string;
|
||||||
var pv_spendtx_base64: string;
|
var pv_spendtx_base64: string;
|
||||||
@@ -181,6 +181,7 @@ form_tx
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function
|
async function
|
||||||
sign_tx
|
sign_tx
|
||||||
(logger: sk.Logger)
|
(logger: sk.Logger)
|
||||||
@@ -197,6 +198,24 @@ sign_tx
|
|||||||
document.getElementById("sign-spendtx-result")!.innerHTML = JSON.stringify(signedTx, undefined, 4);
|
document.getElementById("sign-spendtx-result")!.innerHTML = JSON.stringify(signedTx, undefined, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async function
|
||||||
|
sign_tx_prop
|
||||||
|
(logger: sk.Logger)
|
||||||
|
: Promise<void>
|
||||||
|
{
|
||||||
|
let sign_params = {
|
||||||
|
tx: pv_spendtx_base64,
|
||||||
|
// returnsigned: false tells it to propagate the transaction
|
||||||
|
// returnsigned: true just signs it and returns the signed tx back
|
||||||
|
returnSigned: false as false,
|
||||||
|
networkId: "ae_uat"
|
||||||
|
};
|
||||||
|
let signedTx = await sk.tx_sign_yesprop('sk-tx-sign-2', sign_params, sk.TIMEOUT_DEF_TX_SIGN_NOPROP_MS, 'sign transaction timed out', logger);
|
||||||
|
document.getElementById("sign-spendtx-prop-result")!.innerHTML = JSON.stringify(signedTx, undefined, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
async function
|
async function
|
||||||
sign_msg
|
sign_msg
|
||||||
(logger: sk.Logger)
|
(logger: sk.Logger)
|
||||||
@@ -224,6 +243,7 @@ main
|
|||||||
document.getElementById('address')!.onclick = function() { address(logger); };
|
document.getElementById('address')!.onclick = function() { address(logger); };
|
||||||
document.getElementById('mk-spendtx')!.onclick = function() { form_tx(logger); };
|
document.getElementById('mk-spendtx')!.onclick = function() { form_tx(logger); };
|
||||||
document.getElementById('sign-spendtx')!.onclick = function() { sign_tx(logger); };
|
document.getElementById('sign-spendtx')!.onclick = function() { sign_tx(logger); };
|
||||||
|
document.getElementById('sign-spendtx-prop')!.onclick = function() { sign_tx_prop(logger); };
|
||||||
document.getElementById('sign-message')!.onclick = function() { sign_msg(logger); };
|
document.getElementById('sign-message')!.onclick = function() { sign_msg(logger); };
|
||||||
|
|
||||||
//set_pv_address("ak_2XhCkjzTwcq1coXSSzHJoMZkUzTwnjH88zmPGkkowUsFNTo9UE");
|
//set_pv_address("ak_2XhCkjzTwcq1coXSSzHJoMZkUzTwnjH88zmPGkkowUsFNTo9UE");
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
import * as sk from './jex_include/local-sidekick-0.2.1/dist/sidekick.js';
|
import * as sk from './jex_include/local-sidekick-0.2.2/dist/sidekick.js';
|
||||||
|
|
||||||
sk.hello();
|
sk.hello();
|
||||||
|
|||||||
Reference in New Issue
Block a user