From 50cac48f99344c7d256273ca11e50e5700caa597 Mon Sep 17 00:00:00 2001
From: Peter Harpending
Date: Wed, 19 Jul 2023 00:38:03 -0600
Subject: [PATCH 1/2] [wip] updating sidekick
---
libs/awcp/jex.eterms | 2 +-
libs/awcp/src/awcp.ts | 155 +++++++++++++++++++++++++++++++++++++--
sidekick/jex.eterms | 4 +-
sidekick/src/sidekick.ts | 40 +++++++++-
site/index.html | 43 ++++++++---
5 files changed, 220 insertions(+), 24 deletions(-)
diff --git a/libs/awcp/jex.eterms b/libs/awcp/jex.eterms
index ef329f8..79587b0 100644
--- a/libs/awcp/jex.eterms
+++ b/libs/awcp/jex.eterms
@@ -1,5 +1,5 @@
{type, library}.
{realm, local}.
{name, awcp}.
-{version, "0.2.1"}.
+{version, "0.2.2"}.
{deps, []}.
diff --git a/libs/awcp/src/awcp.ts b/libs/awcp/src/awcp.ts
index 6e3b9d1..75034f6 100644
--- a/libs/awcp/src/awcp.ts
+++ b/libs/awcp/src/awcp.ts
@@ -257,13 +257,13 @@ export {
RpcResp_W2A_address_subscribe,
EventData_A2W_address_subscribe,
EventData_W2A_address_subscribe,
- //// transaction.sign (propagate)
- //Params_A2W_tx_sign_yesprop,
- //Result_W2A_tx_sign_yesprop,
- //RpcCall_A2W_tx_sign_yesprop,
- //RpcResp_W2A_tx_sign_yesprop,
- //EventData_A2W_tx_sign_yesprop,
- //EventData_W2A_tx_sign_yesprop,
+ // transaction.sign (propagate)
+ Params_A2W_tx_sign_yesprop,
+ Result_W2A_tx_sign_yesprop,
+ RpcCall_A2W_tx_sign_yesprop,
+ RpcResp_W2A_tx_sign_yesprop,
+ EventData_A2W_tx_sign_yesprop,
+ EventData_W2A_tx_sign_yesprop,
// transaction.sign (do not propagate)
Params_A2W_tx_sign_noprop,
Result_W2A_tx_sign_noprop,
@@ -1110,6 +1110,147 @@ type EventData_W2A_address_subscribe
+//----------------------------------------------------------------------------
+// transaction.sign (do propagate)
+//----------------------------------------------------------------------------
+
+/**
+ * Parameters for "transaction.sign" (do propagate)
+ *
+ * If `returnSigned` is `false`, then Superhero will propagate the transaction.
+ *
+ * (layer 4)
+ *
+ * @example
+ * ```json
+ * {
+ * "tx": "tx_+FgMAaEBuzbuuWjOzR7ecjOY8+u7HdNk0KoxTQcCDerZELEQ+UShAXtm5sMFBwg25Ol5IFI9w+pZy7/YbFi6BwPqi80KuKdsCoYPJvVhyAAAAYdoYWluYW5h9uAnNQ==",
+ * "returnSigned": false,
+ * "networkId": "ae_uat"
+ * }
+ * ```
+ */
+type Params_A2W_tx_sign_yesprop
+ = {tx : string,
+ returnSigned : false,
+ networkId : string}
+
+
+
+/**
+ * Success result type for "transaction.sign" (do propagate)
+ *
+ * (layer 4)
+ *
+ * @example
+ * {
+ * "signedTransaction": "tx_+KILAfhCuEDxWnvffMvyrkFWnrImYej38rh99vM9f6pORl/yWTvU97nvUcY8/ck8lgtPA8w5odGSDb9LGY/JSZXsmsXhgKkHuFr4WAwBoQG7Nu65aM7NHt5yM5jz67sd02TQqjFNBwIN6tkQsRD5RKEBe2bmwwUHCDbk6XkgUj3D6lnLv9hsWLoHA+qLzQq4p2wKhg8m9WHIAAABh2hhaW5hbmF7X54G"
+ * }
+ */
+type Result_W2A_tx_sign_yesprop
+ = {signedTransaction : string};
+
+
+/**
+ * Request type for "transaction.sign" (do propagate)
+ *
+ * (layer 3)
+ *
+ * @example
+ * ```json
+ * {
+ * "jsonrpc": "2.0",
+ * "id": "sk-tx-sign-1",
+ * "method": "transaction.sign",
+ * "params": {
+ * "tx": "tx_+FgMAaEBuzbuuWjOzR7ecjOY8+u7HdNk0KoxTQcCDerZELEQ+UShAXtm5sMFBwg25Ol5IFI9w+pZy7/YbFi6BwPqi80KuKdsCoYPJvVhyAAAAYdoYWluYW5h9uAnNQ==",
+ * "returnSigned": true,
+ * "networkId": "ae_uat"
+ * }
+ * }
+ * ```
+ */
+type RpcCall_A2W_tx_sign_yesprop
+ = RpcCall<"transaction.sign",
+ Params_A2W_tx_sign_yesprop>;
+
+
+
+/**
+ * Response type for "transaction.sign" (do propagate)
+ *
+ * (layer 3)
+ *
+ * @example
+ * ```json
+ * {
+ * "jsonrpc": "2.0",
+ * "id": "sk-tx-sign-1",
+ * "method": "transaction.sign",
+ * "result": {
+ * "signedTransaction": "tx_+KILAfhCuEDxWnvffMvyrkFWnrImYej38rh99vM9f6pORl/yWTvU97nvUcY8/ck8lgtPA8w5odGSDb9LGY/JSZXsmsXhgKkHuFr4WAwBoQG7Nu65aM7NHt5yM5jz67sd02TQqjFNBwIN6tkQsRD5RKEBe2bmwwUHCDbk6XkgUj3D6lnLv9hsWLoHA+qLzQq4p2wKhg8m9WHIAAABh2hhaW5hbmF7X54G"
+ * }
+ * }
+ * ```
+ */
+type RpcResp_W2A_tx_sign_yesprop
+ = RpcResp<"transaction.sign",
+ Result_W2A_tx_sign_yesprop>;
+
+
+
+/**
+ * Event data for aepp-to-waellet "transaction.sign" (do propagate) message
+ *
+ * (layer 2)
+ *
+ * @example
+ * ```json
+ * {
+ * "type": "to_waellet",
+ * "data": {
+ * "jsonrpc": "2.0",
+ * "id": "sk-tx-sign-1",
+ * "method": "transaction.sign",
+ * "params": {
+ * "tx": "tx_+FgMAaEBuzbuuWjOzR7ecjOY8+u7HdNk0KoxTQcCDerZELEQ+UShAXtm5sMFBwg25Ol5IFI9w+pZy7/YbFi6BwPqi80KuKdsCoYPJvVhyAAAAYdoYWluYW5h9uAnNQ==",
+ * "returnSigned": false,
+ * "networkId": "ae_uat"
+ * }
+ * }
+ * }
+ * ```
+ */
+type EventData_A2W_tx_sign_yesprop
+ = EventData_A2W;
+
+
+
+/**
+ * Event data for waellet-to-aepp "transaction.sign" (do propagate) response
+ *
+ * (layer 2)
+ *
+ * @example
+ * ```json
+ * {
+ * "type": "to_aepp",
+ * "data": {
+ * "jsonrpc": "2.0",
+ * "id": "sk-tx-sign-1",
+ * "method": "transaction.sign",
+ * "result": {
+ * "signedTransaction": "tx_+KILAfhCuEDxWnvffMvyrkFWnrImYej38rh99vM9f6pORl/yWTvU97nvUcY8/ck8lgtPA8w5odGSDb9LGY/JSZXsmsXhgKkHuFr4WAwBoQG7Nu65aM7NHt5yM5jz67sd02TQqjFNBwIN6tkQsRD5RKEBe2bmwwUHCDbk6XkgUj3D6lnLv9hsWLoHA+qLzQq4p2wKhg8m9WHIAAABh2hhaW5hbmF7X54G"
+ * }
+ * }
+ * }
+ * ```
+ */
+type EventData_W2A_tx_sign_yesprop
+ = EventData_W2A;
+
+
+
//----------------------------------------------------------------------------
// transaction.sign (do not propagate)
//----------------------------------------------------------------------------
diff --git a/sidekick/jex.eterms b/sidekick/jex.eterms
index a0ca55f..5904558 100644
--- a/sidekick/jex.eterms
+++ b/sidekick/jex.eterms
@@ -1,5 +1,5 @@
{type, library}.
{realm, local}.
{name, sidekick}.
-{version, "0.2.1"}.
-{deps, ["local-awcp-0.2.1"]}.
+{version, "0.2.2"}.
+{deps, ["local-awcp-0.2.2"]}.
diff --git a/sidekick/src/sidekick.ts b/sidekick/src/sidekick.ts
index 4a0ab40..5837727 100644
--- a/sidekick/src/sidekick.ts
+++ b/sidekick/src/sidekick.ts
@@ -92,7 +92,7 @@ export {
// IMPORTS
//-----------------------------------------------------------------------------
-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';
//-----------------------------------------------------------------------------
@@ -1038,8 +1038,44 @@ msg_sign
//-----------------------------------------------------------------------------
-// API: tx sign (no prop)
+// API: tx sign (do prop)
//-----------------------------------------------------------------------------
+
+/**
+ * Ask the wallet to sign the transaction and propagate it into the network
+ */
+async function
+tx_sign_yesprop
+ (id : number | string,
+ params : awcp.Params_A2W_tx_sign_yesprop,
+ timeout_ms : number,
+ timeout_msg : string,
+ logger : Logger)
+ : Promise>
+{
+ logger.debug('address', {id:id, params:params, 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
+ // Ideal:
+ // let result = await msgr.send_raseev(id, awcp.METHOD_CONNECTION_OPEN, params, target, timeout_ms, timeout_msg);
+ let result =
+ await msgr.send_raseev
+ <"transaction.sign", awcp.Params_A2W_tx_sign_yesprop, awcp.Result_W2A_tx_sign_yesprop>
+ (id, "transaction.sign", params, timeout_ms, timeout_msg);
+ return result;
+}
+
+
+
+//-----------------------------------------------------------------------------
+// API: tx sign (do not propagate transaction)
+//-----------------------------------------------------------------------------
+
+/**
+ * Ask the wallet to sign the transaction but do not propagate the transaction,
+ * instead just return the signed data
+ */
async function
tx_sign_noprop
(id : number | string,
diff --git a/site/index.html b/site/index.html
index d52a879..50b5c98 100644
--- a/site/index.html
+++ b/site/index.html
@@ -95,12 +95,14 @@
TypeScript stuff (hurray).
Vanillae started as our own internal toolset that we developed in the
- process of making Aegora.jp. In
- particular, Craig developed Vanillae.erl because talking to the blockchain
- was needlessly annoying, and Peter developed Sidekick because the Æternity
- JavaScript SDK was (is) impossible to use. We then open-sourced our
- tooling, and the Æternity Foundation decided to pay us to continue to
- develop it and expand it.
+ process of making Aegora.jp. Aegora is a
+ normal, vanilla, e-commerce site. We just happen to use Æternity as the
+ payment backend. In particular, Craig developed Vanillae.erl because
+ talking to the blockchain from the server backend was needlessly annoying,
+ and Peter developed Sidekick because the Æternity JavaScript SDK was (is)
+ impossible to use. We then open-sourced our "talk to Æternity" tooling,
+ and the Æternity Foundation decided to pay us to continue to develop it and
+ expand it.
Aegora is the first normal e-commerce platform that utilizes any form of
cryptocurrency. We would like if Aegora made us billionaires, but really
@@ -120,17 +122,34 @@
Our hypothesis is that most cryptocurrencies (i.e. every coin except
Æternity) are technically deficient to the point that they are totally
- useless in the space of Things That Actually Have To Work (i.e.
- business).
+ useless in The Space Of Things That Actually Have To Work (e.g.
+ non-scam commerce). To test this hypothesis, our goal is to make Æternity
+ easily usable and see if people start using it in The Space Of Things That
+ Actually Have To Work.
+
+
As of July 2023, Æternity is still in the same usability class as Arch
+ Linux. Our goal with this project to get to like Debian.
+
+
From our personal experience building Aegora, once you understand how
+ to use it, Æternity is by far the easiest electronic
+ payment system to use in a commercial application. It is the genuine
+ manifestation of Satoshi's dream.
4. Vanillae.erl
-
- This is an Erlang application that smooths over the rough edges
- involved in talking to Æternity nodes.
-
+
This is an Erlang application that smooths over the rough edges
+ involved in talking to Æternity nodes from an Erlang program.
+
+
Vanillae.erl is also a standard that is meant to be mimicked in other
+ languages. The idea is to have a "library" (Erlangers: it's an Erlang
+ application) of Erlang function calls that return natural Erlang data
+ structures. The API is designed in such a way that the API should
+ generalize to other languages. We would like there to be a Vanillae.py for
+ instance (Python 2 of course), which would maybe require startup or
+ something, maybe the natural idiom would be whatever you do to make `with`
+ syntax work, whatever. The point is, there should be a