4.1 Transaction info (information needed from you)
-
-
-
Source address (step 3):
-
Target address:
-
Amount (aettos):
-
Network: (FIXME: radio buttons)
-
+
4.1 Transaction info (information needed from you)
+
+
Source address (step 3):
+
Target address:
+
Amount (aettos):
+
Network: (FIXME: radio buttons)
+
+
4.2 Form transaction (using parasite)
+
This uses a shim JavaScript library called parasite to form the transaction
+ data for the wallet to sign. In a commercial application, this should be done
+ by your backend
+
+
SpendTx JS object
+
+
SpendTx Base64
+
+
4.3 Sign the transaction (sidekick)
+
+
+
+
+
Result:
+
+
4.4 Propagate the transaction (parasite)
+
4.5 Verify the transaction was propagated (parasite)
-
4.2 Form transaction (using parasite)
-
-
This uses a shim JavaScript library called parasite to form the transaction
-data for the wallet to sign. In a commercial application, this should be done
-by your backend
-
-
-
-
SpendTx JS object
-
-
-
SpendTx Base64
-
-
-
4.3 Sign the transaction (sidekick)
-
-
-
-
-
-
-
-
Result:
-
-
-
4.4 Propagate the transaction (parasite)
-
-
4.5 Verify the transaction was propagated (parasite)
+
5. Sign a message
+
diff --git a/sidekick/examples/src/connection.ts b/sidekick/examples/src/connection.ts
index 7d6630d..189c882 100644
--- a/sidekick/examples/src/connection.ts
+++ b/sidekick/examples/src/connection.ts
@@ -197,6 +197,13 @@ sign_tx
document.getElementById("sign-spendtx-result")!.innerHTML = JSON.stringify(signedTx, undefined, 4);
}
+async function sign_msg(logger: sk.Logger): Promise {
+ console.log('poop');
+ let acc_pubkey : string = pv_address;
+ let signed_msg = await sk.msg_sign('sk-msg-sign-1', acc_pubkey, 'I make stinky poo poo', sk.TIMEOUT_DEF_TX_SIGN_NOPROP_MS, 'stinky poo poo too long', logger);
+ console.log('signed message:', signed_msg);
+}
+
function
main
()
@@ -212,6 +219,7 @@ main
document.getElementById('address')!.onclick = function() { address(logger); };
document.getElementById('mk-spendtx')!.onclick = function() { form_tx(logger); };
document.getElementById('sign-spendtx')!.onclick = function() { sign_tx(logger); };
+ document.getElementById('sign-message')!.onclick = function() { sign_msg(logger); };
//set_pv_address("ak_2XhCkjzTwcq1coXSSzHJoMZkUzTwnjH88zmPGkkowUsFNTo9UE");
}
diff --git a/sidekick/src/sidekick.ts b/sidekick/src/sidekick.ts
index 06aff63..31f2c06 100644
--- a/sidekick/src/sidekick.ts
+++ b/sidekick/src/sidekick.ts
@@ -170,6 +170,7 @@ export {
connect,
address,
tx_sign_noprop,
+ msg_sign,
// internals
sleep,
@@ -777,7 +778,7 @@ msg_sign
logger : Logger)
: Promise>
{
- logger.debug('address', {id:id, params:params, timeout_ms:timeout_ms, timeout_msg:timeout_msg});
+ logger.debug('address', {id:id, account_pubkey:account_pubkey, message:message, timeout_ms:timeout_ms, timeout_msg:timeout_msg});
let msgr = new MsgR(logger);
// FIXME: for type purposes, making the correct RPC message should be up here
// this way we can enforce that it's a correct RPC call with typescript