mirror of
https://github.com/fluencelabs/dashboard
synced 2024-12-04 15:20:21 +00:00
update sdk version
This commit is contained in:
parent
4266f9b3fa
commit
ae8f797d19
@ -4,5 +4,6 @@ module.exports = {
|
|||||||
singleQuote: true,
|
singleQuote: true,
|
||||||
printWidth: 120,
|
printWidth: 120,
|
||||||
tabWidth: 4,
|
tabWidth: 4,
|
||||||
useTabs: false
|
useTabs: false,
|
||||||
|
endOfLine: "auto"
|
||||||
};
|
};
|
||||||
|
149
package-lock.json
generated
149
package-lock.json
generated
@ -1223,14 +1223,35 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@fluencelabs/aquamarine-stepper": {
|
"@fluencelabs/aquamarine-stepper": {
|
||||||
"version": "0.0.30",
|
"version": "0.3.4",
|
||||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aquamarine-stepper/-/aquamarine-stepper-0.0.30.tgz",
|
"resolved": "https://registry.npmjs.org/@fluencelabs/aquamarine-stepper/-/aquamarine-stepper-0.3.4.tgz",
|
||||||
"integrity": "sha512-XIgRgyVgPJXvXB3NuYHpSdJ0EFcFZ+K4uduGFf8PfnFii/bFs4F1n3MBB+b4D0y59HR4F9ZQUC4fXxcf6UCYWA=="
|
"integrity": "sha512-0NPg9dWvANtc3If8C8O8XjKwzMCq2492lA73faKJdCwUv7m+xHX9G3l6UJULTfV1T4mWVtMQZIKopNOlRYSrKA=="
|
||||||
|
},
|
||||||
|
"@fluencelabs/fluence": {
|
||||||
|
"version": "0.9.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.9.6.tgz",
|
||||||
|
"integrity": "sha512-bKtQ7hpRrvze4JT96/OoiiwQZ5ptDUu4gQqn0DJSIFWP0V1YXFGHfss32l3o5uPAMhY82PgTMcsYV+S1V2B0EA==",
|
||||||
|
"requires": {
|
||||||
|
"@fluencelabs/aquamarine-stepper": "0.3.4",
|
||||||
|
"async": "3.2.0",
|
||||||
|
"base64-js": "1.3.1",
|
||||||
|
"bs58": "4.0.1",
|
||||||
|
"cids": "0.8.1",
|
||||||
|
"it-length-prefixed": "3.0.1",
|
||||||
|
"it-pipe": "1.1.0",
|
||||||
|
"libp2p": "0.28.3",
|
||||||
|
"libp2p-mplex": "0.9.5",
|
||||||
|
"libp2p-secio": "0.12.5",
|
||||||
|
"libp2p-websockets": "0.13.6",
|
||||||
|
"loglevel": "1.7.0",
|
||||||
|
"peer-id": "0.13.12",
|
||||||
|
"uuid": "8.3.0"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"@fluencelabs/fluence-network-environment": {
|
"@fluencelabs/fluence-network-environment": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.0.8.tgz",
|
||||||
"integrity": "sha512-N6ndXhlAuokwhE0in2Mg67nU+jH1H4JlgFvXQP0iFJjWT95nYfjnGEboxxavBnijd6IJe7hi68m+XvlNEV+7yw=="
|
"integrity": "sha512-k1E48+r7tc5jWsnAeLrua7yRKN9lRISdJ1czkcOzUF6dZ9fI5+6ZfKKfUozJyC6n4hSjtCIcUV0G65vBvQfxBw=="
|
||||||
},
|
},
|
||||||
"@hapi/address": {
|
"@hapi/address": {
|
||||||
"version": "2.1.4",
|
"version": "2.1.4",
|
||||||
@ -1350,9 +1371,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@sinonjs/commons": {
|
"@sinonjs/commons": {
|
||||||
"version": "1.8.1",
|
"version": "1.8.2",
|
||||||
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.1.tgz",
|
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.2.tgz",
|
||||||
"integrity": "sha512-892K+kWUUi3cl+LlqEWIDrhvLgdL79tECi8JZUyq6IviKy/DNhuzCRlbHUjxK89f4ypPMMaFnFuR9Ie6DoIMsw==",
|
"integrity": "sha512-sruwd86RJHdsVf/AtBoijDmUqJp3B6hF/DGC23C+JaegnDHaZyewCjoVGTdg3J0uz3Zs7NnIT05OBOmML72lQw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"type-detect": "4.0.8"
|
"type-detect": "4.0.8"
|
||||||
}
|
}
|
||||||
@ -1365,19 +1386,10 @@
|
|||||||
"@sinonjs/commons": "^1.7.0"
|
"@sinonjs/commons": "^1.7.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@sinonjs/formatio": {
|
|
||||||
"version": "5.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-5.0.1.tgz",
|
|
||||||
"integrity": "sha512-KaiQ5pBf1MpS09MuA0kp6KBQt2JUOQycqVG1NZXvzeaXe5LGFqAKueIS0bw4w0P9r7KuBSVdUk5QjXsUdu2CxQ==",
|
|
||||||
"requires": {
|
|
||||||
"@sinonjs/commons": "^1",
|
|
||||||
"@sinonjs/samsam": "^5.0.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@sinonjs/samsam": {
|
"@sinonjs/samsam": {
|
||||||
"version": "5.3.0",
|
"version": "5.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.3.1.tgz",
|
||||||
"integrity": "sha512-hXpcfx3aq+ETVBwPlRFICld5EnrkexXuXDwqUNhDdr5L8VjvMeSRwyOa0qL7XFmR+jVWR4rUZtnxlG7RX72sBg==",
|
"integrity": "sha512-1Hc0b1TtyfBu8ixF/tpfSHTVWKwCBLY4QJbkgnE7HcwyvT2xArDxb4K7dMgqRm3szI+LJbzmW/s4xxEhv6hwDg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@sinonjs/commons": "^1.6.0",
|
"@sinonjs/commons": "^1.6.0",
|
||||||
"lodash.get": "^4.4.2",
|
"lodash.get": "^4.4.2",
|
||||||
@ -6833,27 +6845,6 @@
|
|||||||
"integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==",
|
"integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"fluence": {
|
|
||||||
"version": "0.7.108",
|
|
||||||
"resolved": "https://registry.npmjs.org/fluence/-/fluence-0.7.108.tgz",
|
|
||||||
"integrity": "sha512-Pwk3QkX2AX5vWv791yfIy37xMFAoB+iIZFOAaRCHES2nkBXVJgqBQWH42xXcGJeiBCfecPpI9yl9kPSp3f6nCA==",
|
|
||||||
"requires": {
|
|
||||||
"@fluencelabs/aquamarine-stepper": "0.0.30",
|
|
||||||
"async": "3.2.0",
|
|
||||||
"base64-js": "1.3.1",
|
|
||||||
"bs58": "4.0.1",
|
|
||||||
"cids": "0.8.1",
|
|
||||||
"it-length-prefixed": "3.0.1",
|
|
||||||
"it-pipe": "1.1.0",
|
|
||||||
"libp2p": "0.28.3",
|
|
||||||
"libp2p-mplex": "0.9.5",
|
|
||||||
"libp2p-secio": "0.12.5",
|
|
||||||
"libp2p-websockets": "0.13.6",
|
|
||||||
"loglevel": "1.7.0",
|
|
||||||
"peer-id": "0.13.12",
|
|
||||||
"uuid": "8.3.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flush-write-stream": {
|
"flush-write-stream": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.1.1.tgz",
|
||||||
@ -7001,14 +6992,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"fs-extra": {
|
"fs-extra": {
|
||||||
"version": "9.0.1",
|
"version": "9.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz",
|
||||||
"integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==",
|
"integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"at-least-node": "^1.0.0",
|
"at-least-node": "^1.0.0",
|
||||||
"graceful-fs": "^4.2.0",
|
"graceful-fs": "^4.2.0",
|
||||||
"jsonfile": "^6.0.1",
|
"jsonfile": "^6.0.1",
|
||||||
"universalify": "^1.0.0"
|
"universalify": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"fs-minipass": {
|
"fs-minipass": {
|
||||||
@ -8019,9 +8010,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ip-regex": {
|
"ip-regex": {
|
||||||
"version": "4.2.0",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.3.0.tgz",
|
||||||
"integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A=="
|
"integrity": "sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q=="
|
||||||
},
|
},
|
||||||
"ipaddr.js": {
|
"ipaddr.js": {
|
||||||
"version": "1.9.1",
|
"version": "1.9.1",
|
||||||
@ -8574,9 +8565,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"it-pushable": {
|
"it-pushable": {
|
||||||
"version": "1.4.0",
|
"version": "1.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-1.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-1.4.1.tgz",
|
||||||
"integrity": "sha512-W7251Tj88YBqUIEDWCwd3F8JettSbze+bBp5B3ASzz5tYWaLUI1VDNGbjllH1T6RJ71a5jUSTSt5vHjvuzwoFw==",
|
"integrity": "sha512-XOnbDxD5YoiVtL/vobQW/ZGkzQzJv9Fs9TJlO2McfkIbolBBO2IGY6XjE1ooLfw8gQeH8XbgpoLajtPUVO8Qew==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"fast-fifo": "^1.0.0"
|
"fast-fifo": "^1.0.0"
|
||||||
}
|
}
|
||||||
@ -8723,13 +8714,6 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"graceful-fs": "^4.1.6",
|
"graceful-fs": "^4.1.6",
|
||||||
"universalify": "^2.0.0"
|
"universalify": "^2.0.0"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"universalify": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
|
|
||||||
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ=="
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jsonify": {
|
"jsonify": {
|
||||||
@ -9159,9 +9143,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"streaming-iterables": {
|
"streaming-iterables": {
|
||||||
"version": "5.0.3",
|
"version": "5.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/streaming-iterables/-/streaming-iterables-5.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/streaming-iterables/-/streaming-iterables-5.0.4.tgz",
|
||||||
"integrity": "sha512-1AgrKjHTvaaK+iA+N3BuTXQWVb7Adyb6+v8yIW3SCTwlBVYEbm76mF8Mf0/IVo+DOk7hoeELOURBKTCMhe/qow=="
|
"integrity": "sha512-nEs6hBGIPsVz6uq6pscGGKfoPDQWrDQW0b0UHurtSDysekfKLmkPg7FQVRE2sj3Rad6yUo9E1sGTxOWyYsHQ/g=="
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -10684,9 +10668,9 @@
|
|||||||
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="
|
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="
|
||||||
},
|
},
|
||||||
"p-wait-for": {
|
"p-wait-for": {
|
||||||
"version": "3.1.0",
|
"version": "3.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/p-wait-for/-/p-wait-for-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/p-wait-for/-/p-wait-for-3.2.0.tgz",
|
||||||
"integrity": "sha512-0Uy19uhxbssHelu9ynDMcON6BmMk6pH8551CvxROhiz3Vx+yC4RqxjyIDk2V4ll0g9177RKT++PK4zcV58uJ7A==",
|
"integrity": "sha512-wpgERjNkLrBiFmkMEjuZJEWKKDrNfHCKA1OhyN1wg1FrLkULbviEy6py1AyJUgZ72YWFbZ38FIpnqvVqAlDUwA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"p-timeout": "^3.0.0"
|
"p-timeout": "^3.0.0"
|
||||||
}
|
}
|
||||||
@ -10881,9 +10865,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"pathval": {
|
"pathval": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz",
|
||||||
"integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA="
|
"integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ=="
|
||||||
},
|
},
|
||||||
"pbkdf2": {
|
"pbkdf2": {
|
||||||
"version": "3.1.1",
|
"version": "3.1.1",
|
||||||
@ -11901,9 +11885,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"protocol-buffers-schema": {
|
"protocol-buffers-schema": {
|
||||||
"version": "3.4.0",
|
"version": "3.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.5.1.tgz",
|
||||||
"integrity": "sha512-G/2kcamPF2S49W5yaMGdIpkG6+5wZF0fzBteLKgEHjbNzqjZQ85aAs1iJGto31EJaSTkNvHs5IXuHSaTLWBAiA=="
|
"integrity": "sha512-YVCvdhxWNDP8/nJDyXLuM+UFsuPk4+1PB7WGPVDzm3HTHbzFLxQYeW2iZpS4mmnXrQJGBzt230t/BbEb7PrQaw=="
|
||||||
},
|
},
|
||||||
"protons": {
|
"protons": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
@ -13435,14 +13419,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sinon": {
|
"sinon": {
|
||||||
"version": "9.2.2",
|
"version": "9.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/sinon/-/sinon-9.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/sinon/-/sinon-9.2.4.tgz",
|
||||||
"integrity": "sha512-9Owi+RisvCZpB0bdOVFfL314I6I4YoRlz6Isi4+fr8q8YQsDPoCe5UnmNtKHRThX3negz2bXHWIuiPa42vM8EQ==",
|
"integrity": "sha512-zljcULZQsJxVra28qIAL6ow1Z9tpattkCTEJR4RBP3TGc00FcttsP5pK284Nas5WjMZU5Yzy3kAIp3B3KRf5Yg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@sinonjs/commons": "^1.8.1",
|
"@sinonjs/commons": "^1.8.1",
|
||||||
"@sinonjs/fake-timers": "^6.0.1",
|
"@sinonjs/fake-timers": "^6.0.1",
|
||||||
"@sinonjs/formatio": "^5.0.1",
|
"@sinonjs/samsam": "^5.3.1",
|
||||||
"@sinonjs/samsam": "^5.3.0",
|
|
||||||
"diff": "^4.0.2",
|
"diff": "^4.0.2",
|
||||||
"nise": "^4.0.4",
|
"nise": "^4.0.4",
|
||||||
"supports-color": "^7.1.0"
|
"supports-color": "^7.1.0"
|
||||||
@ -15210,12 +15193,12 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"multibase": {
|
"multibase": {
|
||||||
"version": "3.1.0",
|
"version": "3.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/multibase/-/multibase-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/multibase/-/multibase-3.1.1.tgz",
|
||||||
"integrity": "sha512-Z+pThrpbS7ckQ2DwW5mPiwCGe1a94f8DWi/OxmbyeRednVOyUKmLSE+60kL/WHFYwWnaD1OakXGk3PYI1NkMFw==",
|
"integrity": "sha512-kkSd8jWGznDNEC2eDwtnvSGlZeTeEt0+oHieNWUhv8rIi8JU3voIUo02HpJBNOtgmtxT2CPwkElub7Y9kz3nrw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@multiformats/base-x": "^4.0.1",
|
"@multiformats/base-x": "^4.0.1",
|
||||||
"web-encoding": "^1.0.4"
|
"web-encoding": "^1.0.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -15305,9 +15288,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"universalify": {
|
"universalify": {
|
||||||
"version": "1.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
|
||||||
"integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug=="
|
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ=="
|
||||||
},
|
},
|
||||||
"unpipe": {
|
"unpipe": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/fluencelabs/fluence-admin#readme",
|
"homepage": "https://github.com/fluencelabs/fluence-admin#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fluencelabs/fluence-network-environment": "1.0.5",
|
"@fluencelabs/fluence": "0.9.6",
|
||||||
"fluence": "0.7.108",
|
"@fluencelabs/fluence-network-environment": "1.0.8",
|
||||||
"tachyons": "^4.12.0"
|
"tachyons": "^4.12.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
64
src/index.ts
64
src/index.ts
@ -16,17 +16,17 @@
|
|||||||
|
|
||||||
import 'tachyons/css/tachyons.min.css';
|
import 'tachyons/css/tachyons.min.css';
|
||||||
import './main.css';
|
import './main.css';
|
||||||
import Fluence from 'fluence';
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||||
import { build } from 'fluence/dist/particle';
|
import log from 'loglevel';
|
||||||
import { registerService } from 'fluence/dist/globalState';
|
import { Node, dev, testNet } from '@fluencelabs/fluence-network-environment';
|
||||||
import { ServiceOne } from 'fluence/dist/service';
|
import { createClient, generatePeerId, Particle, sendParticle, subscribeToEvent } from '@fluencelabs/fluence';
|
||||||
import { faasNetHttps, dev, Node } from '@fluencelabs/fluence-network-environment';
|
|
||||||
import * as serviceWorker from './serviceWorker';
|
|
||||||
import { Elm } from './Main.elm';
|
import { Elm } from './Main.elm';
|
||||||
|
import * as serviceWorker from './serviceWorker';
|
||||||
|
|
||||||
const relayIdx = 2;
|
const relayIdx = 2;
|
||||||
|
|
||||||
export const relays: Node[] = faasNetHttps;
|
// const relays: Node[] = dev;
|
||||||
|
const relays: Node[] = testNet;
|
||||||
|
|
||||||
function genFlags(peerId: string): any {
|
function genFlags(peerId: string): any {
|
||||||
return {
|
return {
|
||||||
@ -67,53 +67,37 @@ function event(
|
|||||||
/* eslint-enable */
|
/* eslint-enable */
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
Fluence.setLogLevel('silent');
|
log.setLevel('debug');
|
||||||
const pid = await Fluence.generatePeerId();
|
const pid = await generatePeerId();
|
||||||
const flags = genFlags(pid.toB58String());
|
const flags = genFlags(pid.toB58String());
|
||||||
|
|
||||||
// If the relay is ever changed, an event shall be sent to elm
|
// If the relay is ever changed, an event shall be sent to elm
|
||||||
const client = await Fluence.connect(relays[relayIdx].multiaddr, pid);
|
const client = await createClient(relays[relayIdx].multiaddr, pid);
|
||||||
|
|
||||||
const app = Elm.Main.init({
|
const app = Elm.Main.init({
|
||||||
node: document.getElementById('root'),
|
node: document.getElementById('root'),
|
||||||
flags,
|
flags,
|
||||||
});
|
});
|
||||||
|
|
||||||
const eventService = new ServiceOne('event', (fnName, args: any[], _tetraplets) => {
|
subscribeToEvent(client, 'event', 'peers_discovered', (args, _tetraplets) => {
|
||||||
// console.log('event service called: ', fnName);
|
|
||||||
// console.log('from: ', args[0]);
|
|
||||||
console.log(`event from ${args[0]} received:`, args);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (fnName === 'peers_discovered') {
|
app.ports.eventReceiver.send(event('peers_discovered', args[0], args[1]));
|
||||||
app.ports.eventReceiver.send(event(fnName, args[0], args[1]));
|
|
||||||
} else if (fnName === 'all_info') {
|
|
||||||
app.ports.eventReceiver.send(event(fnName, args[0], undefined, args[1], args[2], args[3], args[4]));
|
|
||||||
} else {
|
|
||||||
console.error('UNHANDLED');
|
|
||||||
}
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
log.error('Elm eventreceiver failed: ', err);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
|
||||||
});
|
});
|
||||||
registerService(eventService);
|
|
||||||
|
|
||||||
app.ports.sendParticle.subscribe(async (part: any) => {
|
subscribeToEvent(client, 'event', 'all_info', (args, _tetraplets) => {
|
||||||
console.log('Going to build particle', part);
|
try {
|
||||||
const jsonData = part.data;
|
app.ports.eventReceiver.send(event('all_info', args[0], undefined, args[1], args[2], args[3], args[4]));
|
||||||
|
} catch (err) {
|
||||||
const map = new Map<string, string>();
|
log.error('Elm eventreceiver failed: ', err);
|
||||||
for (const v in jsonData) {
|
|
||||||
if (jsonData.hasOwnProperty(v)) {
|
|
||||||
map.set(v, jsonData[v]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const particle = await build(client.selfPeerId, part.script, map, 45000);
|
app.ports.sendParticle.subscribe(async (part: { script: string; data: any }) => {
|
||||||
console.log('Building a particle with AIR script: ', particle);
|
const particle = new Particle(part.script, part.data, 45000);
|
||||||
await client.sendParticle(particle);
|
await sendParticle(client, particle);
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
@ -122,12 +106,8 @@ function event(
|
|||||||
// Learn more about service workers: https://bit.ly/CRA-PWA
|
// Learn more about service workers: https://bit.ly/CRA-PWA
|
||||||
serviceWorker.unregister();
|
serviceWorker.unregister();
|
||||||
|
|
||||||
async function test() {}
|
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
test: any;
|
test: any;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.test = test;
|
|
||||||
|
Loading…
Reference in New Issue
Block a user