Add sample KeyPair usage

This commit is contained in:
Pavel Murygin 2021-10-06 19:46:34 +03:00
parent 4108191023
commit 32d4e6c822
2 changed files with 6 additions and 0 deletions

View File

@ -20,6 +20,7 @@
"@fluencelabs/fluence": "0.10.4-async-457.0",
"@fluencelabs/fluence-network-environment": "1.0.10",
"@types/sqlite3": "^3.1.7",
"base64-js": "^1.5.1",
"ethers": "^5.4.7",
"ethers-eip712": "^0.2.0",
"got": "^11.8.2",

View File

@ -6,6 +6,7 @@ import { TypedDataUtils } from 'ethers-eip712'; // https://github.com/0xsequenc
import { eip_validation, Response } from "./eip_processor";
import { get_db, create_table, insert_event, DBRecord, select_events, select_event } from './local_db';
import got from 'got';
import { base64 } from "ethers/lib/utils";
@ -80,8 +81,12 @@ class DataProvider implements DataProviderDef {
async function main_0() {
const skBase64 = 'z1x3cVXhk9nJKE1pZaX9KxccUBzxu3aGlaUjDdAB2oY=';
const skBytes = base64.decode(skBase64);
await Fluence.start({
connectTo: krasnodar[0],
KeyPair: await KeyPair.fromEd25519SK(skBytes)
});
// const peer_data = Fluence.getPeer();