-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathapp.ts
More file actions
65 lines (55 loc) · 1.71 KB
/
app.ts
File metadata and controls
65 lines (55 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { Application } from '@nativescript/core';
import { Client, eth_personalSign, eth_signTypedData, init, PrivateKey } from '@nstudio/nativescript-walletconnect';
init();
// import { Inquiry } from '@nstudio/nativescript-persona';
// Inquiry.init();
declare const com, io;
Client.initialize('a296125a15cc255e4aa63fffdc421458', null, {
description: 'WalletConnect Developer App',
url: 'https://walletconnect.org',
icons: ['https://walletconnect.org/walletconnect-logo.png'],
name: 'WalletConnect',
});
console.dir((io as any).nstudio.plugins.walletconnect.NSCWalletConnectV2.Numeric);
const key = new PrivateKey();
const data = ['0x4d7920656d61696c206973206a6f686e40646f652e636f6d202d2031363734353533313833303131', '0x8e210C23Fc543B754F7eA84EC10e1aDA0Efe944b'];
console.log(eth_personalSign(key, data));
const typedData = {
types: {
EIP712Domain: [
{ name: "name", type: "string" },
{ name: "version", type: "string" },
{ name: "chainId", type: "uint256" },
{ name: "verifyingContract", type: "address" },
],
Person: [
{ name: "name", type: "string" },
{ name: "account", type: "address" },
],
Mail: [
{ name: "from", type: "Person" },
{ name: "to", type: "Person" },
{ name: "contents", type: "string" },
],
},
primaryType: "Mail",
domain: {
name: "Example Dapp",
version: "1.0",
chainId: 1,
verifyingContract: "0x0000000000000000000000000000000000000000",
},
message: {
from: {
name: "Alice",
account: "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
},
to: {
name: "Bob",
account: "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
},
contents: "Hey, Bob!",
},
};
console.log(eth_signTypedData(key, typedData));
Application.run({ moduleName: 'app-root' });