diff --git a/examples/browser/aepp/src/App.vue b/examples/browser/aepp/src/App.vue
index 4ae4c33121..32bfef5240 100644
--- a/examples/browser/aepp/src/App.vue
+++ b/examples/browser/aepp/src/App.vue
@@ -25,6 +25,13 @@
>
Pay for transaction
+
+ Typed data
+
({ view: '' }),
computed: mapState(['aeSdk']),
diff --git a/examples/browser/aepp/src/TypedData.vue b/examples/browser/aepp/src/TypedData.vue
new file mode 100644
index 0000000000..8307293bd6
--- /dev/null
+++ b/examples/browser/aepp/src/TypedData.vue
@@ -0,0 +1,170 @@
+
+ Domain
+
+
+
+
+
+
Contract address
+
+
+
+
+
+
+ Data
+
+
+ Sign
+
+
+ Verify
+
+
+
+
+
+
Is signature correct
+
+
+
+
+
+
diff --git a/examples/browser/wallet-iframe/src/App.vue b/examples/browser/wallet-iframe/src/App.vue
index 49cc763e4d..b0aad366e0 100644
--- a/examples/browser/wallet-iframe/src/App.vue
+++ b/examples/browser/wallet-iframe/src/App.vue
@@ -31,7 +31,7 @@
import {
MemoryAccount, generateKeyPair, AeSdkWallet, Node, CompilerHttp,
BrowserWindowMessageConnection, METHODS, WALLET_TYPE,
- RpcConnectionDenyError, RpcRejectedByUserError,
+ RpcConnectionDenyError, RpcRejectedByUserError, unpackTx, decodeFateValue,
} from '@aeternity/aepp-sdk';
import Value from './Value.vue';
@@ -78,7 +78,7 @@ export default {
const genConfirmCallback = (actionName) => (aeppId, parameters, origin) => {
if (!confirm([
`Client ${aeppInfo[aeppId].name} with id ${aeppId} at ${origin} want to ${actionName}`,
- JSON.stringify(parameters, null, 2),
+ Value.methods.valueToString(parameters),
].join('\n'))) {
throw new RpcRejectedByUserError();
}
@@ -87,7 +87,7 @@ export default {
class AccountMemoryProtected extends MemoryAccount {
async signTransaction(tx, { aeppRpcClientId: id, aeppOrigin, ...options } = {}) {
if (id != null) {
- const opt = { ...options };
+ const opt = { ...options, unpackedTx: unpackTx(tx) };
if (opt.onCompiler) opt.onCompiler = '';
if (opt.onNode) opt.onNode = '';
genConfirmCallback(`sign transaction ${tx}`)(id, opt, aeppOrigin);
@@ -102,6 +102,14 @@ export default {
return super.signMessage(message, options);
}
+ async signTypedData(data, aci, { aeppRpcClientId: id, aeppOrigin, ...options }) {
+ if (id != null) {
+ const opt = { ...options, aci, decodedData: decodeFateValue(data, aci) };
+ genConfirmCallback(`sign typed data ${data}`)(id, opt, aeppOrigin);
+ }
+ return super.signTypedData(data, aci, options);
+ }
+
static generate() {
// TODO: can inherit parent method after implementing https://github.com/aeternity/aepp-sdk-js/issues/1672
return new AccountMemoryProtected(generateKeyPair().secretKey);
diff --git a/examples/browser/wallet-web-extension/src/Popup.vue b/examples/browser/wallet-web-extension/src/Popup.vue
index c105bf3001..aab4088f1a 100644
--- a/examples/browser/wallet-web-extension/src/Popup.vue
+++ b/examples/browser/wallet-web-extension/src/Popup.vue
@@ -23,7 +23,6 @@