forked from Qortal/qortal-ui
Merge branch 'master' into feature/new-editor-file-import
This commit is contained in:
commit
5df8f227f8
@ -29,7 +29,7 @@ Easiest way to install the lastest required packages on Linux is via nvm.
|
|||||||
``` nvm ls-remote ``` (Fetch list of available versions) <br/>
|
``` nvm ls-remote ``` (Fetch list of available versions) <br/>
|
||||||
``` nvm install v16.17.1 ``` (LTS: Gallium supported by Electron) <br/>
|
``` nvm install v16.17.1 ``` (LTS: Gallium supported by Electron) <br/>
|
||||||
``` npm --location=global install yarn@1.22.19 ``` <br/>
|
``` npm --location=global install yarn@1.22.19 ``` <br/>
|
||||||
``` npm --location=global install npm@9.2.0 ``` <br/>
|
``` npm --location=global install npm@9.3.1 ``` <br/>
|
||||||
|
|
||||||
On BSD do a ``` pkg_add node followed by npm install -g yarn ```
|
On BSD do a ``` pkg_add node followed by npm install -g yarn ```
|
||||||
|
|
||||||
|
BIN
img/badges/Level-8.png
Normal file
BIN
img/badges/Level-8.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
BIN
img/badges/level-10.png
Normal file
BIN
img/badges/level-10.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
BIN
img/badges/level-6.png
Normal file
BIN
img/badges/level-6.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
BIN
img/badges/level-7.png
Normal file
BIN
img/badges/level-7.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.9 KiB |
BIN
img/badges/level-9.png
Normal file
BIN
img/badges/level-9.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.2 KiB |
@ -10,7 +10,7 @@
|
|||||||
"electron_translate_7": "Актуализацията е готова за инсталиране",
|
"electron_translate_7": "Актуализацията е готова за инсталиране",
|
||||||
"electron_translate_8": "Беше изтеглена нова версия на Qortal UI.",
|
"electron_translate_8": "Беше изтеглена нова версия на Qortal UI.",
|
||||||
"electron_translate_9": "Щракнете върху ИНСТАЛИРАНЕ СЕГА, за да приложите актуализация, МОЖЕ БИ ПО-КЪСНО, за да не актуализирате потребителския интерфейс.",
|
"electron_translate_9": "Щракнете върху ИНСТАЛИРАНЕ СЕГА, за да приложите актуализация, МОЖЕ БИ ПО-КЪСНО, за да не актуализирате потребителския интерфейс.",
|
||||||
"electron_translate_10": "Грешка при актуализиране...",
|
"electron_translate_10": "Временна неуспешна актуализация, ще опитаме отново по-късно",
|
||||||
"electron_translate_11": "ИЗТЕГЛЕТЕ АКТУАЛИЗАЦИЯТА",
|
"electron_translate_11": "ИЗТЕГЛЕТЕ АКТУАЛИЗАЦИЯТА",
|
||||||
"electron_translate_12": "Ще бъде изтеглено ⌛️ във фонов режим!"
|
"electron_translate_12": "Ще бъде изтеглено ⌛️ във фонов режим!"
|
||||||
}
|
}
|
@ -10,7 +10,7 @@
|
|||||||
"electron_translate_7": "Update zur Installation bereit",
|
"electron_translate_7": "Update zur Installation bereit",
|
||||||
"electron_translate_8": "Eine neue Qortal-UI-Version wurde heruntergeladen.",
|
"electron_translate_8": "Eine neue Qortal-UI-Version wurde heruntergeladen.",
|
||||||
"electron_translate_9": "Klicken Sie auf JETZT INSTALLIEREN, um das Update anzuwenden, VIELLEICHT SPÄTER, um die Benutzeroberfläche nicht zu aktualisieren.",
|
"electron_translate_9": "Klicken Sie auf JETZT INSTALLIEREN, um das Update anzuwenden, VIELLEICHT SPÄTER, um die Benutzeroberfläche nicht zu aktualisieren.",
|
||||||
"electron_translate_10": "Fehler beim Aktualisieren...",
|
"electron_translate_10": "Vorübergehender Aktualisierungsfehler, wir versuchen es später erneut",
|
||||||
"electron_translate_11": "UPDATE HERUNTERLADEN",
|
"electron_translate_11": "UPDATE HERUNTERLADEN",
|
||||||
"electron_translate_12": "Das Update wird im Hintergrund heruntergeladen ⌛️!"
|
"electron_translate_12": "Das Update wird im Hintergrund heruntergeladen ⌛️!"
|
||||||
}
|
}
|
@ -10,7 +10,7 @@
|
|||||||
"electron_translate_7": "Update ready to install",
|
"electron_translate_7": "Update ready to install",
|
||||||
"electron_translate_8": "A new Qortal UI version has been downloaded.",
|
"electron_translate_8": "A new Qortal UI version has been downloaded.",
|
||||||
"electron_translate_9": "Click INSTALL NOW to apply update, MAYBE LATER to not update the UI.",
|
"electron_translate_9": "Click INSTALL NOW to apply update, MAYBE LATER to not update the UI.",
|
||||||
"electron_translate_10": "Error while Updating...",
|
"electron_translate_10": "Temporary update failure, will try again later",
|
||||||
"electron_translate_11": "DOWNLOAD UPDATE",
|
"electron_translate_11": "DOWNLOAD UPDATE",
|
||||||
"electron_translate_12": "It will be downloaded ⌛️ in the background!"
|
"electron_translate_12": "It will be downloaded ⌛️ in the background!"
|
||||||
}
|
}
|
@ -10,7 +10,7 @@
|
|||||||
"electron_translate_7": "Actualización lista para instalar",
|
"electron_translate_7": "Actualización lista para instalar",
|
||||||
"electron_translate_8": "Se ha descargado una nueva versión de la interfaz de usuario de Qortal.",
|
"electron_translate_8": "Se ha descargado una nueva versión de la interfaz de usuario de Qortal.",
|
||||||
"electron_translate_9": "Haz clic en INSTALAR AHORA para aplicar la actualización, QUIZÁS MÁS TARDE para no actualizar la interfaz de usuario".,
|
"electron_translate_9": "Haz clic en INSTALAR AHORA para aplicar la actualización, QUIZÁS MÁS TARDE para no actualizar la interfaz de usuario".,
|
||||||
"electron_translate_10": "Error al actualizar...",
|
"electron_translate_10": "Error de actualización temporal, lo intentaré más tarde",
|
||||||
"electron_translate_11": "DESCARGAR ACTUALIZACIÓN",
|
"electron_translate_11": "DESCARGAR ACTUALIZACIÓN",
|
||||||
"electron_translate_12": "¡Se descargará ⌛️ en segundo plano!"
|
"electron_translate_12": "¡Se descargará ⌛️ en segundo plano!"
|
||||||
}
|
}
|
@ -10,7 +10,7 @@
|
|||||||
"electron_translate_7": "Mise à jour prête à installer",
|
"electron_translate_7": "Mise à jour prête à installer",
|
||||||
"electron_translate_8": "Une nouvelle version de l'interface utilisateur de Qortal a été téléchargée.",
|
"electron_translate_8": "Une nouvelle version de l'interface utilisateur de Qortal a été téléchargée.",
|
||||||
"electron_translate_9": "Cliquez sur INSTALLER MAINTENANT pour appliquer la mise à jour, PEUT-ÊTRE PLUS TARD pour ne pas mettre à jour l'interface utilisateur.",
|
"electron_translate_9": "Cliquez sur INSTALLER MAINTENANT pour appliquer la mise à jour, PEUT-ÊTRE PLUS TARD pour ne pas mettre à jour l'interface utilisateur.",
|
||||||
"electron_translate_10": "Erreur lors de la mise à jour...",
|
"electron_translate_10": "Échec de la mise à jour temporaire, réessayera plus tard",
|
||||||
"electron_translate_11": "TÉLÉCHARGER LA MISE À JOUR",
|
"electron_translate_11": "TÉLÉCHARGER LA MISE À JOUR",
|
||||||
"electron_translate_12": "Il sera téléchargé ⌛️ en arrière-plan !"
|
"electron_translate_12": "Il sera téléchargé ⌛️ en arrière-plan !"
|
||||||
}
|
}
|
@ -10,7 +10,7 @@
|
|||||||
"electron_translate_7": "Aggiornamento pronto per l'installazione",
|
"electron_translate_7": "Aggiornamento pronto per l'installazione",
|
||||||
"electron_translate_8": "È stata scaricata una nuova versione dell'interfaccia utente di Qortal.",
|
"electron_translate_8": "È stata scaricata una nuova versione dell'interfaccia utente di Qortal.",
|
||||||
"electron_translate_9": "Fai clic su INSTALLA ORA per applicare l'aggiornamento, FORSE DOPO per non aggiornare l'interfaccia utente.",
|
"electron_translate_9": "Fai clic su INSTALLA ORA per applicare l'aggiornamento, FORSE DOPO per non aggiornare l'interfaccia utente.",
|
||||||
"electron_translate_10": "Errore durante l'aggiornamento...",
|
"electron_translate_10": "Errore di aggiornamento temporaneo, riproverà più tardi",
|
||||||
"electron_translate_11": "SCARICA AGGIORNAMENTO",
|
"electron_translate_11": "SCARICA AGGIORNAMENTO",
|
||||||
"electron_translate_12": "Verrà scaricato ⌛️ in background!"
|
"electron_translate_12": "Verrà scaricato ⌛️ in background!"
|
||||||
}
|
}
|
@ -10,7 +10,7 @@
|
|||||||
"electron_translate_7": "업데이트 설치 준비 완료",
|
"electron_translate_7": "업데이트 설치 준비 완료",
|
||||||
"electron_translate_8": "새로운 Qortal UI 버전이 다운로드되었습니다.",
|
"electron_translate_8": "새로운 Qortal UI 버전이 다운로드되었습니다.",
|
||||||
"electron_translate_9": "업데이트를 적용하려면 지금 설치를 클릭하고 UI를 업데이트하지 않으려면 나중에 할 수도 있습니다.",
|
"electron_translate_9": "업데이트를 적용하려면 지금 설치를 클릭하고 UI를 업데이트하지 않으려면 나중에 할 수도 있습니다.",
|
||||||
"electron_translate_10": "업데이트 중 오류...",
|
"electron_translate_10": "임시 업데이트 실패, 나중에 다시 시도합니다.",
|
||||||
"electron_translate_11": "업데이트 다운로드",
|
"electron_translate_11": "업데이트 다운로드",
|
||||||
"electron_translate_12": "백그라운드에서 ⌛️ 다운로드됩니다!"
|
"electron_translate_12": "백그라운드에서 ⌛️ 다운로드됩니다!"
|
||||||
}
|
}
|
@ -10,7 +10,7 @@
|
|||||||
"electron_translate_7": "Update klaar om te installeren",
|
"electron_translate_7": "Update klaar om te installeren",
|
||||||
"electron_translate_8": "Er is een nieuwe Qortal UI-versie gedownload.",
|
"electron_translate_8": "Er is een nieuwe Qortal UI-versie gedownload.",
|
||||||
"electron_translate_9": "Klik op NU INSTALLEREN om de update toe te passen, MISSCHIEN LATER om de gebruikersinterface niet bij te werken.",
|
"electron_translate_9": "Klik op NU INSTALLEREN om de update toe te passen, MISSCHIEN LATER om de gebruikersinterface niet bij te werken.",
|
||||||
"electron_translate_10": "Fout tijdens updaten...",
|
"electron_translate_10": "Tijdelijke update mislukt, zal het later opnieuw proberen",
|
||||||
"electron_translate_11": "UPDATE DOWNLOADEN",
|
"electron_translate_11": "UPDATE DOWNLOADEN",
|
||||||
"electron_translate_12": "Het wordt ⌛️ op de achtergrond gedownload!"
|
"electron_translate_12": "Het wordt ⌛️ op de achtergrond gedownload!"
|
||||||
}
|
}
|
@ -10,7 +10,7 @@
|
|||||||
"electron_translate_7": "Atualização pronta para instalar",
|
"electron_translate_7": "Atualização pronta para instalar",
|
||||||
"electron_translate_8": "Uma nova versão Qortal UI foi baixada.",
|
"electron_translate_8": "Uma nova versão Qortal UI foi baixada.",
|
||||||
"electron_translate_9": "Clique em INSTALAR AGORA para aplicar a atualização, TALVEZ MAIS TARDE para não atualizar a UI.",
|
"electron_translate_9": "Clique em INSTALAR AGORA para aplicar a atualização, TALVEZ MAIS TARDE para não atualizar a UI.",
|
||||||
"electron_translate_10": "Erro ao atualizar...",
|
"electron_translate_10": "Falha de atualização temporária, tentará novamente mais tarde",
|
||||||
"electron_translate_11": "BAIXAR ATUALIZAÇÃO",
|
"electron_translate_11": "BAIXAR ATUALIZAÇÃO",
|
||||||
"electron_translate_12": "Será baixado ⌛️ em segundo plano!"
|
"electron_translate_12": "Será baixado ⌛️ em segundo plano!"
|
||||||
}
|
}
|
@ -10,7 +10,7 @@
|
|||||||
"electron_translate_7": "Atualização pronta para instalar",
|
"electron_translate_7": "Atualização pronta para instalar",
|
||||||
"electron_translate_8": "Uma nova versão Qortal UI foi baixada.",
|
"electron_translate_8": "Uma nova versão Qortal UI foi baixada.",
|
||||||
"electron_translate_9": "Clique em INSTALAR AGORA para aplicar a atualização, TALVEZ MAIS TARDE para não atualizar a UI.",
|
"electron_translate_9": "Clique em INSTALAR AGORA para aplicar a atualização, TALVEZ MAIS TARDE para não atualizar a UI.",
|
||||||
"electron_translate_10": "Erro ao atualizar...",
|
"electron_translate_10": "Falha de atualização temporária, tentará novamente mais tarde",
|
||||||
"electron_translate_11": "BAIXAR ATUALIZAÇÃO",
|
"electron_translate_11": "BAIXAR ATUALIZAÇÃO",
|
||||||
"electron_translate_12": "Será baixado ⌛️ em segundo plano!"
|
"electron_translate_12": "Será baixado ⌛️ em segundo plano!"
|
||||||
}
|
}
|
@ -10,7 +10,7 @@
|
|||||||
"electron_translate_7": "Обновление готово к установке",
|
"electron_translate_7": "Обновление готово к установке",
|
||||||
"electron_translate_8": "Загружена новая версия пользовательского интерфейса Qortal.",
|
"electron_translate_8": "Загружена новая версия пользовательского интерфейса Qortal.",
|
||||||
"electron_translate_9": "Нажмите УСТАНОВИТЬ СЕЙЧАС, чтобы применить обновление, МОЖЕТ БЫТЬ ПОЗЖЕ, чтобы не обновлять пользовательский интерфейс.",
|
"electron_translate_9": "Нажмите УСТАНОВИТЬ СЕЙЧАС, чтобы применить обновление, МОЖЕТ БЫТЬ ПОЗЖЕ, чтобы не обновлять пользовательский интерфейс.",
|
||||||
"electron_translate_10": "Ошибка при обновлении...",
|
"electron_translate_10": "Временная ошибка обновления, повторите попытку позже",
|
||||||
"electron_translate_11": "СКАЧАТЬ ОБНОВЛЕНИЕ",
|
"electron_translate_11": "СКАЧАТЬ ОБНОВЛЕНИЕ",
|
||||||
"electron_translate_12": "Он будет загружен ⌛️ в фоновом режиме!"
|
"electron_translate_12": "Он будет загружен ⌛️ в фоновом режиме!"
|
||||||
}
|
}
|
@ -10,7 +10,7 @@
|
|||||||
"electron_translate_7": "Güncelleme yüklenmeye hazır",
|
"electron_translate_7": "Güncelleme yüklenmeye hazır",
|
||||||
"electron_translate_8": "Yeni bir Qortal UI sürümü indirildi.",
|
"electron_translate_8": "Yeni bir Qortal UI sürümü indirildi.",
|
||||||
"electron_translate_9": "Güncellemeyi uygulamak için ŞİMDİ YÜKLE'ye tıklayın, kullanıcı arayüzünü güncellememek için MAYBE SONRA tıklayın.",
|
"electron_translate_9": "Güncellemeyi uygulamak için ŞİMDİ YÜKLE'ye tıklayın, kullanıcı arayüzünü güncellememek için MAYBE SONRA tıklayın.",
|
||||||
"electron_translate_10": "Güncelleme Sırasında Hata...",
|
"electron_translate_10": "Geçici güncelleme hatası, daha sonra tekrar denenecek",
|
||||||
"electron_translate_11": "GÜNCELLEMEYİ İNDİRİN",
|
"electron_translate_11": "GÜNCELLEMEYİ İNDİRİN",
|
||||||
"electron_translate_12": "Arka planda ⌛️ indirilecek!"
|
"electron_translate_12": "Arka planda ⌛️ indirilecek!"
|
||||||
}
|
}
|
@ -10,7 +10,7 @@
|
|||||||
"electron_translate_7": "Update ready to install",
|
"electron_translate_7": "Update ready to install",
|
||||||
"electron_translate_8": "A new Qortal UI version has been downloaded.",
|
"electron_translate_8": "A new Qortal UI version has been downloaded.",
|
||||||
"electron_translate_9": "Click INSTALL NOW to apply update, MAYBE LATER to not update the UI.",
|
"electron_translate_9": "Click INSTALL NOW to apply update, MAYBE LATER to not update the UI.",
|
||||||
"electron_translate_10": "Error while Updating...",
|
"electron_translate_10": "Temporary update failure, will try again later",
|
||||||
"electron_translate_11": "DOWNLOAD UPDATE",
|
"electron_translate_11": "DOWNLOAD UPDATE",
|
||||||
"electron_translate_12": "It will be downloaded ⌛️ in the background!"
|
"electron_translate_12": "It will be downloaded ⌛️ in the background!"
|
||||||
}
|
}
|
@ -10,7 +10,7 @@
|
|||||||
"electron_translate_7": "更新准备安装",
|
"electron_translate_7": "更新准备安装",
|
||||||
"electron_translate_8": "已下载新的 Qortal UI 版本。",
|
"electron_translate_8": "已下载新的 Qortal UI 版本。",
|
||||||
"electron_translate_9": "点击现在安装应用更新,可能稍后不更新用户界面。",
|
"electron_translate_9": "点击现在安装应用更新,可能稍后不更新用户界面。",
|
||||||
"electron_translate_10": "更新时出错...",
|
"electron_translate_10": "暂时更新失败,稍后再试",
|
||||||
"electron_translate_11": "下载更新",
|
"electron_translate_11": "下载更新",
|
||||||
"electron_translate_12": "它将在后台下载 ⌛️!"
|
"electron_translate_12": "它将在后台下载 ⌛️!"
|
||||||
}
|
}
|
@ -10,7 +10,7 @@
|
|||||||
"electron_translate_7": "更新準備安裝",
|
"electron_translate_7": "更新準備安裝",
|
||||||
"electron_translate_8": "已下載新的 Qortal UI 版本。",
|
"electron_translate_8": "已下載新的 Qortal UI 版本。",
|
||||||
"electron_translate_9": "點擊現在安裝應用更新,可能稍後不更新用戶界面。",
|
"electron_translate_9": "點擊現在安裝應用更新,可能稍後不更新用戶界面。",
|
||||||
"electron_translate_10": "更新時出錯...",
|
"electron_translate_10": "暫時更新失敗,稍後再試",
|
||||||
"electron_translate_11": "下載更新",
|
"electron_translate_11": "下載更新",
|
||||||
"electron_translate_12": "它將在後台下載 ⌛️!"
|
"electron_translate_12": "它將在後台下載 ⌛️!"
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "qortal-ui",
|
"name": "qortal-ui",
|
||||||
"version": "2.2.4",
|
"version": "3.0.1",
|
||||||
"description": "Qortal Project - decentralize the world - Data storage, communications, web hosting, decentralized trading, complete infrastructure for the future blockchain-based Internet",
|
"description": "Qortal Project - decentralize the world - Data storage, communications, web hosting, decentralized trading, complete infrastructure for the future blockchain-based Internet",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"QORT",
|
"QORT",
|
||||||
@ -37,12 +37,9 @@
|
|||||||
"os-locale": "3.0.0"
|
"os-locale": "3.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@electron/notarize": "1.2.3",
|
"electron": "22.2.0",
|
||||||
"electron": "22.0.0",
|
|
||||||
"electron-builder": "23.6.0",
|
"electron-builder": "23.6.0",
|
||||||
"electron-packager": "17.1.1",
|
"electron-packager": "17.1.1",
|
||||||
"eslint-plugin-lit": "1.8.0",
|
|
||||||
"eslint-plugin-wc": "1.4.0",
|
|
||||||
"shelljs": "0.8.5"
|
"shelljs": "0.8.5"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
@ -9,7 +9,8 @@ html {
|
|||||||
--copybutton: #707584;
|
--copybutton: #707584;
|
||||||
--chat-group: #080808;
|
--chat-group: #080808;
|
||||||
--chat-bubble: #9f9f9f0a;
|
--chat-bubble: #9f9f9f0a;
|
||||||
--chat-bubble-bg: #f3f3f3;
|
--chat-bubble-bg: #e6e6e6;
|
||||||
|
--chat-bubble-myBg: #d1ddf2;
|
||||||
--chat-bubble-msg-color: #080808;
|
--chat-bubble-msg-color: #080808;
|
||||||
--reaction-bubble-outline: #6b6969;
|
--reaction-bubble-outline: #6b6969;
|
||||||
--chat-menu-bg: #ffffff;
|
--chat-menu-bg: #ffffff;
|
||||||
@ -28,6 +29,7 @@ html {
|
|||||||
--relaynodetxt: #646464;
|
--relaynodetxt: #646464;
|
||||||
--menuhover: #eeeeee;
|
--menuhover: #eeeeee;
|
||||||
--menuactive: #ebebeb;
|
--menuactive: #ebebeb;
|
||||||
|
--menuactivergb: 235, 235, 235;
|
||||||
--mainmenutext: #080808;
|
--mainmenutext: #080808;
|
||||||
--mainmenutexthover: #080808;
|
--mainmenutexthover: #080808;
|
||||||
--switchbackground: #666666;
|
--switchbackground: #666666;
|
||||||
@ -50,6 +52,7 @@ html {
|
|||||||
--lightChatHeadHover: #1e1f201a;
|
--lightChatHeadHover: #1e1f201a;
|
||||||
--group-header: #929292;
|
--group-header: #929292;
|
||||||
--group-drop-shadow: rgb(17 17 26 / 10%) 0px 1px 0px;
|
--group-drop-shadow: rgb(17 17 26 / 10%) 0px 1px 0px;
|
||||||
|
--reactions-tooltip-bg: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
html[theme="dark"] {
|
html[theme="dark"] {
|
||||||
@ -64,6 +67,7 @@ html[theme="dark"] {
|
|||||||
--chat-group: #ffffff;
|
--chat-group: #ffffff;
|
||||||
--chat-bubble: #9694941a;
|
--chat-bubble: #9694941a;
|
||||||
--chat-bubble-bg: #2d3749;
|
--chat-bubble-bg: #2d3749;
|
||||||
|
--chat-bubble-myBg: #40444d;
|
||||||
--chat-bubble-msg-color: #ffffff;
|
--chat-bubble-msg-color: #ffffff;
|
||||||
--reaction-bubble-outline: #ffffff;
|
--reaction-bubble-outline: #ffffff;
|
||||||
--chat-menu-bg: #32394c;
|
--chat-menu-bg: #32394c;
|
||||||
@ -82,6 +86,7 @@ html[theme="dark"] {
|
|||||||
--relaynodetxt: #d4d4d4;
|
--relaynodetxt: #d4d4d4;
|
||||||
--menuhover: #008fd5;
|
--menuhover: #008fd5;
|
||||||
--menuactive: #008fd5;
|
--menuactive: #008fd5;
|
||||||
|
--menuactivergb: 0, 143, 213;
|
||||||
--mainmenutext: #008fd5;
|
--mainmenutext: #008fd5;
|
||||||
--mainmenutexthover: #0f1a2e;
|
--mainmenutexthover: #0f1a2e;
|
||||||
--switchbackground: #eeeeee;
|
--switchbackground: #eeeeee;
|
||||||
@ -103,5 +108,6 @@ html[theme="dark"] {
|
|||||||
--chatHeadTextActive: #ffffff;
|
--chatHeadTextActive: #ffffff;
|
||||||
--lightChatHeadHover: #e0e1e31a;
|
--lightChatHeadHover: #e0e1e31a;
|
||||||
--group-header: #c8c8c8;
|
--group-header: #c8c8c8;
|
||||||
--group-drop-shadow: rgb(191 191 191 / 32%) 0px 1px 0px
|
--group-drop-shadow: rgb(191 191 191 / 32%) 0px 1px 0px;
|
||||||
|
--reactions-tooltip-bg: #161515;
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -571,14 +571,24 @@
|
|||||||
"cchange62": "Wrong Username and Address Inputted! Please try again!",
|
"cchange62": "Wrong Username and Address Inputted! Please try again!",
|
||||||
"cchange63": "Enter Enabled",
|
"cchange63": "Enter Enabled",
|
||||||
"cchange64": "Enter Disabled",
|
"cchange64": "Enter Disabled",
|
||||||
"cchange65": "Uploading attachment. This may take up to one minute.",
|
"cchange65": "Please enter a recipient",
|
||||||
"cchange66": "Deleting attachment. This may take up to one minute.",
|
"cchange66": "Cannot fetch replied-to message. Message is too old.",
|
||||||
"cchange67": "Attachment size exceeds 1 MB",
|
|
||||||
"cchange68": "edited",
|
"cchange68": "edited",
|
||||||
"cchange69": "Are you sure you want to delete this image?",
|
"cchange69": "Auto-view images",
|
||||||
"cchange70": "Are you sure you want to delete this attachment?",
|
"cchange70": "This image type is not supported",
|
||||||
"cchange71": "This image has been deleted",
|
"cchange71": "and",
|
||||||
"cchange72": "This attachment has been deleted"
|
"cchange72": "other",
|
||||||
|
"cchange73": "s",
|
||||||
|
"cchange74": "reacted with",
|
||||||
|
"cchange75": "Uploading attachment. This may take up to one minute.",
|
||||||
|
"cchange76": "Deleting attachment. This may take up to one minute.",
|
||||||
|
"cchange77": "Attachment size exceeds 1 MB",
|
||||||
|
"cchange78": "Are you sure you want to delete this image?",
|
||||||
|
"cchange79": "Are you sure you want to delete this attachment?",
|
||||||
|
"cchange80": "This image has been deleted",
|
||||||
|
"cchange81": "This image type is not supported",
|
||||||
|
"cchange82": "This attachment has been deleted",
|
||||||
|
"cchange90": "No messages"
|
||||||
},
|
},
|
||||||
"welcomepage": {
|
"welcomepage": {
|
||||||
"wcchange1": "Welcome to Q-Chat",
|
"wcchange1": "Welcome to Q-Chat",
|
||||||
@ -669,7 +679,8 @@
|
|||||||
"gchange55": "Search Private Group",
|
"gchange55": "Search Private Group",
|
||||||
"gchange56": "Group Name To Search",
|
"gchange56": "Group Name To Search",
|
||||||
"gchange57": "Private Group Name Not Found",
|
"gchange57": "Private Group Name Not Found",
|
||||||
"gchange58": "Note that group name must exact match."
|
"gchange58": "Note that group name must exact match.",
|
||||||
|
"gchange59": "Show / Hide Ticker"
|
||||||
},
|
},
|
||||||
"puzzlepage": {
|
"puzzlepage": {
|
||||||
"pchange1": "Puzzles",
|
"pchange1": "Puzzles",
|
||||||
@ -867,5 +878,23 @@
|
|||||||
"mg59": "Cancel Join Request Successfully Accepted",
|
"mg59": "Cancel Join Request Successfully Accepted",
|
||||||
"mg60": "Are you sure to cancel the join request from this member ?",
|
"mg60": "Are you sure to cancel the join request from this member ?",
|
||||||
"mg61": "On pressing confirm, the cancel join request will be sent!"
|
"mg61": "On pressing confirm, the cancel join request will be sent!"
|
||||||
|
},
|
||||||
|
"info": {
|
||||||
|
"inf1": "Trade Portal Information",
|
||||||
|
"inf2": "Close Trade Portal Info",
|
||||||
|
"inf3": "This is a market to BUY QORT with",
|
||||||
|
"inf4": "- 'open market sells' are QORT SELL ORDERS.",
|
||||||
|
"inf5": "You can only buy ONE order at a time simply click an order that you wish to buy with",
|
||||||
|
"inf6": "and it will populate the 'BUY QORT' box with the details, then click BUY.",
|
||||||
|
"inf7": "Auto Buy Information",
|
||||||
|
"inf8": "Close Auto Buy Info",
|
||||||
|
"inf9": "'Auto Buy' is a feature that allows 'buy orders' to be placed on the Trade Portal. These 'buy orders' are only visible by the person placing them. They are not 'public' buy orders like the 'open market sells' are, and are NOT stored on the Qortal blockchain. Auto Buy is a UI feature, and as such requires that the UI is RUNNING.",
|
||||||
|
"inf10": "To place an Auto Buy order click 'Add Auto Buy Order' button and fill out the box that comes up. Input the AMOUNT OF QORT you wish to BUY, and the PRICE you are willing to BUY UP TO. Once the order is active, Auto Buy will buy UP TO that amount of QORT for you, at UP TO the price you set (starting at the lowest order and moving up the books.)",
|
||||||
|
"inf11": "Simply LEAVE YOUR UI RUNNING and Auto Buy does the rest, automatically!",
|
||||||
|
"inf12": "You CAN browse other plugins in the UI (Q-Chat, wallets, etc.) but you CANNOT CLOSE THE UI if you want your Auto Buy to complete. Leaving the UI 'minimized' on the 'taskbar' or 'panel' is just fine, as long as the UI remains OPEN Auto Buy will function.",
|
||||||
|
"inf13": "Automatically buy",
|
||||||
|
"inf14": "with",
|
||||||
|
"inf15": "Active Auto Buy Orders",
|
||||||
|
"inf16": "Auto Buy"
|
||||||
}
|
}
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -17,9 +17,9 @@
|
|||||||
"author": "QORTAL <admin@qortal.org>",
|
"author": "QORTAL <admin@qortal.org>",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hapi/hapi": "21.2.0",
|
"@hapi/hapi": "21.2.1",
|
||||||
"@hapi/inert": "7.0.0",
|
"@hapi/inert": "7.0.0",
|
||||||
"sass": "1.57.1"
|
"sass": "1.58.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "7.20.12",
|
"@babel/core": "7.20.12",
|
||||||
@ -58,23 +58,23 @@
|
|||||||
"@rollup/plugin-commonjs": "24.0.1",
|
"@rollup/plugin-commonjs": "24.0.1",
|
||||||
"@rollup/plugin-node-resolve": "15.0.1",
|
"@rollup/plugin-node-resolve": "15.0.1",
|
||||||
"@rollup/plugin-replace": "5.0.2",
|
"@rollup/plugin-replace": "5.0.2",
|
||||||
"@rollup/plugin-terser": "0.3.0",
|
"@rollup/plugin-terser": "0.4.0",
|
||||||
"@vaadin/button": "23.3.5",
|
"@vaadin/button": "23.3.6",
|
||||||
"@vaadin/grid": "23.3.5",
|
"@vaadin/grid": "23.3.6",
|
||||||
"@vaadin/icons": "23.3.5",
|
"@vaadin/icons": "23.3.6",
|
||||||
"@vaadin/password-field": "23.3.5",
|
"@vaadin/password-field": "23.3.6",
|
||||||
"@vaadin/tooltip": "23.3.5",
|
"@vaadin/tooltip": "23.3.6",
|
||||||
"asmcrypto.js": "2.3.2",
|
"asmcrypto.js": "2.3.2",
|
||||||
"bcryptjs": "2.4.3",
|
"bcryptjs": "2.4.3",
|
||||||
"epml": "0.3.3",
|
"epml": "0.3.3",
|
||||||
"file-saver": "2.0.5",
|
"file-saver": "2.0.5",
|
||||||
"lit": "2.6.1",
|
"lit": "2.6.1",
|
||||||
"lit-translate": "2.0.1",
|
"lit-translate": "2.0.1",
|
||||||
|
"localforage": "1.10.0",
|
||||||
"pwa-helpers": "0.9.1",
|
"pwa-helpers": "0.9.1",
|
||||||
"random-sentence-generator": "0.0.8",
|
"redux": "4.2.1",
|
||||||
"redux": "4.2.0",
|
|
||||||
"redux-thunk": "2.4.2",
|
"redux-thunk": "2.4.2",
|
||||||
"rollup": "3.10.1",
|
"rollup": "3.14.0",
|
||||||
"rollup-plugin-node-globals": "1.4.0",
|
"rollup-plugin-node-globals": "1.4.0",
|
||||||
"rollup-plugin-progress": "1.1.2",
|
"rollup-plugin-progress": "1.1.2",
|
||||||
"rollup-plugin-scss": "3.0.0",
|
"rollup-plugin-scss": "3.0.0",
|
||||||
|
@ -4,6 +4,11 @@ import { store } from '../store.js'
|
|||||||
import { Epml } from '../epml.js'
|
import { Epml } from '../epml.js'
|
||||||
import { addTradeBotRoutes } from '../tradebot/addTradeBotRoutes.js'
|
import { addTradeBotRoutes } from '../tradebot/addTradeBotRoutes.js'
|
||||||
import { get, translate, translateUnsafeHTML } from 'lit-translate'
|
import { get, translate, translateUnsafeHTML } from 'lit-translate'
|
||||||
|
import localForage from "localforage";
|
||||||
|
|
||||||
|
const chatLastSeen = localForage.createInstance({
|
||||||
|
name: "chat-last-seen",
|
||||||
|
});
|
||||||
|
|
||||||
import '@polymer/paper-icon-button/paper-icon-button.js'
|
import '@polymer/paper-icon-button/paper-icon-button.js'
|
||||||
import '@polymer/paper-progress/paper-progress.js'
|
import '@polymer/paper-progress/paper-progress.js'
|
||||||
@ -27,6 +32,7 @@ import './user-info-view/user-info-view.js'
|
|||||||
import '../functional-components/side-menu.js'
|
import '../functional-components/side-menu.js'
|
||||||
import '../functional-components/side-menu-item.js'
|
import '../functional-components/side-menu-item.js'
|
||||||
import './start-minting.js'
|
import './start-minting.js'
|
||||||
|
import { setChatLastSeen } from '../redux/app/app-actions.js'
|
||||||
|
|
||||||
const parentEpml = new Epml({type: 'WINDOW', source: window.parent})
|
const parentEpml = new Epml({type: 'WINDOW', source: window.parent})
|
||||||
|
|
||||||
@ -207,7 +213,7 @@ class AppView extends connect(store)(LitElement) {
|
|||||||
|
|
||||||
#balanceheader {
|
#balanceheader {
|
||||||
flex: 0 0 24px;
|
flex: 0 0 24px;
|
||||||
padding: 12px 12px 20px 12px;
|
padding: 12px 12px 45px 12px;
|
||||||
border-bottom: 1px solid var(--border);
|
border-bottom: 1px solid var(--border);
|
||||||
background: var(--sidetopbar);
|
background: var(--sidetopbar);
|
||||||
}
|
}
|
||||||
@ -330,6 +336,15 @@ class AppView extends connect(store)(LitElement) {
|
|||||||
background-color: rgb(148, 146, 146);
|
background-color: rgb(148, 146, 146);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.balanceButton {
|
||||||
|
background-color: #03a9f4;
|
||||||
|
color: #ffffff;
|
||||||
|
margin-left: 12px;
|
||||||
|
margin-right: 12px;
|
||||||
|
padding-top: 5px;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
}
|
||||||
`
|
`
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -426,6 +441,8 @@ class AppView extends connect(store)(LitElement) {
|
|||||||
</side-menu>
|
</side-menu>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<button class="balanceButton" @click="${() => this.shBalanceTicker()}">${translate("grouppage.gchange59")}</button>
|
||||||
|
<div id="theTicker" style="display: none; margin-bottom: 20px;">
|
||||||
<div id="balanceheader">
|
<div id="balanceheader">
|
||||||
<span class="balanceheadertext">
|
<span class="balanceheadertext">
|
||||||
${this.getAllBalancesLoading ? html`
|
${this.getAllBalancesLoading ? html`
|
||||||
@ -441,6 +458,7 @@ class AppView extends connect(store)(LitElement) {
|
|||||||
</div>
|
</div>
|
||||||
${this.getAllBalancesLoading ? html`<paper-progress indeterminate style="width: 100%; margin: 4px;"></paper-progress>` : ''}
|
${this.getAllBalancesLoading ? html`<paper-progress indeterminate style="width: 100%; margin: 4px;"></paper-progress>` : ''}
|
||||||
${this.balanceTicker}
|
${this.balanceTicker}
|
||||||
|
</div>
|
||||||
<app-info></app-info>
|
<app-info></app-info>
|
||||||
</div>
|
</div>
|
||||||
</app-header-layout>
|
</app-header-layout>
|
||||||
@ -1386,6 +1404,17 @@ class AppView extends connect(store)(LitElement) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getChatLastSeen=async() => {
|
||||||
|
let items = [];
|
||||||
|
|
||||||
|
await chatLastSeen.iterate(function(value, key, iterationNumber) {
|
||||||
|
|
||||||
|
items.push({key, timestamp: value});
|
||||||
|
})
|
||||||
|
store.dispatch(setChatLastSeen(items))
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
await getOpenTradesBTC()
|
await getOpenTradesBTC()
|
||||||
await appDelay(1000)
|
await appDelay(1000)
|
||||||
await getOpenTradesLTC()
|
await getOpenTradesLTC()
|
||||||
@ -1397,6 +1426,16 @@ class AppView extends connect(store)(LitElement) {
|
|||||||
await getOpenTradesRVN()
|
await getOpenTradesRVN()
|
||||||
await appDelay(1000)
|
await appDelay(1000)
|
||||||
await getOpenTradesARRR()
|
await getOpenTradesARRR()
|
||||||
|
await getChatLastSeen()
|
||||||
|
}
|
||||||
|
|
||||||
|
shBalanceTicker() {
|
||||||
|
const targetDiv = this.shadowRoot.getElementById("theTicker")
|
||||||
|
if (targetDiv.style.display !== "none") {
|
||||||
|
targetDiv.style.display = "none";
|
||||||
|
} else {
|
||||||
|
targetDiv.style.display = "inline";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getNodeType() {
|
async getNodeType() {
|
||||||
|
@ -4,11 +4,13 @@ import { store } from '../../store.js'
|
|||||||
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
||||||
|
|
||||||
import { createWallet } from '../../../../qortal-ui-crypto/api/createWallet.js'
|
import { createWallet } from '../../../../qortal-ui-crypto/api/createWallet.js'
|
||||||
import FileSaver from 'file-saver'
|
|
||||||
import { doLogin, doLogout, doSelectAddress } from '../../redux/app/app-actions.js'
|
import { doLogin, doLogout, doSelectAddress } from '../../redux/app/app-actions.js'
|
||||||
import { doStoreWallet } from '../../redux/user/user-actions.js'
|
import { doStoreWallet } from '../../redux/user/user-actions.js'
|
||||||
import { checkApiKey } from '../../apiKeyUtils.js'
|
import { checkApiKey } from '../../apiKeyUtils.js'
|
||||||
|
import FileSaver from 'file-saver'
|
||||||
|
import ripple from '../../functional-components/loading-ripple.js'
|
||||||
import snackbar from '../../functional-components/snackbar.js'
|
import snackbar from '../../functional-components/snackbar.js'
|
||||||
|
import '../../functional-components/random-sentence-generator.js'
|
||||||
import '@material/mwc-button'
|
import '@material/mwc-button'
|
||||||
import '@material/mwc-checkbox'
|
import '@material/mwc-checkbox'
|
||||||
import '@material/mwc-textfield'
|
import '@material/mwc-textfield'
|
||||||
@ -22,8 +24,6 @@ import '@polymer/paper-input/paper-input.js'
|
|||||||
import '@polymer/paper-tooltip/paper-tooltip.js'
|
import '@polymer/paper-tooltip/paper-tooltip.js'
|
||||||
import '@vaadin/text-field/vaadin-text-field.js'
|
import '@vaadin/text-field/vaadin-text-field.js'
|
||||||
import '@vaadin/password-field/vaadin-password-field.js'
|
import '@vaadin/password-field/vaadin-password-field.js'
|
||||||
import 'random-sentence-generator'
|
|
||||||
import ripple from '../../functional-components/loading-ripple.js'
|
|
||||||
|
|
||||||
let lastPassword = ''
|
let lastPassword = ''
|
||||||
|
|
||||||
@ -393,17 +393,17 @@ class CreateAccountSection extends connect(store)(LitElement) {
|
|||||||
</random-sentence-generator>
|
</random-sentence-generator>
|
||||||
</div>
|
</div>
|
||||||
<!--
|
<!--
|
||||||
--- --- --- --- --- --- --- --- --- --- --- -
|
--- --- --- --- --- --- --- --- --- --- --- --- --- -
|
||||||
Calculations
|
Calculations
|
||||||
--- --- --- --- --- --- --- --- --- --- --- -
|
--- --- --- --- --- --- --- --- --- --- --- --- --- -
|
||||||
403 adjectives
|
403 adjectives
|
||||||
60 interjections
|
60 interjections
|
||||||
243 adverbs
|
243 adverbs
|
||||||
2353 nouns
|
2353 nouns
|
||||||
3387 verbs
|
3387 verbs
|
||||||
--- --- --- --- --- --- --- --- --- --- --- -
|
--- --- --- --- --- --- --- --- --- --- --- --- --- -
|
||||||
sooo 243*3387*403*2353*3387*403*2353*403*2353 ~ 2^92
|
sooo 243*3387*403*2353*3387*403*2353*403*2353 ~ 2^92
|
||||||
--- --- --- --- --- --- --- --- --- --- --- -
|
--- --- --- --- --- --- --- --- --- --- --- --- --- -
|
||||||
-->
|
-->
|
||||||
</div><br>
|
</div><br>
|
||||||
<div class="horizontal-center">
|
<div class="horizontal-center">
|
||||||
|
@ -14,8 +14,15 @@ import './login-section.js'
|
|||||||
import '../qort-theme-toggle.js'
|
import '../qort-theme-toggle.js'
|
||||||
|
|
||||||
import settings from '../../functional-components/settings-page.js'
|
import settings from '../../functional-components/settings-page.js'
|
||||||
|
import { addAutoLoadImageChat, removeAutoLoadImageChat, addChatLastSeen } from '../../redux/app/app-actions.js'
|
||||||
|
|
||||||
window.reduxStore = store
|
window.reduxStore = store
|
||||||
|
window.reduxAction = {
|
||||||
|
addAutoLoadImageChat: addAutoLoadImageChat,
|
||||||
|
removeAutoLoadImageChat: removeAutoLoadImageChat,
|
||||||
|
addChatLastSeen: addChatLastSeen
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
const animationDuration = 0.7 // Seconds
|
const animationDuration = 0.7 // Seconds
|
||||||
|
|
||||||
|
@ -1171,7 +1171,7 @@ class UserInfoView extends connect(store)(LitElement) {
|
|||||||
</div>
|
</div>
|
||||||
</paper-dialog>
|
</paper-dialog>
|
||||||
|
|
||||||
<paper-dialog style="background: var(--white); border: 1px solid var(--black); border-radius: 5px;" id="userBoughtDialog" modal>
|
<paper-dialog style="background: var(--white); border: 1px solid var(--black); border-radius: 5px;" id="userBoughtDialog">
|
||||||
<div class="card-explorer-container">
|
<div class="card-explorer-container">
|
||||||
<div id="first-explorer-section">
|
<div id="first-explorer-section">
|
||||||
${this.boughtBTCTemplate()}
|
${this.boughtBTCTemplate()}
|
||||||
@ -1191,7 +1191,7 @@ class UserInfoView extends connect(store)(LitElement) {
|
|||||||
</div>
|
</div>
|
||||||
</paper-dialog>
|
</paper-dialog>
|
||||||
|
|
||||||
<paper-dialog style="background: var(--white); border: 1px solid var(--black); border-radius: 5px; overflow: auto;" id="userSoldDialog" modal>
|
<paper-dialog style="background: var(--white); border: 1px solid var(--black); border-radius: 5px; overflow: auto;" id="userSoldDialog">
|
||||||
<div class="card-explorer-container">
|
<div class="card-explorer-container">
|
||||||
<div id="first-explorer-section">
|
<div id="first-explorer-section">
|
||||||
${this.soldBTCTemplate()}
|
${this.soldBTCTemplate()}
|
||||||
|
@ -0,0 +1,160 @@
|
|||||||
|
// Author: irontiga <irontiga@gmail.com>
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
import { LitElement, html, css } from 'lit'
|
||||||
|
import * as WORDLISTS from './wordlists.js'
|
||||||
|
|
||||||
|
class RandomSentenceGenerator extends LitElement {
|
||||||
|
static get properties() {
|
||||||
|
return {
|
||||||
|
template: {
|
||||||
|
type: String,
|
||||||
|
attribute: 'template'
|
||||||
|
},
|
||||||
|
parsedString: {
|
||||||
|
type: String
|
||||||
|
},
|
||||||
|
fetchedWordlistCount: {
|
||||||
|
type: Number,
|
||||||
|
value: 0
|
||||||
|
},
|
||||||
|
capitalize: {
|
||||||
|
type: Boolean
|
||||||
|
},
|
||||||
|
partsOfSpeechMap: {
|
||||||
|
type: Object
|
||||||
|
},
|
||||||
|
templateEntropy: {
|
||||||
|
type: Number,
|
||||||
|
reflect: true,
|
||||||
|
attribute: 'template-entropy'
|
||||||
|
},
|
||||||
|
maxWordLength: {
|
||||||
|
type: Number,
|
||||||
|
attribute: 'max-word-length'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super()
|
||||||
|
this.template = 'adjective noun verb adverb.'
|
||||||
|
this.maxWordLength = 0
|
||||||
|
this.parsedString = ''
|
||||||
|
this.fetchedWordlistCount = 0
|
||||||
|
this.capitalize = true
|
||||||
|
this.partsOfSpeechMap = {
|
||||||
|
'noun': 'nouns',
|
||||||
|
'adverb': 'adverbs',
|
||||||
|
'adv': 'adverbs',
|
||||||
|
'verb': 'verbs',
|
||||||
|
'interjection': 'interjections',
|
||||||
|
'adjective': 'adjectives',
|
||||||
|
'adj': 'adjectives',
|
||||||
|
'verbed': 'verbed'
|
||||||
|
}
|
||||||
|
this.partsOfSpeech = Object.keys(this.partsOfSpeechMap)
|
||||||
|
this._wordlists = WORDLISTS
|
||||||
|
}
|
||||||
|
|
||||||
|
updated(changedProperties) {
|
||||||
|
let regen = false
|
||||||
|
if (changedProperties.has('template')) {
|
||||||
|
regen = true
|
||||||
|
}
|
||||||
|
if (changedProperties.has('maxWordLength')) {
|
||||||
|
console.dir(this.maxWordLength)
|
||||||
|
if (this.maxWordLength) {
|
||||||
|
const wl = { ...this._wordlists }
|
||||||
|
for (const partOfSpeech in this._wordlists) {
|
||||||
|
console.log(this._wordlists[partOfSpeech])
|
||||||
|
if (Array.isArray(this._wordlists[partOfSpeech])) {
|
||||||
|
wl[partOfSpeech] = this._wordlists[partOfSpeech].filter(word => word.length <= this.maxWordLength)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this._wordlists = wl
|
||||||
|
}
|
||||||
|
regen = true
|
||||||
|
}
|
||||||
|
if (regen) this.generate()
|
||||||
|
}
|
||||||
|
|
||||||
|
_RNG(entropy) {
|
||||||
|
if (entropy > 1074) {
|
||||||
|
throw new Error('Javascript can not handle that much entropy!')
|
||||||
|
}
|
||||||
|
let randNum = 0
|
||||||
|
const crypto = window.crypto || window.msCrypto
|
||||||
|
|
||||||
|
if (crypto) {
|
||||||
|
const entropy256 = Math.ceil(entropy / 8)
|
||||||
|
|
||||||
|
let buffer = new Uint8Array(entropy256)
|
||||||
|
crypto.getRandomValues(buffer)
|
||||||
|
|
||||||
|
randNum = buffer.reduce((num, value) => {
|
||||||
|
return num * value
|
||||||
|
}, 1) / Math.pow(256, entropy256)
|
||||||
|
} else {
|
||||||
|
console.warn('Secure RNG not found. Using Math.random')
|
||||||
|
randNum = Math.random()
|
||||||
|
}
|
||||||
|
return randNum
|
||||||
|
}
|
||||||
|
|
||||||
|
setRNG(fn) {
|
||||||
|
this._RNG = fn
|
||||||
|
}
|
||||||
|
|
||||||
|
_captitalize(str) {
|
||||||
|
return str.charAt(0).toUpperCase() + str.slice(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
getWord(partOfSpeech) {
|
||||||
|
const words = this._wordlists[this.partsOfSpeechMap[partOfSpeech]]
|
||||||
|
const requiredEntropy = Math.log(words.length) / Math.log(2)
|
||||||
|
const index = this._RNG(requiredEntropy) * words.length
|
||||||
|
|
||||||
|
return {
|
||||||
|
word: words[Math.round(index)],
|
||||||
|
entropy: words.length
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
generate() {
|
||||||
|
this.parsedString = this.parse(this.template)
|
||||||
|
}
|
||||||
|
|
||||||
|
parse(template) {
|
||||||
|
const split = template.split(/[\s]/g)
|
||||||
|
let entropy = 1
|
||||||
|
const final = split.map(word => {
|
||||||
|
const lower = word.toLowerCase()
|
||||||
|
|
||||||
|
this.partsOfSpeech.some(partOfSpeech => {
|
||||||
|
const partOfSpeechIndex = lower.indexOf(partOfSpeech) // Check it exists
|
||||||
|
const nextChar = word.charAt(partOfSpeech.length)
|
||||||
|
|
||||||
|
if (partOfSpeechIndex === 0 && !(nextChar && (nextChar.match(/[a-zA-Z]/g) != null))) {
|
||||||
|
const replacement = this.getWord(partOfSpeech)
|
||||||
|
word = replacement.word + word.slice(partOfSpeech.length) // Append the rest of the "word" (punctuation)
|
||||||
|
entropy = entropy * replacement.entropy
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return word
|
||||||
|
})
|
||||||
|
this.templateEntropy = Math.floor(Math.log(entropy) / Math.log(8))
|
||||||
|
return final.join(' ')
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return html`
|
||||||
|
${this.parsedString}
|
||||||
|
`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
customElements.define('random-sentence-generator', RandomSentenceGenerator)
|
||||||
|
|
||||||
|
export default RandomSentenceGenerator
|
36
qortal-ui-core/src/functional-components/verb-past-tense.js
Normal file
36
qortal-ui-core/src/functional-components/verb-past-tense.js
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
// Sourced from https://gist.github.com/letsgetrandy/1e05a68ea74ba6736eb5
|
||||||
|
|
||||||
|
export const EXCEPTIONS = {
|
||||||
|
'are': 'were',
|
||||||
|
'eat': 'ate',
|
||||||
|
'go': 'went',
|
||||||
|
'have': 'had',
|
||||||
|
'inherit': 'inherited',
|
||||||
|
'is': 'was',
|
||||||
|
'run': 'ran',
|
||||||
|
'sit': 'sat',
|
||||||
|
'visit': 'visited'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getPastTense = (verb, exceptions = EXCEPTIONS) => {
|
||||||
|
if (exceptions[verb]) {
|
||||||
|
return exceptions[verb]
|
||||||
|
}
|
||||||
|
if ((/e$/i).test(verb)) {
|
||||||
|
return verb + 'd'
|
||||||
|
}
|
||||||
|
if ((/[aeiou]c$/i).test(verb)) {
|
||||||
|
return verb + 'ked'
|
||||||
|
}
|
||||||
|
// for american english only
|
||||||
|
if ((/el$/i).test(verb)) {
|
||||||
|
return verb + 'ed'
|
||||||
|
}
|
||||||
|
if ((/[aeio][aeiou][dlmnprst]$/).test(verb)) {
|
||||||
|
return verb + 'ed'
|
||||||
|
}
|
||||||
|
if ((/[aeiou][bdglmnprst]$/i).test(verb)) {
|
||||||
|
return verb.replace(/(.+[aeiou])([bdglmnprst])/, '$1$2$2ed')
|
||||||
|
}
|
||||||
|
return verb + 'ed'
|
||||||
|
}
|
27
qortal-ui-core/src/functional-components/wordlists.js
Normal file
27
qortal-ui-core/src/functional-components/wordlists.js
Normal file
File diff suppressed because one or more lines are too long
@ -2,7 +2,6 @@ import { store } from '../../store.js'
|
|||||||
import { doPageUrl } from '../../redux/app/app-actions.js'
|
import { doPageUrl } from '../../redux/app/app-actions.js'
|
||||||
|
|
||||||
export const newMessage = (data) => {
|
export const newMessage = (data) => {
|
||||||
|
|
||||||
const alert = playSound(data.sound)
|
const alert = playSound(data.sound)
|
||||||
|
|
||||||
// Should I show notification ?
|
// Should I show notification ?
|
||||||
@ -18,7 +17,7 @@ export const newMessage = (data) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
notify.onclick = (e) => {
|
notify.onclick = (e) => {
|
||||||
const pageUrl = `/app/q-chat/${data.req.url}`
|
const pageUrl = `/app/q-chat/?chat=${data.req.url}`
|
||||||
store.dispatch(doPageUrl(pageUrl))
|
store.dispatch(doPageUrl(pageUrl))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -26,7 +25,7 @@ export const newMessage = (data) => {
|
|||||||
const notify = new Notification(data.title, data.options)
|
const notify = new Notification(data.title, data.options)
|
||||||
|
|
||||||
notify.onclick = (e) => {
|
notify.onclick = (e) => {
|
||||||
const pageUrl = `/app/q-chat/${data.req.url}`
|
const pageUrl = `/app/q-chat/?chat=${data.req.url}`
|
||||||
store.dispatch(doPageUrl(pageUrl))
|
store.dispatch(doPageUrl(pageUrl))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ const CHAT_HEADS_STREAM_NAME = 'chat_heads'
|
|||||||
const NODE_CONFIG_STREAM_NAME = 'node_config'
|
const NODE_CONFIG_STREAM_NAME = 'node_config'
|
||||||
const COPY_MENU_SWITCH = 'copy_menu_switch'
|
const COPY_MENU_SWITCH = 'copy_menu_switch'
|
||||||
const FRAME_PASTE_MENU_SWITCH = 'frame_paste_menu_switch'
|
const FRAME_PASTE_MENU_SWITCH = 'frame_paste_menu_switch'
|
||||||
|
const CHAT_LAST_SEEN = 'chat_last_seen'
|
||||||
|
|
||||||
export const loggedInStream = new EpmlStream(LOGIN_STREAM_NAME, () => store.getState().app.loggedIn)
|
export const loggedInStream = new EpmlStream(LOGIN_STREAM_NAME, () => store.getState().app.loggedIn)
|
||||||
export const configStream = new EpmlStream(CONFIG_STREAM_NAME, () => store.getState().config)
|
export const configStream = new EpmlStream(CONFIG_STREAM_NAME, () => store.getState().config)
|
||||||
@ -18,6 +19,7 @@ export const chatHeadsStateStream = new EpmlStream(CHAT_HEADS_STREAM_NAME, () =>
|
|||||||
export const nodeConfigStream = new EpmlStream(NODE_CONFIG_STREAM_NAME, () => store.getState().app.nodeConfig)
|
export const nodeConfigStream = new EpmlStream(NODE_CONFIG_STREAM_NAME, () => store.getState().app.nodeConfig)
|
||||||
export const copyMenuSwitchStream = new EpmlStream(COPY_MENU_SWITCH, () => store.getState().app.copyMenuSwitch)
|
export const copyMenuSwitchStream = new EpmlStream(COPY_MENU_SWITCH, () => store.getState().app.copyMenuSwitch)
|
||||||
export const framePasteMenuSwitchStream = new EpmlStream(FRAME_PASTE_MENU_SWITCH, () => store.getState().app.framePasteMenuSwitch)
|
export const framePasteMenuSwitchStream = new EpmlStream(FRAME_PASTE_MENU_SWITCH, () => store.getState().app.framePasteMenuSwitch)
|
||||||
|
export const chatLastSeenStream = new EpmlStream(CHAT_LAST_SEEN, () => store.getState().app.chatLastSeen)
|
||||||
|
|
||||||
|
|
||||||
let oldState = {
|
let oldState = {
|
||||||
@ -46,6 +48,9 @@ store.subscribe(() => {
|
|||||||
if (oldState.app.framePasteMenuSwitch !== state.app.framePasteMenuSwitch) {
|
if (oldState.app.framePasteMenuSwitch !== state.app.framePasteMenuSwitch) {
|
||||||
framePasteMenuSwitchStream.emit(state.app.framePasteMenuSwitch)
|
framePasteMenuSwitchStream.emit(state.app.framePasteMenuSwitch)
|
||||||
}
|
}
|
||||||
|
if (oldState.app.chatLastSeen !== state.app.chatLastSeen) {
|
||||||
|
chatLastSeenStream.emit(state.app.chatLastSeen)
|
||||||
|
}
|
||||||
|
|
||||||
if (oldState.app.selectedAddress !== state.app.selectedAddress) {
|
if (oldState.app.selectedAddress !== state.app.selectedAddress) {
|
||||||
selectedAddressStream.emit({
|
selectedAddressStream.emit({
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Core App Actions here...
|
// Core App Actions here...
|
||||||
import { UPDATE_BLOCK_INFO, UPDATE_NODE_STATUS, UPDATE_NODE_INFO, CHAT_HEADS, ACCOUNT_INFO, COPY_MENU_SWITCH, PASTE_MENU_SWITCH, FRAME_PASTE_MENU_SWITCH } from '../app-action-types.js'
|
import { UPDATE_BLOCK_INFO, UPDATE_NODE_STATUS, UPDATE_NODE_INFO, CHAT_HEADS, ACCOUNT_INFO, COPY_MENU_SWITCH, PASTE_MENU_SWITCH, FRAME_PASTE_MENU_SWITCH, ADD_AUTO_LOAD_IMAGES_CHAT, REMOVE_AUTO_LOAD_IMAGES_CHAT, SET_CHAT_LAST_SEEN, ADD_CHAT_LAST_SEEN } from '../app-action-types.js'
|
||||||
|
|
||||||
export const doUpdateBlockInfo = (blockObj) => {
|
export const doUpdateBlockInfo = (blockObj) => {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
@ -105,3 +105,31 @@ const framePasteMenuSwitch = (payload) => {
|
|||||||
payload
|
payload
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const addAutoLoadImageChat = (payload) => {
|
||||||
|
return {
|
||||||
|
type: ADD_AUTO_LOAD_IMAGES_CHAT,
|
||||||
|
payload
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const removeAutoLoadImageChat = (payload) => {
|
||||||
|
return {
|
||||||
|
type: REMOVE_AUTO_LOAD_IMAGES_CHAT,
|
||||||
|
payload
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const setChatLastSeen = (payload) => {
|
||||||
|
return {
|
||||||
|
type: SET_CHAT_LAST_SEEN,
|
||||||
|
payload
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export const addChatLastSeen = (payload) => {
|
||||||
|
return {
|
||||||
|
type: ADD_CHAT_LAST_SEEN,
|
||||||
|
payload
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -20,3 +20,7 @@ export const ADD_NEW_PLUGIN_URL = 'ADD_NEW_PLUGIN_URL'
|
|||||||
export const COPY_MENU_SWITCH = 'COPY_MENU_SWITCH'
|
export const COPY_MENU_SWITCH = 'COPY_MENU_SWITCH'
|
||||||
export const PASTE_MENU_SWITCH = 'PASTE_MENU_SWITCH'
|
export const PASTE_MENU_SWITCH = 'PASTE_MENU_SWITCH'
|
||||||
export const FRAME_PASTE_MENU_SWITCH = 'FRAME_PASTE_MENU_SWITCH'
|
export const FRAME_PASTE_MENU_SWITCH = 'FRAME_PASTE_MENU_SWITCH'
|
||||||
|
export const ADD_AUTO_LOAD_IMAGES_CHAT = 'ADD_AUTO_LOAD_IMAGES_CHAT'
|
||||||
|
export const REMOVE_AUTO_LOAD_IMAGES_CHAT = 'REMOVE_AUTO_LOAD_IMAGES_CHAT'
|
||||||
|
export const SET_CHAT_LAST_SEEN = 'SET_CHAT_LAST_SEEN'
|
||||||
|
export const ADD_CHAT_LAST_SEEN = 'ADD_CHAT_LAST_SEEN'
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
// Loading state, login state, isNavDrawOpen state etc. None of this needs to be saved to localstorage.
|
// Loading state, login state, isNavDrawOpen state etc. None of this needs to be saved to localstorage.
|
||||||
import { LOG_IN, LOG_OUT, NETWORK_CONNECTION_STATUS, INIT_WORKERS, ADD_PLUGIN_URL, ADD_PLUGIN, ADD_NEW_PLUGIN_URL, NAVIGATE, SELECT_ADDRESS, ACCOUNT_INFO, CHAT_HEADS, UPDATE_BLOCK_INFO, UPDATE_NODE_STATUS, UPDATE_NODE_INFO, LOAD_NODE_CONFIG, SET_NODE, ADD_NODE, PAGE_URL, COPY_MENU_SWITCH, PASTE_MENU_SWITCH, FRAME_PASTE_MENU_SWITCH } from './app-action-types.js'
|
import { loadStateFromLocalStorage, saveStateToLocalStorage } from '../../localStorageHelpers.js'
|
||||||
|
import { LOG_IN, LOG_OUT, NETWORK_CONNECTION_STATUS, INIT_WORKERS, ADD_PLUGIN_URL, ADD_PLUGIN, ADD_NEW_PLUGIN_URL, NAVIGATE, SELECT_ADDRESS, ACCOUNT_INFO, CHAT_HEADS, UPDATE_BLOCK_INFO, UPDATE_NODE_STATUS, UPDATE_NODE_INFO, LOAD_NODE_CONFIG, SET_NODE, ADD_NODE, PAGE_URL, COPY_MENU_SWITCH, PASTE_MENU_SWITCH, FRAME_PASTE_MENU_SWITCH, ADD_AUTO_LOAD_IMAGES_CHAT, REMOVE_AUTO_LOAD_IMAGES_CHAT, SET_CHAT_LAST_SEEN, ADD_CHAT_LAST_SEEN } from './app-action-types.js'
|
||||||
import { initWorkersReducer } from './reducers/init-workers.js'
|
import { initWorkersReducer } from './reducers/init-workers.js'
|
||||||
import { loginReducer } from './reducers/login-reducer.js'
|
import { loginReducer } from './reducers/login-reducer.js'
|
||||||
import { setNode, addNode } from './reducers/manage-node.js'
|
import { setNode, addNode } from './reducers/manage-node.js'
|
||||||
|
import localForage from "localforage";
|
||||||
|
const chatLastSeen = localForage.createInstance({
|
||||||
|
name: "chat-last-seen",
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
const INITIAL_STATE = {
|
const INITIAL_STATE = {
|
||||||
loggedIn: false,
|
loggedIn: false,
|
||||||
@ -42,7 +48,9 @@ const INITIAL_STATE = {
|
|||||||
framePasteMenuSwitch: {
|
framePasteMenuSwitch: {
|
||||||
isOpen: false,
|
isOpen: false,
|
||||||
elementId: ''
|
elementId: ''
|
||||||
}
|
},
|
||||||
|
autoLoadImageChats: loadStateFromLocalStorage('autoLoadImageChats') || [],
|
||||||
|
chatLastSeen: []
|
||||||
}
|
}
|
||||||
|
|
||||||
export default (state = INITIAL_STATE, action) => {
|
export default (state = INITIAL_STATE, action) => {
|
||||||
@ -146,6 +154,60 @@ export default (state = INITIAL_STATE, action) => {
|
|||||||
...state,
|
...state,
|
||||||
framePasteMenuSwitch: action.payload
|
framePasteMenuSwitch: action.payload
|
||||||
}
|
}
|
||||||
|
case ADD_AUTO_LOAD_IMAGES_CHAT: {
|
||||||
|
const findChat = state.autoLoadImageChats.findIndex((chat)=> chat === action.payload)
|
||||||
|
console.log({findChat})
|
||||||
|
if(findChat !== -1) return state
|
||||||
|
const updatedState = [...state.autoLoadImageChats, action.payload]
|
||||||
|
|
||||||
|
saveStateToLocalStorage('autoLoadImageChats', updatedState)
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
autoLoadImageChats: updatedState
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
case REMOVE_AUTO_LOAD_IMAGES_CHAT: {
|
||||||
|
const updatedState = state.autoLoadImageChats.filter((chat)=> chat !== action.payload)
|
||||||
|
saveStateToLocalStorage('autoLoadImageChats', updatedState)
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
autoLoadImageChats: updatedState
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case SET_CHAT_LAST_SEEN: {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
chatLastSeen: action.payload
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case ADD_CHAT_LAST_SEEN: {
|
||||||
|
const chatId = action.payload.key
|
||||||
|
const timestamp = action.payload.timestamp
|
||||||
|
if(!chatId || !timestamp) return state
|
||||||
|
let newChatLastSeen = [...state.chatLastSeen]
|
||||||
|
const findChatIndex = state.chatLastSeen.findIndex((chat)=> chat.key === chatId)
|
||||||
|
if(findChatIndex !== -1){
|
||||||
|
|
||||||
|
newChatLastSeen[findChatIndex] = {
|
||||||
|
key: chatId,
|
||||||
|
timestamp,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(findChatIndex === -1){
|
||||||
|
|
||||||
|
newChatLastSeen = [...newChatLastSeen, {
|
||||||
|
key: chatId,
|
||||||
|
timestamp,
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
chatLastSeen.setItem(chatId, timestamp)
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
chatLastSeen: newChatLastSeen
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return state
|
return state
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,8 @@ html {
|
|||||||
--copybutton: #707584;
|
--copybutton: #707584;
|
||||||
--chat-group: #080808;
|
--chat-group: #080808;
|
||||||
--chat-bubble: #9f9f9f0a;
|
--chat-bubble: #9f9f9f0a;
|
||||||
--chat-bubble-bg: #f3f3f3;
|
--chat-bubble-bg: #e6e6e6;
|
||||||
|
--chat-bubble-myBg: #d1ddf2;
|
||||||
--chat-bubble-msg-color: #080808;
|
--chat-bubble-msg-color: #080808;
|
||||||
--reaction-bubble-outline: #6b6969;
|
--reaction-bubble-outline: #6b6969;
|
||||||
--chat-menu-bg: #ffffff;
|
--chat-menu-bg: #ffffff;
|
||||||
@ -48,6 +49,7 @@ html {
|
|||||||
--chatHeadTextActive: #080808;
|
--chatHeadTextActive: #080808;
|
||||||
--group-header: #929292;
|
--group-header: #929292;
|
||||||
--group-drop-shadow: rgb(17 17 26 / 10%) 0px 1px 0px;
|
--group-drop-shadow: rgb(17 17 26 / 10%) 0px 1px 0px;
|
||||||
|
--reactions-tooltip-bg: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
html[theme="dark"] {
|
html[theme="dark"] {
|
||||||
@ -62,6 +64,7 @@ html[theme="dark"] {
|
|||||||
--chat-group: #ffffff;
|
--chat-group: #ffffff;
|
||||||
--chat-bubble: #9694941a;
|
--chat-bubble: #9694941a;
|
||||||
--chat-bubble-bg: #2d3749;
|
--chat-bubble-bg: #2d3749;
|
||||||
|
--chat-bubble-myBg: #40444d;
|
||||||
--chat-bubble-msg-color: #ffffff;
|
--chat-bubble-msg-color: #ffffff;
|
||||||
--reaction-bubble-outline: #ffffff;
|
--reaction-bubble-outline: #ffffff;
|
||||||
--chat-menu-bg: #32394c;
|
--chat-menu-bg: #32394c;
|
||||||
@ -99,5 +102,6 @@ html[theme="dark"] {
|
|||||||
--chatHeadText: #ffffff;
|
--chatHeadText: #ffffff;
|
||||||
--chatHeadTextActive: #ffffff;
|
--chatHeadTextActive: #ffffff;
|
||||||
--group-header: #c8c8c8;
|
--group-header: #c8c8c8;
|
||||||
--group-drop-shadow: rgb(191 191 191 / 32%) 0px 1px 0px
|
--group-drop-shadow: rgb(191 191 191 / 32%) 0px 1px 0px;
|
||||||
|
--reactions-tooltip-bg: #161515;
|
||||||
}
|
}
|
@ -2,9 +2,8 @@ import { Sha256 } from 'asmcrypto.js'
|
|||||||
import Base58 from './api/deps/Base58'
|
import Base58 from './api/deps/Base58'
|
||||||
import { base58PublicKeyToAddress } from './api/wallet/base58PublicKeyToAddress'
|
import { base58PublicKeyToAddress } from './api/wallet/base58PublicKeyToAddress'
|
||||||
import { validateAddress } from './api/wallet/validateAddress'
|
import { validateAddress } from './api/wallet/validateAddress'
|
||||||
import { decryptChatMessage } from './api/transactions/chat/decryptChatMessage';
|
import { decryptChatMessage } from './api/transactions/chat/decryptChatMessage'
|
||||||
import _ from 'lodash';
|
import _ from 'lodash'
|
||||||
|
|
||||||
|
|
||||||
window.Sha256 = Sha256
|
window.Sha256 = Sha256
|
||||||
window.Base58 = Base58
|
window.Base58 = Base58
|
||||||
@ -14,7 +13,6 @@ window.validateAddress = validateAddress
|
|||||||
window.decryptChatMessage = decryptChatMessage
|
window.decryptChatMessage = decryptChatMessage
|
||||||
|
|
||||||
export { initApi, store } from './api_deps.js'
|
export { initApi, store } from './api_deps.js'
|
||||||
|
|
||||||
export * from './api/deps/deps.js'
|
export * from './api/deps/deps.js'
|
||||||
export * from './api/api.js'
|
export * from './api/api.js'
|
||||||
export * from './api/registerUsername.js'
|
export * from './api/registerUsername.js'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2017-2018 @ irontiga and vbcs (original developer)
|
Copyright 2017-2018 @ irontiga and vbcs (original developer)
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict'
|
||||||
import Base58 from './deps/Base58.js'
|
import Base58 from './deps/Base58.js'
|
||||||
import { Sha256, Sha512 } from 'asmcrypto.js'
|
import { Sha256, Sha512 } from 'asmcrypto.js'
|
||||||
import nacl from './deps/nacl-fast.js'
|
import nacl from './deps/nacl-fast.js'
|
||||||
@ -10,7 +10,7 @@ import utils from './deps/utils.js'
|
|||||||
import { generateSaveWalletData } from './storeWallet.js'
|
import { generateSaveWalletData } from './storeWallet.js'
|
||||||
|
|
||||||
import publicKeyToAddress from './wallet/publicKeyToAddress.js'
|
import publicKeyToAddress from './wallet/publicKeyToAddress.js'
|
||||||
import AltcoinHDWallet from "./bitcoin/AltcoinHDWallet";
|
import AltcoinHDWallet from "./bitcoin/AltcoinHDWallet"
|
||||||
|
|
||||||
export default class PhraseWallet {
|
export default class PhraseWallet {
|
||||||
constructor(seed, walletVersion) {
|
constructor(seed, walletVersion) {
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
export { request } from './fetch-request.js'
|
export { request } from './fetch-request.js'
|
||||||
|
|
||||||
export { transactionTypes as transactions } from './transactions/transactions.js'
|
export { transactionTypes as transactions } from './transactions/transactions.js'
|
||||||
|
|
||||||
export { processTransaction, createTransaction, computeChatNonce, signChatTransaction, signArbitraryTransaction } from './createTransaction.js'
|
export { processTransaction, createTransaction, computeChatNonce, signChatTransaction, signArbitraryTransaction } from './createTransaction.js'
|
||||||
|
|
||||||
export { tradeBotCreateRequest, tradeBotRespondRequest, signTradeBotTxn, deleteTradeOffer, sendBtc, sendLtc, sendDoge, sendDgb, sendRvn, sendArrr } from './tradeRequest.js'
|
export { tradeBotCreateRequest, tradeBotRespondRequest, signTradeBotTxn, deleteTradeOffer, sendBtc, sendLtc, sendDoge, sendDgb, sendRvn, sendArrr } from './tradeRequest.js'
|
||||||
|
|
||||||
export { cancelAllOffers } from './transactions/trade-portal/tradeoffer/cancelAllOffers.js'
|
export { cancelAllOffers } from './transactions/trade-portal/tradeoffer/cancelAllOffers.js'
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import Base58 from '../deps/Base58.js'
|
import Base58 from '../deps/Base58.js'
|
||||||
import { Sha256, Sha512 } from 'asmcrypto.js'
|
import { Sha256, Sha512 } from 'asmcrypto.js'
|
||||||
import jsSHA from "jssha";
|
import jsSHA from 'jssha'
|
||||||
import RIPEMD160 from '../deps/ripemd160.js'
|
import RIPEMD160 from '../deps/ripemd160.js'
|
||||||
import utils from '../deps/utils.js'
|
import utils from '../deps/utils.js'
|
||||||
import { EllipticCurve, BigInteger } from './ecbn.js';
|
import { EllipticCurve, BigInteger } from './ecbn.js'
|
||||||
|
|
||||||
|
|
||||||
export default class AltcoinHDWallet {
|
export default class AltcoinHDWallet {
|
||||||
|
|
||||||
@ -101,14 +100,10 @@ export default class AltcoinHDWallet {
|
|||||||
|
|
||||||
this._tmasterPublicKey = ''
|
this._tmasterPublicKey = ''
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Child Keys Derivation from the Parent Keys
|
* Child Keys Derivation from the Parent Keys
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Child Private Key - 32 bytes
|
* Child Private Key - 32 bytes
|
||||||
*/
|
*/
|
||||||
@ -145,13 +140,10 @@ export default class AltcoinHDWallet {
|
|||||||
|
|
||||||
this.xPublicChildKey = ''
|
this.xPublicChildKey = ''
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Grand Child Keys Derivation from the Child Keys
|
* Grand Child Keys Derivation from the Child Keys
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Grand Child Private Key - 32 bytes
|
* Grand Child Private Key - 32 bytes
|
||||||
*/
|
*/
|
||||||
@ -200,7 +192,6 @@ export default class AltcoinHDWallet {
|
|||||||
|
|
||||||
this._tlitecoinLegacyAddress = ''
|
this._tlitecoinLegacyAddress = ''
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wallet - Wallet Object (keys...)
|
* Wallet - Wallet Object (keys...)
|
||||||
*/
|
*/
|
||||||
@ -250,76 +241,69 @@ export default class AltcoinHDWallet {
|
|||||||
|
|
||||||
|
|
||||||
generateSeedHash(seed, isBIP44, indicator = null) {
|
generateSeedHash(seed, isBIP44, indicator = null) {
|
||||||
|
let buffer
|
||||||
let buffer;
|
|
||||||
|
|
||||||
if (isBIP44) {
|
if (isBIP44) {
|
||||||
buffer = utils.appendBuffer(seed.reverse(), utils.int32ToBytes(indicator))
|
buffer = utils.appendBuffer(seed.reverse(), utils.int32ToBytes(indicator))
|
||||||
} else {
|
} else {
|
||||||
if(indicator !== null) {
|
if(indicator !== null) {
|
||||||
const indicatorString = utils.stringtoUTF8Array(indicator);
|
const indicatorString = utils.stringtoUTF8Array(indicator)
|
||||||
buffer = utils.appendBuffer(seed.reverse(), indicatorString);
|
buffer = utils.appendBuffer(seed.reverse(), indicatorString)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buffer = seed.reverse();
|
buffer = seed.reverse()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const _reverseSeedHash = new Sha256().process(buffer).finish().result;
|
const _reverseSeedHash = new Sha256().process(buffer).finish().result
|
||||||
this.seedHash = new Sha512().process(utils.appendBuffer(seed, _reverseSeedHash)).finish().result;
|
this.seedHash = new Sha512().process(utils.appendBuffer(seed, _reverseSeedHash)).finish().result
|
||||||
}
|
}
|
||||||
|
|
||||||
generatePrivateKey(seedHash) {
|
generatePrivateKey(seedHash) {
|
||||||
|
const SECP256K1_CURVE_ORDER = new BigInteger("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141")
|
||||||
|
|
||||||
const SECP256K1_CURVE_ORDER = new BigInteger("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141");
|
const privateKeyHash = seedHash.slice(0, 32)
|
||||||
|
|
||||||
const privateKeyHash = seedHash.slice(0, 32);
|
this.seed58 = Base58.encode(privateKeyHash)
|
||||||
|
|
||||||
this.seed58 = Base58.encode(privateKeyHash);
|
|
||||||
|
|
||||||
const _privateKeyHash = [...privateKeyHash]
|
const _privateKeyHash = [...privateKeyHash]
|
||||||
let privateKeyBigInt = BigInteger.fromByteArrayUnsigned(_privateKeyHash);
|
let privateKeyBigInt = BigInteger.fromByteArrayUnsigned(_privateKeyHash)
|
||||||
|
|
||||||
const privateKey = (privateKeyBigInt.mod(SECP256K1_CURVE_ORDER.subtract(BigInteger.ONE))).add(BigInteger.ONE)
|
const privateKey = (privateKeyBigInt.mod(SECP256K1_CURVE_ORDER.subtract(BigInteger.ONE))).add(BigInteger.ONE)
|
||||||
this.privateKey = privateKey.toByteArrayUnsigned()
|
this.privateKey = privateKey.toByteArrayUnsigned()
|
||||||
}
|
}
|
||||||
|
|
||||||
generateChainCode(seedHash) {
|
generateChainCode(seedHash) {
|
||||||
|
this.chainCode = new Sha256().process(seedHash.slice(32, 64)).finish().result
|
||||||
this.chainCode = new Sha256().process(seedHash.slice(32, 64)).finish().result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
generatePublicKey(privateKey) {
|
generatePublicKey(privateKey) {
|
||||||
|
|
||||||
const _privateKey = [...privateKey]
|
const _privateKey = [...privateKey]
|
||||||
const privateKeyBigInt = BigInteger.fromByteArrayUnsigned(_privateKey);
|
const privateKeyBigInt = BigInteger.fromByteArrayUnsigned(_privateKey)
|
||||||
|
|
||||||
const epCurve = EllipticCurve.getSECCurveByName("secp256k1");
|
const epCurve = EllipticCurve.getSECCurveByName("secp256k1")
|
||||||
const curvePoints = epCurve.getG().multiply(privateKeyBigInt);
|
const curvePoints = epCurve.getG().multiply(privateKeyBigInt)
|
||||||
|
|
||||||
|
|
||||||
const x = curvePoints.getX().toBigInteger();
|
const x = curvePoints.getX().toBigInteger()
|
||||||
const y = curvePoints.getY().toBigInteger();
|
const y = curvePoints.getY().toBigInteger()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deriving Uncompressed Public Key (65 bytes)
|
* Deriving Uncompressed Public Key (65 bytes)
|
||||||
*
|
*
|
||||||
* const publicKeyBytes = EllipticCurve.integerToBytes(x, 32);
|
* const publicKeyBytes = EllipticCurve.integerToBytes(x, 32)
|
||||||
* this.publicKey = publicKeyBytes.concat(EllipticCurve.integerToBytes(y, 32));
|
* this.publicKey = publicKeyBytes.concat(EllipticCurve.integerToBytes(y, 32))
|
||||||
* this.publicKey.unshift(0x04); // append point indicator
|
* this.publicKey.unshift(0x04) // append point indicator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// Compressed Public Key (33 bytes)
|
// Compressed Public Key (33 bytes)
|
||||||
this.publicKey = EllipticCurve.integerToBytes(x, 32)
|
this.publicKey = EllipticCurve.integerToBytes(x, 32)
|
||||||
|
|
||||||
|
|
||||||
if (y.isEven()) {
|
if (y.isEven()) {
|
||||||
|
|
||||||
this.publicKey.unshift(0x02) // append point indicator
|
this.publicKey.unshift(0x02) // append point indicator
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.publicKey.unshift(0x03) // append point indicator
|
this.publicKey.unshift(0x03) // append point indicator
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,7 +314,6 @@ export default class AltcoinHDWallet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
generateMainnetMasterPrivateKey() {
|
generateMainnetMasterPrivateKey() {
|
||||||
|
|
||||||
// Serialization Variable
|
// Serialization Variable
|
||||||
const s = []
|
const s = []
|
||||||
|
|
||||||
@ -375,7 +358,6 @@ export default class AltcoinHDWallet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
generateMainnetMasterPublicKey() {
|
generateMainnetMasterPublicKey() {
|
||||||
|
|
||||||
// Serialization Variable
|
// Serialization Variable
|
||||||
const s = []
|
const s = []
|
||||||
|
|
||||||
@ -495,19 +477,19 @@ export default class AltcoinHDWallet {
|
|||||||
// TODO: Make this more better in the future
|
// TODO: Make this more better in the future
|
||||||
|
|
||||||
const path = 'm/0/0'
|
const path = 'm/0/0'
|
||||||
// let p = path.split('/');
|
// let p = path.split('/')
|
||||||
|
|
||||||
// Get Public kEY
|
// Get Public kEY
|
||||||
const derivePublicChildKey = () => {
|
const derivePublicChildKey = () => {
|
||||||
|
|
||||||
const _privateKey = [...this.childPrivateKey]
|
const _privateKey = [...this.childPrivateKey]
|
||||||
const privateKeyBigInt = BigInteger.fromByteArrayUnsigned(_privateKey);
|
const privateKeyBigInt = BigInteger.fromByteArrayUnsigned(_privateKey)
|
||||||
|
|
||||||
const epCurve = EllipticCurve.getSECCurveByName("secp256k1");
|
const epCurve = EllipticCurve.getSECCurveByName("secp256k1")
|
||||||
const curvePoints = epCurve.getG().multiply(privateKeyBigInt);
|
const curvePoints = epCurve.getG().multiply(privateKeyBigInt)
|
||||||
|
|
||||||
const x = curvePoints.getX().toBigInteger();
|
const x = curvePoints.getX().toBigInteger()
|
||||||
const y = curvePoints.getY().toBigInteger();
|
const y = curvePoints.getY().toBigInteger()
|
||||||
|
|
||||||
// Compressed Public Key (33 bytes)
|
// Compressed Public Key (33 bytes)
|
||||||
this.childPublicKey = EllipticCurve.integerToBytes(x, 32)
|
this.childPublicKey = EllipticCurve.integerToBytes(x, 32)
|
||||||
@ -533,15 +515,15 @@ export default class AltcoinHDWallet {
|
|||||||
|
|
||||||
const derivePrivateChildKey = (cI) => {
|
const derivePrivateChildKey = (cI) => {
|
||||||
|
|
||||||
let ib = [];
|
let ib = []
|
||||||
ib.push((cI >> 24) & 0xff);
|
ib.push((cI >> 24) & 0xff)
|
||||||
ib.push((cI >> 16) & 0xff);
|
ib.push((cI >> 16) & 0xff)
|
||||||
ib.push((cI >> 8) & 0xff);
|
ib.push((cI >> 8) & 0xff)
|
||||||
ib.push(cI & 0xff);
|
ib.push(cI & 0xff)
|
||||||
|
|
||||||
const s = [...this.publicKey].concat(ib);
|
const s = [...this.publicKey].concat(ib)
|
||||||
|
|
||||||
const _hmacSha512 = new jsSHA("SHA-512", "UINT8ARRAY", { numRounds: 1, hmacKey: { value: this.chainCode, format: "UINT8ARRAY" } });
|
const _hmacSha512 = new jsSHA("SHA-512", "UINT8ARRAY", { numRounds: 1, hmacKey: { value: this.chainCode, format: "UINT8ARRAY" } })
|
||||||
_hmacSha512.update(new Uint8Array(s))
|
_hmacSha512.update(new Uint8Array(s))
|
||||||
|
|
||||||
|
|
||||||
@ -550,10 +532,10 @@ export default class AltcoinHDWallet {
|
|||||||
|
|
||||||
|
|
||||||
// SECP256k1 init
|
// SECP256k1 init
|
||||||
const epCurve = EllipticCurve.getSECCurveByName("secp256k1");
|
const epCurve = EllipticCurve.getSECCurveByName("secp256k1")
|
||||||
|
|
||||||
|
|
||||||
const ki = IL.add(BigInteger.fromByteArrayUnsigned(this.privateKey)).mod(epCurve.getN()); // parse256(IL) + kpar (mod n) ==> ki
|
const ki = IL.add(BigInteger.fromByteArrayUnsigned(this.privateKey)).mod(epCurve.getN()) // parse256(IL) + kpar (mod n) ==> ki
|
||||||
this.childPrivateKey = ki.toByteArrayUnsigned()
|
this.childPrivateKey = ki.toByteArrayUnsigned()
|
||||||
|
|
||||||
// Call deriveExtendedPrivateChildKey
|
// Call deriveExtendedPrivateChildKey
|
||||||
@ -577,10 +559,10 @@ export default class AltcoinHDWallet {
|
|||||||
s.push(...(this.publicKeyHash.slice(0, 4)))
|
s.push(...(this.publicKeyHash.slice(0, 4)))
|
||||||
|
|
||||||
// Append Child Index
|
// Append Child Index
|
||||||
s.push(childIndex >>> 24);
|
s.push(childIndex >>> 24)
|
||||||
s.push((childIndex >>> 16) & 0xff);
|
s.push((childIndex >>> 16) & 0xff)
|
||||||
s.push((childIndex >>> 8) & 0xff);
|
s.push((childIndex >>> 8) & 0xff)
|
||||||
s.push(childIndex & 0xff);
|
s.push(childIndex & 0xff)
|
||||||
|
|
||||||
// Append Chain Code
|
// Append Chain Code
|
||||||
s.push(...this.childChainCode)
|
s.push(...this.childChainCode)
|
||||||
@ -619,10 +601,10 @@ export default class AltcoinHDWallet {
|
|||||||
s.push(...(this.publicKeyHash.slice(0, 4)))
|
s.push(...(this.publicKeyHash.slice(0, 4)))
|
||||||
|
|
||||||
// Append Child Index
|
// Append Child Index
|
||||||
s.push(childIndex >>> 24);
|
s.push(childIndex >>> 24)
|
||||||
s.push((childIndex >>> 16) & 0xff);
|
s.push((childIndex >>> 16) & 0xff)
|
||||||
s.push((childIndex >>> 8) & 0xff);
|
s.push((childIndex >>> 8) & 0xff)
|
||||||
s.push(childIndex & 0xff);
|
s.push(childIndex & 0xff)
|
||||||
|
|
||||||
// Append Chain Code
|
// Append Chain Code
|
||||||
s.push(...this.childChainCode)
|
s.push(...this.childChainCode)
|
||||||
@ -654,24 +636,22 @@ export default class AltcoinHDWallet {
|
|||||||
const derivePublicGrandChildKey = () => {
|
const derivePublicGrandChildKey = () => {
|
||||||
|
|
||||||
const _privateKey = [...this.grandChildPrivateKey]
|
const _privateKey = [...this.grandChildPrivateKey]
|
||||||
const privateKeyBigInt = BigInteger.fromByteArrayUnsigned(_privateKey);
|
const privateKeyBigInt = BigInteger.fromByteArrayUnsigned(_privateKey)
|
||||||
|
|
||||||
|
|
||||||
const epCurve = EllipticCurve.getSECCurveByName("secp256k1");
|
const epCurve = EllipticCurve.getSECCurveByName("secp256k1")
|
||||||
const curvePoints = epCurve.getG().multiply(privateKeyBigInt);
|
const curvePoints = epCurve.getG().multiply(privateKeyBigInt)
|
||||||
|
|
||||||
const x = curvePoints.getX().toBigInteger();
|
const x = curvePoints.getX().toBigInteger()
|
||||||
const y = curvePoints.getY().toBigInteger();
|
const y = curvePoints.getY().toBigInteger()
|
||||||
|
|
||||||
// Compressed Public Key (33 bytes)
|
// Compressed Public Key (33 bytes)
|
||||||
this.grandChildPublicKey = EllipticCurve.integerToBytes(x, 32)
|
this.grandChildPublicKey = EllipticCurve.integerToBytes(x, 32)
|
||||||
|
|
||||||
|
|
||||||
if (y.isEven()) {
|
if (y.isEven()) {
|
||||||
|
|
||||||
this.grandChildPublicKey.unshift(0x02) // append point indicator
|
this.grandChildPublicKey.unshift(0x02) // append point indicator
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.grandChildPublicKey.unshift(0x03) // append point indicator
|
this.grandChildPublicKey.unshift(0x03) // append point indicator
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -729,16 +709,16 @@ export default class AltcoinHDWallet {
|
|||||||
|
|
||||||
const derivePrivateGrandChildKey = (cI, i) => {
|
const derivePrivateGrandChildKey = (cI, i) => {
|
||||||
|
|
||||||
let ib = [];
|
let ib = []
|
||||||
ib.push((cI >> 24) & 0xff);
|
ib.push((cI >> 24) & 0xff)
|
||||||
ib.push((cI >> 16) & 0xff);
|
ib.push((cI >> 16) & 0xff)
|
||||||
ib.push((cI >> 8) & 0xff);
|
ib.push((cI >> 8) & 0xff)
|
||||||
ib.push(cI & 0xff);
|
ib.push(cI & 0xff)
|
||||||
|
|
||||||
const s = [...this.childPublicKey].concat(ib);
|
const s = [...this.childPublicKey].concat(ib)
|
||||||
|
|
||||||
|
|
||||||
const _hmacSha512 = new jsSHA("SHA-512", "UINT8ARRAY", { numRounds: 1, hmacKey: { value: this.childChainCode, format: "UINT8ARRAY" } });
|
const _hmacSha512 = new jsSHA("SHA-512", "UINT8ARRAY", { numRounds: 1, hmacKey: { value: this.childChainCode, format: "UINT8ARRAY" } })
|
||||||
_hmacSha512.update(new Uint8Array(s))
|
_hmacSha512.update(new Uint8Array(s))
|
||||||
|
|
||||||
|
|
||||||
@ -746,10 +726,10 @@ export default class AltcoinHDWallet {
|
|||||||
this.grandChildChainCode = _hmacSha512.getHMAC('UINT8ARRAY').slice(32, 64) // IR according to the SPEC
|
this.grandChildChainCode = _hmacSha512.getHMAC('UINT8ARRAY').slice(32, 64) // IR according to the SPEC
|
||||||
|
|
||||||
// SECP256k1 init
|
// SECP256k1 init
|
||||||
const epCurve = EllipticCurve.getSECCurveByName("secp256k1");
|
const epCurve = EllipticCurve.getSECCurveByName("secp256k1")
|
||||||
|
|
||||||
|
|
||||||
const ki = IL.add(BigInteger.fromByteArrayUnsigned(this.childPrivateKey)).mod(epCurve.getN()); // parse256(IL) + kpar (mod n) ==> ki
|
const ki = IL.add(BigInteger.fromByteArrayUnsigned(this.childPrivateKey)).mod(epCurve.getN()) // parse256(IL) + kpar (mod n) ==> ki
|
||||||
this.grandChildPrivateKey = ki.toByteArrayUnsigned()
|
this.grandChildPrivateKey = ki.toByteArrayUnsigned()
|
||||||
|
|
||||||
|
|
||||||
@ -774,10 +754,10 @@ export default class AltcoinHDWallet {
|
|||||||
s.push(...(this.childPublicKeyHash.slice(0, 4)))
|
s.push(...(this.childPublicKeyHash.slice(0, 4)))
|
||||||
|
|
||||||
// Append Child Index
|
// Append Child Index
|
||||||
s.push(childIndex >>> 24);
|
s.push(childIndex >>> 24)
|
||||||
s.push((childIndex >>> 16) & 0xff);
|
s.push((childIndex >>> 16) & 0xff)
|
||||||
s.push((childIndex >>> 8) & 0xff);
|
s.push((childIndex >>> 8) & 0xff)
|
||||||
s.push(childIndex & 0xff);
|
s.push(childIndex & 0xff)
|
||||||
|
|
||||||
// Append Chain Code
|
// Append Chain Code
|
||||||
s.push(...this.grandChildChainCode)
|
s.push(...this.grandChildChainCode)
|
||||||
@ -816,10 +796,10 @@ export default class AltcoinHDWallet {
|
|||||||
s.push(...(this.childPublicKeyHash.slice(0, 4)))
|
s.push(...(this.childPublicKeyHash.slice(0, 4)))
|
||||||
|
|
||||||
// Append Child Index
|
// Append Child Index
|
||||||
s.push(childIndex >>> 24);
|
s.push(childIndex >>> 24)
|
||||||
s.push((childIndex >>> 16) & 0xff);
|
s.push((childIndex >>> 16) & 0xff)
|
||||||
s.push((childIndex >>> 8) & 0xff);
|
s.push((childIndex >>> 8) & 0xff)
|
||||||
s.push(childIndex & 0xff);
|
s.push(childIndex & 0xff)
|
||||||
|
|
||||||
// Append Chain Code
|
// Append Chain Code
|
||||||
s.push(...this.grandChildChainCode)
|
s.push(...this.grandChildChainCode)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"use strict";
|
'use strict'
|
||||||
|
|
||||||
// Qortal TX types
|
// Qortal TX types
|
||||||
const TX_TYPES = {
|
const TX_TYPES = {
|
||||||
@ -149,8 +149,6 @@ const ERROR_CODES = {
|
|||||||
1000: "Not yet released."
|
1000: "Not yet released."
|
||||||
}
|
}
|
||||||
|
|
||||||
const CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP = 0
|
|
||||||
|
|
||||||
// Qortal 8 decimals
|
// Qortal 8 decimals
|
||||||
const QORT_DECIMALS = 1e8
|
const QORT_DECIMALS = 1e8
|
||||||
|
|
||||||
@ -160,6 +158,9 @@ const ADDRESS_VERSION = 58
|
|||||||
// Proxy for api calls
|
// Proxy for api calls
|
||||||
const PROXY_URL = "/proxy/"
|
const PROXY_URL = "/proxy/"
|
||||||
|
|
||||||
|
// Chat reference timestamp
|
||||||
|
const CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP = 1674316800000
|
||||||
|
|
||||||
// Used as a salt for all qora addresses. Salts used for storing your private keys in local storage will be randomly generated
|
// Used as a salt for all qora addresses. Salts used for storing your private keys in local storage will be randomly generated
|
||||||
const STATIC_SALT = new Uint8Array([54, 190, 201, 206, 65, 29, 123, 129, 147, 231, 180, 166, 171, 45, 95, 165, 78, 200, 208, 194, 44, 207, 221, 146, 45, 238, 68, 68, 69, 102, 62, 6])
|
const STATIC_SALT = new Uint8Array([54, 190, 201, 206, 65, 29, 123, 129, 147, 231, 180, 166, 171, 45, 95, 165, 78, 200, 208, 194, 44, 207, 221, 146, 45, 238, 68, 68, 69, 102, 62, 6])
|
||||||
const BCRYPT_ROUNDS = 10 // Remember that the total work spent on key derivation is BCRYPT_ROUNDS * KDF_THREADS
|
const BCRYPT_ROUNDS = 10 // Remember that the total work spent on key derivation is BCRYPT_ROUNDS * KDF_THREADS
|
||||||
|
@ -8,21 +8,14 @@ const CHECK_LAST_REF_INTERVAL = 30 * 1000 // err 30 seconds
|
|||||||
|
|
||||||
const pendingAddresses = {}
|
const pendingAddresses = {}
|
||||||
|
|
||||||
// const config = store.getState().config
|
|
||||||
// const node = config.coin.node.api
|
|
||||||
// const baseUrl = node.url + node.tail
|
|
||||||
|
|
||||||
const checkLastRefs = () => {
|
const checkLastRefs = () => {
|
||||||
Object.entries(pendingAddresses).forEach(([address, fn]) => {
|
Object.entries(pendingAddresses).forEach(([address, fn]) => {
|
||||||
// console.log(fn, address)
|
|
||||||
request('addresses/lastreference/' + address).then(res => {
|
request('addresses/lastreference/' + address).then(res => {
|
||||||
if (res === 'false') return
|
if (res === 'false') return
|
||||||
fn(res)
|
fn(res)
|
||||||
delete pendingAddresses[address]
|
delete pendingAddresses[address]
|
||||||
clearInterval(lastRefInterval)
|
clearInterval(lastRefInterval)
|
||||||
})
|
})
|
||||||
// fetch(baseUrl + 'addresses/lastreference/' + address)
|
|
||||||
// .then(async res => res.text())
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,6 +34,6 @@ export const registerUsername = async ({ name, address, lastRef, keyPair }) => {
|
|||||||
value: address,
|
value: address,
|
||||||
lastReference: lastreference
|
lastReference: lastreference
|
||||||
})
|
})
|
||||||
processTransaction(txBytes).then(res => {})
|
processTransaction(txBytes).then(res => { })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { HmacSha512, AES_CBC } from 'asmcrypto.js'
|
import { HmacSha512, AES_CBC } from 'asmcrypto.js'
|
||||||
import { kdf } from './kdf.js'
|
import { kdf } from './kdf.js'
|
||||||
// import Base58 from '../qora/deps/Base58.js'
|
|
||||||
import Base58 from './deps/Base58.js'
|
import Base58 from './deps/Base58.js'
|
||||||
|
|
||||||
const getRandomValues = window.crypto ? window.crypto.getRandomValues.bind(window.crypto) : window.msCrypto.getRandomValues.bind(window.msCrypto)
|
const getRandomValues = window.crypto ? window.crypto.getRandomValues.bind(window.crypto) : window.msCrypto.getRandomValues.bind(window.msCrypto)
|
||||||
@ -10,15 +9,12 @@ export const generateSaveWalletData = async (wallet, password, kdfThreads, statu
|
|||||||
let iv = new Uint8Array(16)
|
let iv = new Uint8Array(16)
|
||||||
getRandomValues(iv)
|
getRandomValues(iv)
|
||||||
let salt = new Uint8Array(32)
|
let salt = new Uint8Array(32)
|
||||||
getRandomValues(salt) // Can actually use a salt this time, as we can store the salt with the wallet
|
getRandomValues(salt)
|
||||||
|
|
||||||
// const key = PBKDF2_HMAC_SHA512.bytes(utils.stringtoUTF8Array(password), salt, PBKDF2_ROUNDS, 64) // 512bit key to be split in two for mac/encryption
|
|
||||||
const key = await kdf(password, salt, statusUpdateFn)
|
const key = await kdf(password, salt, statusUpdateFn)
|
||||||
statusUpdateFn('Encrypting seed')
|
statusUpdateFn('Encrypting seed')
|
||||||
const encryptionKey = key.slice(0, 32)
|
const encryptionKey = key.slice(0, 32)
|
||||||
const macKey = key.slice(32, 63)
|
const macKey = key.slice(32, 63)
|
||||||
const encryptedSeed = AES_CBC.encrypt(wallet._byteSeed, encryptionKey, false, iv)
|
const encryptedSeed = AES_CBC.encrypt(wallet._byteSeed, encryptionKey, false, iv)
|
||||||
// const mac = HmacSha512.bytes(encryptedSeed, macKey)
|
|
||||||
statusUpdateFn('Generating mac')
|
statusUpdateFn('Generating mac')
|
||||||
const mac = new HmacSha512(macKey).process(encryptedSeed).finish().result
|
const mac = new HmacSha512(macKey).process(encryptedSeed).finish().result
|
||||||
return {
|
return {
|
||||||
|
@ -1,18 +1,14 @@
|
|||||||
// Trade Bot
|
// Trade Bot
|
||||||
import TradeBotCreateRequest from './transactions/trade-portal/tradebot/TradeBotCreateRequest.js';
|
import TradeBotCreateRequest from './transactions/trade-portal/tradebot/TradeBotCreateRequest.js'
|
||||||
import TradeBotRespondRequest from './transactions/trade-portal/tradebot/TradeBotRespondRequest.js';
|
import TradeBotRespondRequest from './transactions/trade-portal/tradebot/TradeBotRespondRequest.js'
|
||||||
import signTradeBotTransaction from './transactions/trade-portal/tradebot/signTradeBotTransaction.js'
|
import signTradeBotTransaction from './transactions/trade-portal/tradebot/signTradeBotTransaction.js'
|
||||||
|
import DeleteTradeOffer from './transactions/trade-portal/tradeoffer/DeleteTradeOffer.js'
|
||||||
// Trade Offer
|
|
||||||
import DeleteTradeOffer from './transactions/trade-portal/tradeoffer/DeleteTradeOffer.js';
|
|
||||||
|
|
||||||
import { request } from './fetch-request'
|
import { request } from './fetch-request'
|
||||||
|
|
||||||
|
|
||||||
// TradeBotCreateRequest
|
// TradeBotCreateRequest
|
||||||
export const tradeBotCreateRequest = (requestObject) => {
|
export const tradeBotCreateRequest = (requestObject) => {
|
||||||
const txn = new TradeBotCreateRequest().createTransaction(requestObject)
|
const txn = new TradeBotCreateRequest().createTransaction(requestObject)
|
||||||
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
|
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||||
|
|
||||||
return request(`/crosschain/tradebot/create?apiKey=${myNode.apiKey}`, {
|
return request(`/crosschain/tradebot/create?apiKey=${myNode.apiKey}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -27,7 +23,7 @@ export const tradeBotCreateRequest = (requestObject) => {
|
|||||||
// TradeBotRespondRequest
|
// TradeBotRespondRequest
|
||||||
export const tradeBotRespondRequest = (requestObject) => {
|
export const tradeBotRespondRequest = (requestObject) => {
|
||||||
const txn = new TradeBotRespondRequest().createTransaction(requestObject)
|
const txn = new TradeBotRespondRequest().createTransaction(requestObject)
|
||||||
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
|
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||||
|
|
||||||
return request(`/crosschain/tradebot/respond?apiKey=${myNode.apiKey}`, {
|
return request(`/crosschain/tradebot/respond?apiKey=${myNode.apiKey}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -39,7 +35,6 @@ export const tradeBotRespondRequest = (requestObject) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Sign Trade Transactions
|
// Sign Trade Transactions
|
||||||
export const signTradeBotTxn = (unsignedTxn, keyPair) => {
|
export const signTradeBotTxn = (unsignedTxn, keyPair) => {
|
||||||
return signTradeBotTransaction(unsignedTxn, keyPair)
|
return signTradeBotTransaction(unsignedTxn, keyPair)
|
||||||
@ -48,7 +43,7 @@ export const signTradeBotTxn = (unsignedTxn, keyPair) => {
|
|||||||
// Delete Trade Offer
|
// Delete Trade Offer
|
||||||
export const deleteTradeOffer = (requestObject) => {
|
export const deleteTradeOffer = (requestObject) => {
|
||||||
const txn = new DeleteTradeOffer().createTransaction(requestObject)
|
const txn = new DeleteTradeOffer().createTransaction(requestObject)
|
||||||
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
|
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||||
|
|
||||||
return request(`/crosschain/tradeoffer?apiKey=${myNode.apiKey}`, {
|
return request(`/crosschain/tradeoffer?apiKey=${myNode.apiKey}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
@ -62,7 +57,7 @@ export const deleteTradeOffer = (requestObject) => {
|
|||||||
|
|
||||||
// Send BTC
|
// Send BTC
|
||||||
export const sendBtc = (requestObject) => {
|
export const sendBtc = (requestObject) => {
|
||||||
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
|
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||||
|
|
||||||
return request(`/crosschain/btc/send?apiKey=${myNode.apiKey}`, {
|
return request(`/crosschain/btc/send?apiKey=${myNode.apiKey}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -76,7 +71,7 @@ export const sendBtc = (requestObject) => {
|
|||||||
|
|
||||||
// Send LTC
|
// Send LTC
|
||||||
export const sendLtc = (requestObject) => {
|
export const sendLtc = (requestObject) => {
|
||||||
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
|
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||||
|
|
||||||
return request(`/crosschain/ltc/send?apiKey=${myNode.apiKey}`, {
|
return request(`/crosschain/ltc/send?apiKey=${myNode.apiKey}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -90,7 +85,7 @@ export const sendLtc = (requestObject) => {
|
|||||||
|
|
||||||
// Send DOGE
|
// Send DOGE
|
||||||
export const sendDoge = (requestObject) => {
|
export const sendDoge = (requestObject) => {
|
||||||
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
|
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||||
|
|
||||||
return request(`/crosschain/doge/send?apiKey=${myNode.apiKey}`, {
|
return request(`/crosschain/doge/send?apiKey=${myNode.apiKey}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -104,7 +99,7 @@ export const sendDoge = (requestObject) => {
|
|||||||
|
|
||||||
// Send DGB
|
// Send DGB
|
||||||
export const sendDgb = (requestObject) => {
|
export const sendDgb = (requestObject) => {
|
||||||
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
|
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||||
|
|
||||||
return request(`/crosschain/dgb/send?apiKey=${myNode.apiKey}`, {
|
return request(`/crosschain/dgb/send?apiKey=${myNode.apiKey}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -118,7 +113,7 @@ export const sendDgb = (requestObject) => {
|
|||||||
|
|
||||||
// Send RVN
|
// Send RVN
|
||||||
export const sendRvn = (requestObject) => {
|
export const sendRvn = (requestObject) => {
|
||||||
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
|
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||||
|
|
||||||
return request(`/crosschain/rvn/send?apiKey=${myNode.apiKey}`, {
|
return request(`/crosschain/rvn/send?apiKey=${myNode.apiKey}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -132,7 +127,7 @@ export const sendRvn = (requestObject) => {
|
|||||||
|
|
||||||
// Send ARRR
|
// Send ARRR
|
||||||
export const sendArrr = (requestObject) => {
|
export const sendArrr = (requestObject) => {
|
||||||
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
|
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||||
|
|
||||||
return request(`/crosschain/arrr/send?apiKey=${myNode.apiKey}`, {
|
return request(`/crosschain/arrr/send?apiKey=${myNode.apiKey}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -1,44 +1,29 @@
|
|||||||
'use strict';
|
'use strict'
|
||||||
import TransactionBase from './TransactionBase.js'
|
import TransactionBase from './TransactionBase.js'
|
||||||
import { QORT_DECIMALS } from '../constants.js'
|
import { QORT_DECIMALS } from '../constants.js'
|
||||||
// import { Sha256 } from 'asmcrypto.js/dist_es5/entry-export_all.js'
|
|
||||||
|
|
||||||
export default class PaymentTransaction extends TransactionBase {
|
export default class PaymentTransaction extends TransactionBase {
|
||||||
constructor () {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
this.type = 20
|
this.type = 20
|
||||||
this.amount = 42 * Math.pow(10, 8)
|
|
||||||
this.tests.push(
|
|
||||||
() => {
|
|
||||||
if (!(this._amount >= 0)) {
|
|
||||||
return 'Invalid amount ' + this._amount / QORT_DECIMALS
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
if (!(this._recipient instanceof Uint8Array && this._recipient.length == 25)) {
|
|
||||||
return 'Invalid recipient ' + Base58.encode(this._recipient)
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set recipient (recipient) { // Always Base58 encoded. Accepts Uint8Array or Base58 string.
|
set recipient(recipient) {
|
||||||
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
||||||
}
|
}
|
||||||
set amount (amount) {
|
|
||||||
|
set amount(amount) {
|
||||||
this._amount = amount * QORT_DECIMALS
|
this._amount = amount * QORT_DECIMALS
|
||||||
this._amountBytes = this.constructor.utils.int64ToBytes(amount)
|
this._amountBytes = this.constructor.utils.int64ToBytes(amount)
|
||||||
}
|
}
|
||||||
|
|
||||||
set reference (seed) {
|
set reference(seed) {
|
||||||
const sha = seed => new Sha512().process(seed).finish().result
|
const sha = seed => new Sha512().process(seed).finish().result
|
||||||
let reference = sha(sha(seed))
|
let reference = sha(sha(seed))
|
||||||
reference += reference
|
reference += reference
|
||||||
}
|
}
|
||||||
|
|
||||||
get params () {
|
get params() {
|
||||||
const params = super.params
|
const params = super.params
|
||||||
params.push(
|
params.push(
|
||||||
this._recipient,
|
this._recipient,
|
||||||
|
@ -1,26 +1,17 @@
|
|||||||
'use strict';
|
'use strict'
|
||||||
import TransactionBase from './TransactionBase.js'
|
import TransactionBase from './TransactionBase.js'
|
||||||
// import { QORT_DECIMALS } from "../constants.js" // Not needed, no amount
|
|
||||||
|
|
||||||
export default class DelegationTransaction extends TransactionBase {
|
export default class DelegationTransaction extends TransactionBase {
|
||||||
constructor () {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
this.type = 18
|
this.type = 18
|
||||||
this.tests.push(
|
|
||||||
() => {
|
|
||||||
if (!(this._superNodeAddress instanceof Uint8Array && this._superNodeAddress.length == 25)) {
|
|
||||||
return 'Invalid recipient ' + Base58.encode(this._superNodeAddress)
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set superNodeAddress (superNodeAddress) { // Always Base58 encoded. Accepts Uint8Array or Base58 string.
|
set superNodeAddress(superNodeAddress) {
|
||||||
this._superNodeAddress = superNodeAddress instanceof Uint8Array ? superNodeAddress : this.constructor.Base58.decode(superNodeAddress)
|
this._superNodeAddress = superNodeAddress instanceof Uint8Array ? superNodeAddress : this.constructor.Base58.decode(superNodeAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
get params () {
|
get params() {
|
||||||
const params = super.params
|
const params = super.params
|
||||||
params.push(
|
params.push(
|
||||||
this._superNodeAddress,
|
this._superNodeAddress,
|
||||||
|
@ -1,38 +1,34 @@
|
|||||||
"use strict";
|
'use strict'
|
||||||
import PaymentTransaction from "./PaymentTransaction.js"
|
import PaymentTransaction from './PaymentTransaction.js'
|
||||||
import { QORT_DECIMALS } from "../constants.js"
|
import { QORT_DECIMALS } from '../constants.js'
|
||||||
|
|
||||||
/* ====================================
|
export default class MessageTransaction extends PaymentTransaction {
|
||||||
EXTEND THE PAYMENT TRANSACTION YOU CLOWN
|
constructor() {
|
||||||
====================================== */
|
super()
|
||||||
|
|
||||||
export default class MessageTransaction extends PaymentTransaction{
|
|
||||||
constructor(){
|
|
||||||
super();
|
|
||||||
this.type = 17
|
this.type = 17
|
||||||
this._key = this.constructor.utils.int64ToBytes(0);
|
this._key = this.constructor.utils.int64ToBytes(0);
|
||||||
this._isEncrypted = new Uint8Array(1); // Defaults to false
|
this._isEncrypted = new Uint8Array(1); // Defaults to false
|
||||||
this._isText = new Uint8Array(1); // Defaults to false
|
this._isText = new Uint8Array(1); // Defaults to false
|
||||||
}
|
}
|
||||||
|
|
||||||
set message(message /* UTF8 String */){
|
set message(message /* UTF8 String */) {
|
||||||
// ...yes? no?
|
// ...yes? no?
|
||||||
this.messageText = message;
|
this.messageText = message
|
||||||
|
|
||||||
// Not sure about encoding here...
|
// Not sure about encoding here...
|
||||||
//this._message = message instanceof Uint8Array ? message : this.constructor.Base58.decode(message);
|
|
||||||
this._message = this.constructor.utils.stringtoUTF8Array(message)
|
this._message = this.constructor.utils.stringtoUTF8Array(message)
|
||||||
this._messageLength = this.constructor.utils.int64ToBytes(this._message.length)
|
this._messageLength = this.constructor.utils.int64ToBytes(this._message.length)
|
||||||
}
|
}
|
||||||
set isEncrypted(isEncrypted){
|
|
||||||
this._isEncrypted[0] = isEncrypted;
|
set isEncrypted(isEncrypted) {
|
||||||
|
this._isEncrypted[0] = isEncrypted
|
||||||
}
|
}
|
||||||
set isText(isText){
|
|
||||||
this._isText[0] = isText;
|
set isText(isText) {
|
||||||
|
this._isText[0] = isText
|
||||||
}
|
}
|
||||||
get _params(){
|
|
||||||
// dont extend super because paymentTrasaction is different
|
get _params() {
|
||||||
//const params = super.params;
|
|
||||||
return [
|
return [
|
||||||
this._typeBytes,
|
this._typeBytes,
|
||||||
this._timestampBytes,
|
this._timestampBytes,
|
||||||
@ -49,47 +45,3 @@ export default class MessageTransaction extends PaymentTransaction{
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//"use strict";
|
|
||||||
//function generateSignatureMessageTransaction(keyPair, lastReference, recipient, amount, fee, timestamp, message, isText, isEncrypted) => {
|
|
||||||
// const data = generateMessageTransactionBase(keyPair.publicKey, lastReference, recipient, amount, fee, timestamp, message, isText, isEncrypted);
|
|
||||||
// return nacl.sign.detached(data, keyPair.privateKey);
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//function generateMessageTransaction(keyPair, lastReference, recipient, amount, fee, timestamp, message, isText, isEncrypted, signature) => {
|
|
||||||
// return appendBuffer(generateMessageTransactionBase(keyPair.publicKey, lastReference, recipient, amount, fee, timestamp, message, isText, isEncrypted),
|
|
||||||
// signature);
|
|
||||||
//}
|
|
||||||
//function generateMessageTransactionBase(publicKey, lastReference, recipient, amount, fee, timestamp, message, isText, isEncrypted) => {
|
|
||||||
// txType = TYPES.MESSAGE_TRANSACTION;
|
|
||||||
//
|
|
||||||
// const typeBytes = int32ToBytes(txType);
|
|
||||||
// const timestampBytes = int64ToBytes(timestamp);
|
|
||||||
// const amountBytes = int64ToBytes(amount * 100000000);
|
|
||||||
// const feeBytes = int64ToBytes(fee * 100000000);
|
|
||||||
// const messageLength = int32ToBytes(message.length);
|
|
||||||
// const key = int64ToBytes(0);
|
|
||||||
//
|
|
||||||
// isTextB = new Uint8Array(1);
|
|
||||||
// isTextB[0] = isText;
|
|
||||||
//
|
|
||||||
// isEncryptedB = new Uint8Array(1);
|
|
||||||
// isEncryptedB[0] = isEncrypted;
|
|
||||||
//
|
|
||||||
// let data = new Uint8Array();
|
|
||||||
//
|
|
||||||
// data = appendBuffer(data, typeBytes);
|
|
||||||
// data = appendBuffer(data, timestampBytes);
|
|
||||||
// data = appendBuffer(data, lastReference);
|
|
||||||
// data = appendBuffer(data, publicKey);
|
|
||||||
// data = appendBuffer(data, recipient);
|
|
||||||
// data = appendBuffer(data, key);
|
|
||||||
// data = appendBuffer(data, amountBytes);
|
|
||||||
// data = appendBuffer(data, messageLength);
|
|
||||||
// data = appendBuffer(data, message);
|
|
||||||
// data = appendBuffer(data, isEncryptedB);
|
|
||||||
// data = appendBuffer(data, isTextB);
|
|
||||||
// data = appendBuffer(data, feeBytes);
|
|
||||||
//
|
|
||||||
// return data;
|
|
||||||
//}
|
|
@ -1,4 +1,4 @@
|
|||||||
'use strict';
|
'use strict'
|
||||||
import TransactionBase from './TransactionBase.js'
|
import TransactionBase from './TransactionBase.js'
|
||||||
import Base58 from '../deps/Base58.js'
|
import Base58 from '../deps/Base58.js'
|
||||||
import { store } from '../../api.js'
|
import { store } from '../../api.js'
|
||||||
@ -7,23 +7,34 @@ export default class PaymentTransaction extends TransactionBase {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
this.type = 2
|
this.type = 2
|
||||||
this.tests.push(
|
|
||||||
() => {
|
|
||||||
if (!(this._amount >= 0)) {
|
|
||||||
return 'Invalid amount ' + this._amount / store.getState().config.coin.decimals
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
if (!(this._recipient instanceof Uint8Array && this._recipient.length == 25)) {
|
|
||||||
return 'Invalid recipient ' + Base58.encode(this._recipient)
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set recipient(recipient) { // Always Base58 encoded. Accepts Uint8Array or Base58 string.
|
render(html) {
|
||||||
|
const conf = store.getState().config
|
||||||
|
return html`
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>${this._dialogto}:</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>${this.dialogAddress} ${' '}-</td>
|
||||||
|
<td>${Base58.encode(this._recipient)}</td>
|
||||||
|
</tr>
|
||||||
|
${this.recipientName ? html`
|
||||||
|
<tr>
|
||||||
|
<td>${this.dialogName} ${' '}-</td>
|
||||||
|
<td>${this.recipientName}</td>
|
||||||
|
</tr>
|
||||||
|
` : ''}
|
||||||
|
<tr>
|
||||||
|
<th>${this._dialogamount}</th>
|
||||||
|
<td>${this._amount / conf.coin.decimals} ${conf.coin.symbol}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
|
set recipient(recipient) {
|
||||||
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,32 +60,4 @@ export default class PaymentTransaction extends TransactionBase {
|
|||||||
)
|
)
|
||||||
return params
|
return params
|
||||||
}
|
}
|
||||||
|
|
||||||
render(html) {
|
|
||||||
const conf = store.getState().config
|
|
||||||
return html`
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th>${this._dialogto}:</th>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>${this.dialogAddress} ${' '}-</td>
|
|
||||||
<td>${Base58.encode(this._recipient)}</td>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
${this.recipientName ? html`
|
|
||||||
<tr>
|
|
||||||
<td>${this.dialogName} ${' '}-</td>
|
|
||||||
<td>${this.recipientName}</td>
|
|
||||||
</tr>
|
|
||||||
` : ''}
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<th>${this._dialogamount}</th>
|
|
||||||
<td>${this._amount / conf.coin.decimals} ${conf.coin.symbol}</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
`
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import { QORT_DECIMALS } from "../constants.js"
|
|||||||
|
|
||||||
export default class PublicizeTransaction extends ChatBase {
|
export default class PublicizeTransaction extends ChatBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super()
|
||||||
this.type = 19
|
this.type = 19
|
||||||
this.fee = 0
|
this.fee = 0
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
'use strict';
|
'use strict'
|
||||||
import { TX_TYPES, QORT_DECIMALS } from '../constants.js'
|
import { TX_TYPES, QORT_DECIMALS } from '../constants.js'
|
||||||
import nacl from '../deps/nacl-fast.js'
|
import nacl from '../deps/nacl-fast.js'
|
||||||
import Base58 from '../deps/Base58.js'
|
import Base58 from '../deps/Base58.js'
|
||||||
@ -16,7 +16,6 @@ export default class TransactionBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
// Defaults
|
|
||||||
this.fee = 0
|
this.fee = 0
|
||||||
this.groupID = 0
|
this.groupID = 0
|
||||||
this.timestamp = Date.now()
|
this.timestamp = Date.now()
|
||||||
@ -48,7 +47,6 @@ export default class TransactionBase {
|
|||||||
() => {
|
() => {
|
||||||
if (!(this._lastReference instanceof Uint8Array && this._lastReference.byteLength == 64)) {
|
if (!(this._lastReference instanceof Uint8Array && this._lastReference.byteLength == 64)) {
|
||||||
if (this._lastReference == 0) {
|
if (this._lastReference == 0) {
|
||||||
// No prior transactions exist
|
|
||||||
return 'Invalid last reference. Please ensure that you have at least 0.001 QORT for the transaction fee.'
|
return 'Invalid last reference. Please ensure that you have at least 0.001 QORT for the transaction fee.'
|
||||||
}
|
}
|
||||||
return 'Invalid last reference: ' + this._lastReference
|
return 'Invalid last reference: ' + this._lastReference
|
||||||
@ -70,30 +68,39 @@ export default class TransactionBase {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
render(html) {
|
||||||
|
return html`render method to display requested transaction info`
|
||||||
|
}
|
||||||
|
|
||||||
set keyPair(keyPair) {
|
set keyPair(keyPair) {
|
||||||
this._keyPair = keyPair
|
this._keyPair = keyPair
|
||||||
}
|
}
|
||||||
|
|
||||||
set type(type) {
|
set type(type) {
|
||||||
this.typeText = TX_TYPES[type]
|
this.typeText = TX_TYPES[type]
|
||||||
this._type = type
|
this._type = type
|
||||||
this._typeBytes = this.constructor.utils.int32ToBytes(this._type)
|
this._typeBytes = this.constructor.utils.int32ToBytes(this._type)
|
||||||
}
|
}
|
||||||
|
|
||||||
set groupID(groupID) {
|
set groupID(groupID) {
|
||||||
this._groupID = groupID
|
this._groupID = groupID
|
||||||
this._groupIDBytes = this.constructor.utils.int32ToBytes(this._groupID)
|
this._groupIDBytes = this.constructor.utils.int32ToBytes(this._groupID)
|
||||||
}
|
}
|
||||||
|
|
||||||
set timestamp(timestamp) {
|
set timestamp(timestamp) {
|
||||||
this._timestamp = timestamp
|
this._timestamp = timestamp
|
||||||
this._timestampBytes = this.constructor.utils.int64ToBytes(this._timestamp)
|
this._timestampBytes = this.constructor.utils.int64ToBytes(this._timestamp)
|
||||||
}
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
set fee(fee) {
|
||||||
this._fee = fee * QORT_DECIMALS
|
this._fee = fee * QORT_DECIMALS
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
||||||
}
|
}
|
||||||
set lastReference(lastReference) { // Always Base58 encoded. Accepts Uint8Array or Base58 string.
|
|
||||||
// lastReference could be a string or an Uint8Array
|
set lastReference(lastReference) {
|
||||||
this._lastReference = lastReference instanceof Uint8Array ? lastReference : this.constructor.Base58.decode(lastReference)
|
this._lastReference = lastReference instanceof Uint8Array ? lastReference : this.constructor.Base58.decode(lastReference)
|
||||||
}
|
}
|
||||||
|
|
||||||
get params() {
|
get params() {
|
||||||
return [
|
return [
|
||||||
this._typeBytes,
|
this._typeBytes,
|
||||||
@ -103,6 +110,7 @@ export default class TransactionBase {
|
|||||||
this._keyPair.publicKey
|
this._keyPair.publicKey
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
get signedBytes() {
|
get signedBytes() {
|
||||||
if (!this._signedBytes) {
|
if (!this._signedBytes) {
|
||||||
this.sign()
|
this.sign()
|
||||||
@ -110,16 +118,10 @@ export default class TransactionBase {
|
|||||||
return this._signedBytes
|
return this._signedBytes
|
||||||
}
|
}
|
||||||
|
|
||||||
// render function but NOT lit element
|
|
||||||
render(html) {
|
|
||||||
return html`render method to display requested transaction info`
|
|
||||||
}
|
|
||||||
|
|
||||||
validParams() {
|
validParams() {
|
||||||
let finalResult = {
|
let finalResult = {
|
||||||
valid: true
|
valid: true
|
||||||
}
|
}
|
||||||
// const valid =
|
|
||||||
this.tests.some(test => {
|
this.tests.some(test => {
|
||||||
const result = test()
|
const result = test()
|
||||||
if (result !== true) {
|
if (result !== true) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
'use strict';
|
'use strict'
|
||||||
import TransactionBase from './TransactionBase.js'
|
import TransactionBase from './TransactionBase.js'
|
||||||
import Base58 from '../deps/Base58.js'
|
import Base58 from '../deps/Base58.js'
|
||||||
import { store } from '../../api.js'
|
import { store } from '../../api.js'
|
||||||
|
@ -2,7 +2,6 @@ import nacl from '../../deps/nacl-fast.js'
|
|||||||
import utils from '../../deps/utils.js'
|
import utils from '../../deps/utils.js'
|
||||||
import Base58 from '../../deps/Base58.js'
|
import Base58 from '../../deps/Base58.js'
|
||||||
|
|
||||||
|
|
||||||
const signArbitrary = (arbitraryBytesBase58, arbitraryBytesForSigningBase58, nonce, keyPair) => {
|
const signArbitrary = (arbitraryBytesBase58, arbitraryBytesForSigningBase58, nonce, keyPair) => {
|
||||||
|
|
||||||
if (!arbitraryBytesBase58) {
|
if (!arbitraryBytesBase58) {
|
||||||
@ -18,11 +17,11 @@ const signArbitrary = (arbitraryBytesBase58, arbitraryBytesForSigningBase58, non
|
|||||||
}
|
}
|
||||||
|
|
||||||
const arbitraryBytes = Base58.decode(arbitraryBytesBase58)
|
const arbitraryBytes = Base58.decode(arbitraryBytesBase58)
|
||||||
const _arbitraryBytesBuffer = Object.keys(arbitraryBytes).map(function (key) { return arbitraryBytes[key]; });
|
const _arbitraryBytesBuffer = Object.keys(arbitraryBytes).map(function (key) { return arbitraryBytes[key]; })
|
||||||
const arbitraryBytesBuffer = new Uint8Array(_arbitraryBytesBuffer)
|
const arbitraryBytesBuffer = new Uint8Array(_arbitraryBytesBuffer)
|
||||||
|
|
||||||
const arbitraryBytesForSigning = Base58.decode(arbitraryBytesForSigningBase58)
|
const arbitraryBytesForSigning = Base58.decode(arbitraryBytesForSigningBase58)
|
||||||
const _arbitraryBytesForSigningBuffer = Object.keys(arbitraryBytesForSigning).map(function (key) { return arbitraryBytesForSigning[key]; });
|
const _arbitraryBytesForSigningBuffer = Object.keys(arbitraryBytesForSigning).map(function (key) { return arbitraryBytesForSigning[key]; })
|
||||||
const arbitraryBytesForSigningBuffer = new Uint8Array(_arbitraryBytesForSigningBuffer)
|
const arbitraryBytesForSigningBuffer = new Uint8Array(_arbitraryBytesForSigningBuffer)
|
||||||
|
|
||||||
const _nonce = utils.int32ToBytes(nonce)
|
const _nonce = utils.int32ToBytes(nonce)
|
||||||
|
@ -1,42 +1,37 @@
|
|||||||
"use strict";
|
'use strict'
|
||||||
/*
|
|
||||||
TO DO
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
(function () {
|
||||||
(function(){
|
|
||||||
function generateSignatureArbitraryTransactionV3(keyPair, lastReference, service, arbitraryData, fee, timestamp) => {
|
function generateSignatureArbitraryTransactionV3(keyPair, lastReference, service, arbitraryData, fee, timestamp) => {
|
||||||
const data = generateArbitraryTransactionV3Base(keyPair.publicKey, lastReference, service, arbitraryData, fee, timestamp);
|
const data = generateArbitraryTransactionV3Base(keyPair.publicKey, lastReference, service, arbitraryData, fee, timestamp)
|
||||||
return nacl.sign.detached(data, keyPair.privateKey);
|
return nacl.sign.detached(data, keyPair.privateKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateArbitraryTransactionV3(keyPair, lastReference, service, arbitraryData, fee, timestamp, signature) => {
|
function generateArbitraryTransactionV3(keyPair, lastReference, service, arbitraryData, fee, timestamp, signature) => {
|
||||||
return appendBuffer(generateArbitraryTransactionV3Base(keyPair.publicKey, lastReference, service, arbitraryData, fee, timestamp),
|
return appendBuffer(generateArbitraryTransactionV3Base(keyPair.publicKey, lastReference, service, arbitraryData, fee, timestamp), signature)
|
||||||
signature);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateArbitraryTransactionV3Base(publicKey, lastReference, service, arbitraryData, fee, timestamp) => {
|
function generateArbitraryTransactionV3Base(publicKey, lastReference, service, arbitraryData, fee, timestamp) => {
|
||||||
const txType = TYPES.ARBITRARY_TRANSACTION;
|
const txType = TYPES.ARBITRARY_TRANSACTION
|
||||||
const typeBytes = int32ToBytes(txType);
|
const typeBytes = int32ToBytes(txType)
|
||||||
const timestampBytes = int64ToBytes(timestamp);
|
const timestampBytes = int64ToBytes(timestamp)
|
||||||
const feeBytes = int64ToBytes(fee * 100000000);
|
const feeBytes = int64ToBytes(fee * 100000000)
|
||||||
const serviceBytes = int32ToBytes(service);
|
const serviceBytes = int32ToBytes(service)
|
||||||
const dataSizeBytes = int32ToBytes(arbitraryData.length);
|
const dataSizeBytes = int32ToBytes(arbitraryData.length)
|
||||||
const paymentsLengthBytes = int32ToBytes(0); // Support payments - not yet.
|
const paymentsLengthBytes = int32ToBytes(0) // Support payments - not yet.
|
||||||
|
|
||||||
var data = new Uint8Array();
|
var data = new Uint8Array()
|
||||||
|
|
||||||
data = appendBuffer(data, typeBytes);
|
data = appendBuffer(data, typeBytes)
|
||||||
data = appendBuffer(data, timestampBytes);
|
data = appendBuffer(data, timestampBytes)
|
||||||
data = appendBuffer(data, lastReference);
|
data = appendBuffer(data, lastReference)
|
||||||
data = appendBuffer(data, publicKey);
|
data = appendBuffer(data, publicKey)
|
||||||
data = appendBuffer(data, paymentsLengthBytes);
|
data = appendBuffer(data, paymentsLengthBytes)
|
||||||
// Here it is necessary to insert the payments, if there are
|
// Here it is necessary to insert the payments, if there are
|
||||||
data = appendBuffer(data, serviceBytes);
|
data = appendBuffer(data, serviceBytes)
|
||||||
data = appendBuffer(data, dataSizeBytes);
|
data = appendBuffer(data, dataSizeBytes)
|
||||||
data = appendBuffer(data, arbitraryData);
|
data = appendBuffer(data, arbitraryData)
|
||||||
data = appendBuffer(data, feeBytes);
|
data = appendBuffer(data, feeBytes)
|
||||||
|
|
||||||
return data;
|
return data
|
||||||
}
|
}
|
||||||
}())
|
}())
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
'use strict';
|
'use strict'
|
||||||
import { TX_TYPES, QORT_DECIMALS } from '../../constants.js'
|
import { TX_TYPES, QORT_DECIMALS } from '../../constants.js'
|
||||||
import nacl from '../../deps/nacl-fast.js'
|
import nacl from '../../deps/nacl-fast.js'
|
||||||
import Base58 from '../../deps/Base58.js'
|
import Base58 from '../../deps/Base58.js'
|
||||||
@ -67,28 +67,33 @@ export default class ChatBase {
|
|||||||
set keyPair(keyPair) {
|
set keyPair(keyPair) {
|
||||||
this._keyPair = keyPair
|
this._keyPair = keyPair
|
||||||
}
|
}
|
||||||
|
|
||||||
set type(type) {
|
set type(type) {
|
||||||
this.typeText = TX_TYPES[type]
|
this.typeText = TX_TYPES[type]
|
||||||
this._type = type
|
this._type = type
|
||||||
this._typeBytes = this.constructor.utils.int32ToBytes(this._type)
|
this._typeBytes = this.constructor.utils.int32ToBytes(this._type)
|
||||||
}
|
}
|
||||||
|
|
||||||
set groupID(groupID) {
|
set groupID(groupID) {
|
||||||
this._groupID = groupID
|
this._groupID = groupID
|
||||||
this._groupIDBytes = this.constructor.utils.int32ToBytes(this._groupID)
|
this._groupIDBytes = this.constructor.utils.int32ToBytes(this._groupID)
|
||||||
}
|
}
|
||||||
|
|
||||||
set timestamp(timestamp) {
|
set timestamp(timestamp) {
|
||||||
this._timestamp = timestamp
|
this._timestamp = timestamp
|
||||||
this._timestampBytes = this.constructor.utils.int64ToBytes(this._timestamp)
|
this._timestampBytes = this.constructor.utils.int64ToBytes(this._timestamp)
|
||||||
}
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
set fee(fee) {
|
||||||
this._fee = fee * QORT_DECIMALS
|
this._fee = fee * QORT_DECIMALS
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
||||||
}
|
}
|
||||||
|
|
||||||
set lastReference(lastReference) {
|
set lastReference(lastReference) {
|
||||||
this._lastReference = lastReference instanceof Uint8Array ? lastReference : this.constructor.Base58.decode(lastReference)
|
this._lastReference = lastReference instanceof Uint8Array ? lastReference : this.constructor.Base58.decode(lastReference)
|
||||||
}
|
}
|
||||||
get params() {
|
|
||||||
|
|
||||||
|
get params() {
|
||||||
return [
|
return [
|
||||||
this._typeBytes,
|
this._typeBytes,
|
||||||
this._timestampBytes,
|
this._timestampBytes,
|
||||||
@ -99,7 +104,6 @@ export default class ChatBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get chatBytes() {
|
get chatBytes() {
|
||||||
|
|
||||||
const isValid = this.validParams()
|
const isValid = this.validParams()
|
||||||
if (!isValid.valid) {
|
if (!isValid.valid) {
|
||||||
throw new Error(isValid.message)
|
throw new Error(isValid.message)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"use strict";
|
'use strict'
|
||||||
import ChatBase from "./ChatBase.js"
|
import ChatBase from "./ChatBase.js"
|
||||||
import nacl from '../../deps/nacl-fast.js'
|
import nacl from '../../deps/nacl-fast.js'
|
||||||
import ed2curve from '../../deps/ed2curve.js'
|
import ed2curve from '../../deps/ed2curve.js'
|
||||||
@ -8,7 +8,7 @@ import { CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP } from '../../constants.js'
|
|||||||
|
|
||||||
export default class ChatTransaction extends ChatBase {
|
export default class ChatTransaction extends ChatBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super()
|
||||||
this.type = 18
|
this.type = 18
|
||||||
this.fee = 0
|
this.fee = 0
|
||||||
}
|
}
|
||||||
@ -16,14 +16,12 @@ export default class ChatTransaction extends ChatBase {
|
|||||||
set recipientPublicKey(recipientPublicKey) {
|
set recipientPublicKey(recipientPublicKey) {
|
||||||
this._base58RecipientPublicKey = recipientPublicKey instanceof Uint8Array ? this.constructor.Base58.encode(recipientPublicKey) : recipientPublicKey
|
this._base58RecipientPublicKey = recipientPublicKey instanceof Uint8Array ? this.constructor.Base58.encode(recipientPublicKey) : recipientPublicKey
|
||||||
this._recipientPublicKey = this.constructor.Base58.decode(this._base58RecipientPublicKey)
|
this._recipientPublicKey = this.constructor.Base58.decode(this._base58RecipientPublicKey)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set proofOfWorkNonce(proofOfWorkNonce) {
|
set proofOfWorkNonce(proofOfWorkNonce) {
|
||||||
this._proofOfWorkNonce = this.constructor.utils.int32ToBytes(proofOfWorkNonce)
|
this._proofOfWorkNonce = this.constructor.utils.int32ToBytes(proofOfWorkNonce)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
set recipient(recipient) {
|
set recipient(recipient) {
|
||||||
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
||||||
this._hasReceipient = new Uint8Array(1)
|
this._hasReceipient = new Uint8Array(1)
|
||||||
@ -40,22 +38,20 @@ export default class ChatTransaction extends ChatBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set message(message) {
|
set message(message) {
|
||||||
|
|
||||||
this.messageText = message;
|
this.messageText = message;
|
||||||
|
|
||||||
this._message = this.constructor.utils.stringtoUTF8Array(message)
|
this._message = this.constructor.utils.stringtoUTF8Array(message)
|
||||||
this._messageLength = this.constructor.utils.int32ToBytes(this._message.length)
|
this._messageLength = this.constructor.utils.int32ToBytes(this._message.length)
|
||||||
}
|
}
|
||||||
|
|
||||||
set isEncrypted(isEncrypted) {
|
set isEncrypted(isEncrypted) {
|
||||||
this._isEncrypted = new Uint8Array(1);
|
this._isEncrypted = new Uint8Array(1)
|
||||||
this._isEncrypted[0] = isEncrypted;
|
this._isEncrypted[0] = isEncrypted
|
||||||
|
|
||||||
if (isEncrypted === 1) {
|
if (isEncrypted === 1) {
|
||||||
const convertedPrivateKey = ed2curve.convertSecretKey(this._keyPair.privateKey)
|
const convertedPrivateKey = ed2curve.convertSecretKey(this._keyPair.privateKey)
|
||||||
const convertedPublicKey = ed2curve.convertPublicKey(this._recipientPublicKey)
|
const convertedPublicKey = ed2curve.convertPublicKey(this._recipientPublicKey)
|
||||||
const sharedSecret = new Uint8Array(32);
|
const sharedSecret = new Uint8Array(32)
|
||||||
nacl.lowlevel.crypto_scalarmult(sharedSecret, convertedPrivateKey, convertedPublicKey);
|
nacl.lowlevel.crypto_scalarmult(sharedSecret, convertedPrivateKey, convertedPublicKey)
|
||||||
|
|
||||||
this._chatEncryptionSeed = new Sha256().process(sharedSecret).finish().result
|
this._chatEncryptionSeed = new Sha256().process(sharedSecret).finish().result
|
||||||
this._encryptedMessage = nacl.secretbox(this._message, this._lastReference.slice(0, 24), this._chatEncryptionSeed)
|
this._encryptedMessage = nacl.secretbox(this._message, this._lastReference.slice(0, 24), this._chatEncryptionSeed)
|
||||||
@ -66,12 +62,12 @@ export default class ChatTransaction extends ChatBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set isText(isText) {
|
set isText(isText) {
|
||||||
this._isText = new Uint8Array(1);
|
this._isText = new Uint8Array(1)
|
||||||
this._isText[0] = isText;
|
this._isText[0] = isText
|
||||||
}
|
}
|
||||||
|
|
||||||
get params() {
|
get params() {
|
||||||
const params = super.params;
|
const params = super.params
|
||||||
params.push(
|
params.push(
|
||||||
this._proofOfWorkNonce,
|
this._proofOfWorkNonce,
|
||||||
this._hasReceipient,
|
this._hasReceipient,
|
||||||
@ -82,17 +78,15 @@ export default class ChatTransaction extends ChatBase {
|
|||||||
this._isText,
|
this._isText,
|
||||||
this._feeBytes
|
this._feeBytes
|
||||||
)
|
)
|
||||||
console.log('updated test')
|
|
||||||
// After the feature trigger timestamp we need to include chat reference
|
// After the feature trigger timestamp we need to include chat reference
|
||||||
if (new Date(this._timestamp).getTime() >= CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP) {
|
if (new Date(this._timestamp).getTime() >= CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP) {
|
||||||
params.push(this._hasChatReference)
|
params.push(this._hasChatReference)
|
||||||
|
|
||||||
if (this._hasChatReference[0] == 1) {
|
if (this._hasChatReference[0] == 1) {
|
||||||
console.log('past through', this._chatReference)
|
|
||||||
params.push(this._chatReference)
|
params.push(this._chatReference)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log({params})
|
return params
|
||||||
return params;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"use strict";
|
'use strict'
|
||||||
import ChatBase from "./ChatBase.js"
|
import ChatBase from "./ChatBase.js"
|
||||||
import { CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP } from '../../constants.js'
|
import { CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP } from '../../constants.js'
|
||||||
|
|
||||||
@ -13,12 +13,17 @@ export default class GroupChatTransaction extends ChatBase {
|
|||||||
this._proofOfWorkNonce = this.constructor.utils.int32ToBytes(proofOfWorkNonce)
|
this._proofOfWorkNonce = this.constructor.utils.int32ToBytes(proofOfWorkNonce)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
set hasReceipient(hasReceipient) {
|
set hasReceipient(hasReceipient) {
|
||||||
this._hasReceipient = new Uint8Array(1)
|
this._hasReceipient = new Uint8Array(1)
|
||||||
this._hasReceipient[0] = hasReceipient
|
this._hasReceipient[0] = hasReceipient
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set message(message) {
|
||||||
|
this.messageText = message
|
||||||
|
this._message = this.constructor.utils.stringtoUTF8Array(message)
|
||||||
|
this._messageLength = this.constructor.utils.int32ToBytes(this._message.length)
|
||||||
|
}
|
||||||
|
|
||||||
set hasChatReference(hasChatReference) {
|
set hasChatReference(hasChatReference) {
|
||||||
this._hasChatReference = new Uint8Array(1)
|
this._hasChatReference = new Uint8Array(1)
|
||||||
this._hasChatReference[0] = hasChatReference
|
this._hasChatReference[0] = hasChatReference
|
||||||
@ -28,26 +33,18 @@ export default class GroupChatTransaction extends ChatBase {
|
|||||||
this._chatReference = chatReference instanceof Uint8Array ? chatReference : this.constructor.Base58.decode(chatReference)
|
this._chatReference = chatReference instanceof Uint8Array ? chatReference : this.constructor.Base58.decode(chatReference)
|
||||||
}
|
}
|
||||||
|
|
||||||
set message(message) {
|
|
||||||
|
|
||||||
this.messageText = message;
|
|
||||||
|
|
||||||
this._message = this.constructor.utils.stringtoUTF8Array(message)
|
|
||||||
this._messageLength = this.constructor.utils.int32ToBytes(this._message.length)
|
|
||||||
}
|
|
||||||
|
|
||||||
set isEncrypted(isEncrypted) {
|
set isEncrypted(isEncrypted) {
|
||||||
this._isEncrypted = new Uint8Array(1);
|
this._isEncrypted = new Uint8Array(1);
|
||||||
this._isEncrypted[0] = isEncrypted; // Set to false...
|
this._isEncrypted[0] = isEncrypted
|
||||||
}
|
}
|
||||||
|
|
||||||
set isText(isText) {
|
set isText(isText) {
|
||||||
this._isText = new Uint8Array(1);
|
this._isText = new Uint8Array(1)
|
||||||
this._isText[0] = isText; // Set to true
|
this._isText[0] = isText
|
||||||
}
|
}
|
||||||
|
|
||||||
get params() {
|
get params() {
|
||||||
const params = super.params;
|
const params = super.params
|
||||||
params.push(
|
params.push(
|
||||||
this._proofOfWorkNonce,
|
this._proofOfWorkNonce,
|
||||||
this._hasReceipient,
|
this._hasReceipient,
|
||||||
@ -66,7 +63,6 @@ export default class GroupChatTransaction extends ChatBase {
|
|||||||
params.push(this._chatReference)
|
params.push(this._chatReference)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return params
|
||||||
return params;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ import Base58 from '../../deps/Base58.js'
|
|||||||
import ed2curve from '../../deps/ed2curve.js'
|
import ed2curve from '../../deps/ed2curve.js'
|
||||||
import { Sha256 } from 'asmcrypto.js'
|
import { Sha256 } from 'asmcrypto.js'
|
||||||
|
|
||||||
|
|
||||||
export const decryptChatMessage = (encryptedMessage, privateKey, recipientPublicKey, lastReference) => {
|
export const decryptChatMessage = (encryptedMessage, privateKey, recipientPublicKey, lastReference) => {
|
||||||
let _encryptedMessage = Base58.decode(encryptedMessage)
|
let _encryptedMessage = Base58.decode(encryptedMessage)
|
||||||
|
|
||||||
@ -15,13 +14,13 @@ export const decryptChatMessage = (encryptedMessage, privateKey, recipientPublic
|
|||||||
const convertedPrivateKey = ed2curve.convertSecretKey(privateKey)
|
const convertedPrivateKey = ed2curve.convertSecretKey(privateKey)
|
||||||
const convertedPublicKey = ed2curve.convertPublicKey(_recipientPublicKey)
|
const convertedPublicKey = ed2curve.convertPublicKey(_recipientPublicKey)
|
||||||
const sharedSecret = new Uint8Array(32);
|
const sharedSecret = new Uint8Array(32);
|
||||||
nacl.lowlevel.crypto_scalarmult(sharedSecret, convertedPrivateKey, convertedPublicKey);
|
nacl.lowlevel.crypto_scalarmult(sharedSecret, convertedPrivateKey, convertedPublicKey)
|
||||||
|
|
||||||
const _chatEncryptionSeed = new Sha256().process(sharedSecret).finish().result
|
const _chatEncryptionSeed = new Sha256().process(sharedSecret).finish().result
|
||||||
const _decryptedMessage = nacl.secretbox.open(_encryptedMessage, _lastReference.slice(0, 24), _chatEncryptionSeed)
|
const _decryptedMessage = nacl.secretbox.open(_encryptedMessage, _lastReference.slice(0, 24), _chatEncryptionSeed)
|
||||||
|
|
||||||
let decryptedMessage = ''
|
let decryptedMessage = ''
|
||||||
|
|
||||||
_decryptedMessage === false ? decryptedMessage : decryptedMessage = new TextDecoder('utf-8').decode(_decryptedMessage);
|
_decryptedMessage === false ? decryptedMessage : decryptedMessage = new TextDecoder('utf-8').decode(_decryptedMessage)
|
||||||
return decryptedMessage
|
return decryptedMessage
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import nacl from '../../deps/nacl-fast.js'
|
import nacl from '../../deps/nacl-fast.js'
|
||||||
import utils from '../../deps/utils.js'
|
import utils from '../../deps/utils.js'
|
||||||
|
|
||||||
|
|
||||||
const signChat = (chatBytes, nonce, keyPair) => {
|
const signChat = (chatBytes, nonce, keyPair) => {
|
||||||
|
|
||||||
if (!chatBytes) {
|
if (!chatBytes) {
|
||||||
@ -19,12 +18,11 @@ const signChat = (chatBytes, nonce, keyPair) => {
|
|||||||
const _nonce = utils.int32ToBytes(nonce)
|
const _nonce = utils.int32ToBytes(nonce)
|
||||||
|
|
||||||
if (chatBytes.length === undefined) {
|
if (chatBytes.length === undefined) {
|
||||||
const _chatBytesBuffer = Object.keys(chatBytes).map(function (key) { return chatBytes[key]; });
|
const _chatBytesBuffer = Object.keys(chatBytes).map(function (key) { return chatBytes[key]; })
|
||||||
|
|
||||||
const chatBytesBuffer = new Uint8Array(_chatBytesBuffer)
|
const chatBytesBuffer = new Uint8Array(_chatBytesBuffer)
|
||||||
chatBytesBuffer.set(_nonce, 112)
|
chatBytesBuffer.set(_nonce, 112)
|
||||||
|
|
||||||
|
|
||||||
const signature = nacl.sign.detached(chatBytesBuffer, keyPair.privateKey)
|
const signature = nacl.sign.detached(chatBytesBuffer, keyPair.privateKey)
|
||||||
|
|
||||||
const signedBytes = utils.appendBuffer(chatBytesBuffer, signature)
|
const signedBytes = utils.appendBuffer(chatBytesBuffer, signature)
|
||||||
@ -34,7 +32,6 @@ const signChat = (chatBytes, nonce, keyPair) => {
|
|||||||
const chatBytesBuffer = new Uint8Array(chatBytes)
|
const chatBytesBuffer = new Uint8Array(chatBytes)
|
||||||
chatBytesBuffer.set(_nonce, 112)
|
chatBytesBuffer.set(_nonce, 112)
|
||||||
|
|
||||||
|
|
||||||
const signature = nacl.sign.detached(chatBytesBuffer, keyPair.privateKey)
|
const signature = nacl.sign.detached(chatBytesBuffer, keyPair.privateKey)
|
||||||
|
|
||||||
const signedBytes = utils.appendBuffer(chatBytesBuffer, signature)
|
const signedBytes = utils.appendBuffer(chatBytesBuffer, signature)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict'
|
||||||
import TransactionBase from "../TransactionBase.js"
|
import TransactionBase from '../TransactionBase.js'
|
||||||
import { QORT_DECIMALS } from "../../constants.js"
|
import { QORT_DECIMALS } from '../../constants.js'
|
||||||
|
|
||||||
export default class AddGroupAdminTransaction extends TransactionBase {
|
export default class AddGroupAdminTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -27,7 +27,7 @@ export default class AddGroupAdminTransaction extends TransactionBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set rGroupId(rGroupId) {
|
set rGroupId(rGroupId) {
|
||||||
this._rGroupId = rGroupId;
|
this._rGroupId = rGroupId
|
||||||
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict'
|
||||||
import TransactionBase from "../TransactionBase.js"
|
import TransactionBase from '../TransactionBase.js'
|
||||||
import { QORT_DECIMALS } from "../../constants.js"
|
import { QORT_DECIMALS } from '../../constants.js'
|
||||||
|
|
||||||
export default class CancelGroupBanTransaction extends TransactionBase {
|
export default class CancelGroupBanTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -19,7 +19,7 @@ export default class CancelGroupBanTransaction extends TransactionBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set cancelBanMemberDialog1(cancelBanMemberDialog1) {
|
set cancelBanMemberDialog1(cancelBanMemberDialog1) {
|
||||||
this._cancelBanMemberDialog1= cancelBanMemberDialog1
|
this._cancelBanMemberDialog1 = cancelBanMemberDialog1
|
||||||
}
|
}
|
||||||
|
|
||||||
set cancelBanMemberDialog2(cancelBanMemberDialog2) {
|
set cancelBanMemberDialog2(cancelBanMemberDialog2) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict'
|
||||||
import TransactionBase from "../TransactionBase.js"
|
import TransactionBase from '../TransactionBase.js'
|
||||||
import { QORT_DECIMALS } from "../../constants.js"
|
import { QORT_DECIMALS } from '../../constants.js'
|
||||||
|
|
||||||
export default class CancelGroupInviteTransaction extends TransactionBase {
|
export default class CancelGroupInviteTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -34,7 +34,7 @@ export default class CancelGroupInviteTransaction extends TransactionBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set rGroupId(rGroupId) {
|
set rGroupId(rGroupId) {
|
||||||
this._rGroupId = rGroupId;
|
this._rGroupId = rGroupId
|
||||||
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"use strict";
|
'use strict'
|
||||||
import TransactionBase from "../TransactionBase.js"
|
import TransactionBase from '../TransactionBase.js'
|
||||||
import { QORT_DECIMALS } from "../../constants.js"
|
import { QORT_DECIMALS } from '../../constants.js'
|
||||||
|
|
||||||
export default class CreateGroupTransaction extends TransactionBase {
|
export default class CreateGroupTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -48,40 +48,40 @@ export default class CreateGroupTransaction extends TransactionBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set rGroupName(rGroupName) {
|
set rGroupName(rGroupName) {
|
||||||
this._rGroupName = rGroupName;
|
this._rGroupName = rGroupName
|
||||||
this._rGroupNameBytes = this.constructor.utils.stringtoUTF8Array(this._rGroupName.toLocaleLowerCase())
|
this._rGroupNameBytes = this.constructor.utils.stringtoUTF8Array(this._rGroupName.toLocaleLowerCase())
|
||||||
this._rGroupNameLength = this.constructor.utils.int32ToBytes(this._rGroupNameBytes.length)
|
this._rGroupNameLength = this.constructor.utils.int32ToBytes(this._rGroupNameBytes.length)
|
||||||
}
|
}
|
||||||
|
|
||||||
set rGroupDesc(rGroupDesc) {
|
set rGroupDesc(rGroupDesc) {
|
||||||
this._rGroupDesc = rGroupDesc;
|
this._rGroupDesc = rGroupDesc
|
||||||
this._rGroupDescBytes = this.constructor.utils.stringtoUTF8Array(this._rGroupDesc.toLocaleLowerCase())
|
this._rGroupDescBytes = this.constructor.utils.stringtoUTF8Array(this._rGroupDesc.toLocaleLowerCase())
|
||||||
this._rGroupDescLength = this.constructor.utils.int32ToBytes(this._rGroupDescBytes.length)
|
this._rGroupDescLength = this.constructor.utils.int32ToBytes(this._rGroupDescBytes.length)
|
||||||
}
|
}
|
||||||
|
|
||||||
set rGroupType(rGroupType) {
|
set rGroupType(rGroupType) {
|
||||||
this.myGroupType = rGroupType;
|
this.myGroupType = rGroupType
|
||||||
this._rGroupType = new Uint8Array(1)
|
this._rGroupType = new Uint8Array(1)
|
||||||
this._rGroupType[0] = rGroupType;
|
this._rGroupType[0] = rGroupType
|
||||||
}
|
}
|
||||||
|
|
||||||
set rGroupApprovalThreshold(rGroupApprovalThreshold) {
|
set rGroupApprovalThreshold(rGroupApprovalThreshold) {
|
||||||
this._rGroupApprovalThreshold = new Uint8Array(1)
|
this._rGroupApprovalThreshold = new Uint8Array(1)
|
||||||
this._rGroupApprovalThreshold[0] = rGroupApprovalThreshold;
|
this._rGroupApprovalThreshold[0] = rGroupApprovalThreshold
|
||||||
}
|
}
|
||||||
|
|
||||||
set rGroupMinimumBlockDelay(rGroupMinimumBlockDelay) {
|
set rGroupMinimumBlockDelay(rGroupMinimumBlockDelay) {
|
||||||
this._rGroupMinimumBlockDelay = rGroupMinimumBlockDelay;
|
this._rGroupMinimumBlockDelay = rGroupMinimumBlockDelay
|
||||||
this._rGroupMinimumBlockDelayBytes = this.constructor.utils.int32ToBytes(this._rGroupMinimumBlockDelay)
|
this._rGroupMinimumBlockDelayBytes = this.constructor.utils.int32ToBytes(this._rGroupMinimumBlockDelay)
|
||||||
}
|
}
|
||||||
|
|
||||||
set rGroupMaximumBlockDelay(rGroupMaximumBlockDelay) {
|
set rGroupMaximumBlockDelay(rGroupMaximumBlockDelay) {
|
||||||
this._rGroupMaximumBlockDelay = rGroupMaximumBlockDelay;
|
this._rGroupMaximumBlockDelay = rGroupMaximumBlockDelay
|
||||||
this._rGroupMaximumBlockDelayBytes = this.constructor.utils.int32ToBytes(this._rGroupMaximumBlockDelay)
|
this._rGroupMaximumBlockDelayBytes = this.constructor.utils.int32ToBytes(this._rGroupMaximumBlockDelay)
|
||||||
}
|
}
|
||||||
|
|
||||||
get params() {
|
get params() {
|
||||||
const params = super.params;
|
const params = super.params
|
||||||
params.push(
|
params.push(
|
||||||
this._rGroupNameLength,
|
this._rGroupNameLength,
|
||||||
this._rGroupNameBytes,
|
this._rGroupNameBytes,
|
||||||
@ -93,6 +93,6 @@ export default class CreateGroupTransaction extends TransactionBase {
|
|||||||
this._rGroupMaximumBlockDelayBytes,
|
this._rGroupMaximumBlockDelayBytes,
|
||||||
this._feeBytes
|
this._feeBytes
|
||||||
)
|
)
|
||||||
return params;
|
return params
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict'
|
||||||
import TransactionBase from "../TransactionBase.js"
|
import TransactionBase from '../TransactionBase.js'
|
||||||
import { QORT_DECIMALS } from "../../constants.js"
|
import { QORT_DECIMALS } from '../../constants.js'
|
||||||
|
|
||||||
export default class GroupBanTransaction extends TransactionBase {
|
export default class GroupBanTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -19,7 +19,7 @@ export default class GroupBanTransaction extends TransactionBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set banMemberDialog1(banMemberDialog1) {
|
set banMemberDialog1(banMemberDialog1) {
|
||||||
this._banMemberDialog1= banMemberDialog1
|
this._banMemberDialog1 = banMemberDialog1
|
||||||
}
|
}
|
||||||
|
|
||||||
set banMemberDialog2(banMemberDialog2) {
|
set banMemberDialog2(banMemberDialog2) {
|
||||||
@ -27,7 +27,7 @@ export default class GroupBanTransaction extends TransactionBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set rGroupId(rGroupId) {
|
set rGroupId(rGroupId) {
|
||||||
this._rGroupId = rGroupId;
|
this._rGroupId = rGroupId
|
||||||
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict'
|
||||||
import TransactionBase from "../TransactionBase.js"
|
import TransactionBase from '../TransactionBase.js'
|
||||||
import { QORT_DECIMALS } from "../../constants.js"
|
import { QORT_DECIMALS } from '../../constants.js'
|
||||||
|
|
||||||
export default class GroupInviteTransaction extends TransactionBase {
|
export default class GroupInviteTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -19,7 +19,7 @@ export default class GroupInviteTransaction extends TransactionBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set inviteMemberDialog1(inviteMemberDialog1) {
|
set inviteMemberDialog1(inviteMemberDialog1) {
|
||||||
this._inviteMemberDialog1= inviteMemberDialog1
|
this._inviteMemberDialog1 = inviteMemberDialog1
|
||||||
}
|
}
|
||||||
|
|
||||||
set inviteMemberDialog2(inviteMemberDialog2) {
|
set inviteMemberDialog2(inviteMemberDialog2) {
|
||||||
@ -27,7 +27,7 @@ export default class GroupInviteTransaction extends TransactionBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set rGroupId(rGroupId) {
|
set rGroupId(rGroupId) {
|
||||||
this._rGroupId = rGroupId;
|
this._rGroupId = rGroupId
|
||||||
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict'
|
||||||
import TransactionBase from "../TransactionBase.js"
|
import TransactionBase from '../TransactionBase.js'
|
||||||
import { QORT_DECIMALS } from "../../constants.js"
|
import { QORT_DECIMALS } from '../../constants.js'
|
||||||
|
|
||||||
export default class GroupKickTransaction extends TransactionBase {
|
export default class GroupKickTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -19,7 +19,7 @@ export default class GroupKickTransaction extends TransactionBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set kickMemberDialog1(kickMemberDialog1) {
|
set kickMemberDialog1(kickMemberDialog1) {
|
||||||
this._kickMemberDialog1= kickMemberDialog1
|
this._kickMemberDialog1 = kickMemberDialog1
|
||||||
}
|
}
|
||||||
|
|
||||||
set kickMemberDialog2(kickMemberDialog2) {
|
set kickMemberDialog2(kickMemberDialog2) {
|
||||||
@ -27,7 +27,7 @@ export default class GroupKickTransaction extends TransactionBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set rGroupId(rGroupId) {
|
set rGroupId(rGroupId) {
|
||||||
this._rGroupId = rGroupId;
|
this._rGroupId = rGroupId
|
||||||
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,19 +1,11 @@
|
|||||||
"use strict";
|
'use strict'
|
||||||
import TransactionBase from "../TransactionBase.js"
|
import TransactionBase from '../TransactionBase.js'
|
||||||
import { QORT_DECIMALS } from "../../constants.js"
|
import { QORT_DECIMALS } from '../../constants.js'
|
||||||
|
|
||||||
export default class JoinGroupTransaction extends TransactionBase {
|
export default class JoinGroupTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
this.type = 31
|
this.type = 31
|
||||||
this.tests.push(
|
|
||||||
() => {
|
|
||||||
if (!(this._registrantAddress instanceof Uint8Array && this._registrantAddress.length == 25)) {
|
|
||||||
return "Invalid Registrant " + Base58.encode(this._registrantAddress)
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render(html) {
|
render(html) {
|
||||||
@ -39,25 +31,25 @@ export default class JoinGroupTransaction extends TransactionBase {
|
|||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
||||||
}
|
}
|
||||||
|
|
||||||
set registrantAddress(registrantAddress) {// Always Base58 encoded. Accepts Uint8Array or Base58 string.
|
set registrantAddress(registrantAddress) {
|
||||||
this._registrantAddress = registrantAddress instanceof Uint8Array ? registrantAddress : this.constructor.Base58.decode(registrantAddress);
|
this._registrantAddress = registrantAddress instanceof Uint8Array ? registrantAddress : this.constructor.Base58.decode(registrantAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
set rGroupId(rGroupId) {
|
set rGroupId(rGroupId) {
|
||||||
this._rGroupId = rGroupId;
|
this._rGroupId = rGroupId
|
||||||
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
||||||
}
|
}
|
||||||
|
|
||||||
set rGroupName(rGroupName) {
|
set rGroupName(rGroupName) {
|
||||||
this._rGroupName = rGroupName;
|
this._rGroupName = rGroupName
|
||||||
}
|
}
|
||||||
|
|
||||||
get params() {
|
get params() {
|
||||||
const params = super.params;
|
const params = super.params
|
||||||
params.push(
|
params.push(
|
||||||
this._rGroupIdBytes,
|
this._rGroupIdBytes,
|
||||||
this._feeBytes
|
this._feeBytes
|
||||||
)
|
)
|
||||||
return params;
|
return params
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,19 +1,11 @@
|
|||||||
"use strict";
|
'use strict'
|
||||||
import TransactionBase from "../TransactionBase.js"
|
import TransactionBase from '../TransactionBase.js'
|
||||||
import { QORT_DECIMALS } from "../../constants.js"
|
import { QORT_DECIMALS } from '../../constants.js'
|
||||||
|
|
||||||
export default class LeaveGroupTransaction extends TransactionBase {
|
export default class LeaveGroupTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
this.type = 32
|
this.type = 32
|
||||||
this.tests.push(
|
|
||||||
() => {
|
|
||||||
if (!(this._registrantAddress instanceof Uint8Array && this._registrantAddress.length == 25)) {
|
|
||||||
return "Invalid Registrant " + Base58.encode(this._registrantAddress)
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render(html) {
|
render(html) {
|
||||||
@ -39,26 +31,25 @@ export default class LeaveGroupTransaction extends TransactionBase {
|
|||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
||||||
}
|
}
|
||||||
|
|
||||||
set registrantAddress(registrantAddress) {// Always Base58 encoded. Accepts Uint8Array or Base58 string.
|
set registrantAddress(registrantAddress) {
|
||||||
this._registrantAddress = registrantAddress instanceof Uint8Array ? registrantAddress : this.constructor.Base58.decode(registrantAddress);
|
this._registrantAddress = registrantAddress instanceof Uint8Array ? registrantAddress : this.constructor.Base58.decode(registrantAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
set rGroupId(rGroupId) {
|
set rGroupId(rGroupId) {
|
||||||
this._rGroupId = rGroupId;
|
this._rGroupId = rGroupId
|
||||||
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
||||||
}
|
}
|
||||||
|
|
||||||
set rGroupName(rGroupName) {
|
set rGroupName(rGroupName) {
|
||||||
this._rGroupName = rGroupName;
|
this._rGroupName = rGroupName
|
||||||
}
|
}
|
||||||
|
|
||||||
get params() {
|
get params() {
|
||||||
const params = super.params;
|
const params = super.params
|
||||||
params.push(
|
params.push(
|
||||||
this._rGroupIdBytes,
|
this._rGroupIdBytes,
|
||||||
this._feeBytes
|
this._feeBytes
|
||||||
)
|
)
|
||||||
console.log('check exec params2', params)
|
return params
|
||||||
return params;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict'
|
||||||
import TransactionBase from "../TransactionBase.js"
|
import TransactionBase from '../TransactionBase.js'
|
||||||
import { QORT_DECIMALS } from "../../constants.js"
|
import { QORT_DECIMALS } from '../../constants.js'
|
||||||
|
|
||||||
export default class RemoveGroupAdminTransaction extends TransactionBase {
|
export default class RemoveGroupAdminTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -27,7 +27,7 @@ export default class RemoveGroupAdminTransaction extends TransactionBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set rGroupId(rGroupId) {
|
set rGroupId(rGroupId) {
|
||||||
this._rGroupId = rGroupId;
|
this._rGroupId = rGroupId
|
||||||
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
'use strict';
|
'use strict'
|
||||||
import TransactionBase from '../TransactionBase.js'
|
import TransactionBase from '../TransactionBase.js'
|
||||||
import { QORT_DECIMALS } from '../../constants.js'
|
import { QORT_DECIMALS } from '../../constants.js'
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
'use strict';
|
'use strict'
|
||||||
import TransactionBase from '../TransactionBase.js'
|
import TransactionBase from '../TransactionBase.js'
|
||||||
import { QORT_DECIMALS } from '../../constants.js'
|
import { QORT_DECIMALS } from '../../constants.js'
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"use strict";
|
'use strict'
|
||||||
import TransactionBase from "../TransactionBase.js"
|
import TransactionBase from '../TransactionBase.js'
|
||||||
import { QORT_DECIMALS } from "../../constants.js"
|
import { QORT_DECIMALS } from '../../constants.js'
|
||||||
|
|
||||||
export default class RegisterNameTransaction extends TransactionBase {
|
export default class RegisterNameTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -32,19 +32,19 @@ export default class RegisterNameTransaction extends TransactionBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set name(name) {
|
set name(name) {
|
||||||
this.nameText = name;
|
this.nameText = name
|
||||||
this._nameBytes = this.constructor.utils.stringtoUTF8Array(name)
|
this._nameBytes = this.constructor.utils.stringtoUTF8Array(name)
|
||||||
this._nameLength = this.constructor.utils.int32ToBytes(this._nameBytes.length)
|
this._nameLength = this.constructor.utils.int32ToBytes(this._nameBytes.length)
|
||||||
}
|
}
|
||||||
|
|
||||||
set value(value) {
|
set value(value) {
|
||||||
this.valueText = value.length === 0 ? "Registered Name on the Qortal Chain" : value;
|
this.valueText = value.length === 0 ? "Registered Name on the Qortal Chain" : value
|
||||||
this._valueBytes = this.constructor.utils.stringtoUTF8Array(this.valueText)
|
this._valueBytes = this.constructor.utils.stringtoUTF8Array(this.valueText)
|
||||||
this._valueLength = this.constructor.utils.int32ToBytes(this._valueBytes.length)
|
this._valueLength = this.constructor.utils.int32ToBytes(this._valueBytes.length)
|
||||||
}
|
}
|
||||||
|
|
||||||
get params() {
|
get params() {
|
||||||
const params = super.params;
|
const params = super.params
|
||||||
params.push(
|
params.push(
|
||||||
this._nameLength,
|
this._nameLength,
|
||||||
this._nameBytes,
|
this._nameBytes,
|
||||||
@ -52,6 +52,6 @@ export default class RegisterNameTransaction extends TransactionBase {
|
|||||||
this._valueBytes,
|
this._valueBytes,
|
||||||
this._feeBytes
|
this._feeBytes
|
||||||
)
|
)
|
||||||
return params;
|
return params
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
'use strict';
|
'use strict'
|
||||||
import TransactionBase from '../TransactionBase.js'
|
import TransactionBase from '../TransactionBase.js'
|
||||||
import { QORT_DECIMALS } from '../../constants.js'
|
import { QORT_DECIMALS } from '../../constants.js'
|
||||||
|
|
||||||
|
@ -1,39 +1,36 @@
|
|||||||
"use strict";
|
'use strict'
|
||||||
/*
|
|
||||||
TO DO
|
(function () {
|
||||||
*/
|
|
||||||
(function(){
|
|
||||||
function generateSignatureRegisterNameTransaction(keyPair, lastReference, owner, name, value, fee, timestamp) => {
|
function generateSignatureRegisterNameTransaction(keyPair, lastReference, owner, name, value, fee, timestamp) => {
|
||||||
const data = generateRegisterNameTransactionBase(keyPair.publicKey, lastReference, owner, name, value, fee, timestamp);
|
const data = generateRegisterNameTransactionBase(keyPair.publicKey, lastReference, owner, name, value, fee, timestamp)
|
||||||
return nacl.sign.detached(data, keyPair.privateKey);
|
return nacl.sign.detached(data, keyPair.privateKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateRegisterNameTransaction(keyPair, lastReference, owner, name, value, fee, timestamp, signature) => {
|
function generateRegisterNameTransaction(keyPair, lastReference, owner, name, value, fee, timestamp, signature) => {
|
||||||
return appendBuffer( generateRegisterNameTransactionBase(keyPair.publicKey, lastReference, owner, name, value, fee, timestamp),
|
return appendBuffer(generateRegisterNameTransactionBase(keyPair.publicKey, lastReference, owner, name, value, fee, timestamp), signature)
|
||||||
signature );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateRegisterNameTransactionBase(publicKey, lastReference, owner, name, value, fee, timestamp) => {
|
function generateRegisterNameTransactionBase(publicKey, lastReference, owner, name, value, fee, timestamp) => {
|
||||||
const txType = TYPES.REGISTER_NAME_TRANSACTION;
|
const txType = TYPES.REGISTER_NAME_TRANSACTION
|
||||||
const typeBytes = int32ToBytes(txType);
|
const typeBytes = int32ToBytes(txType)
|
||||||
const timestampBytes = int64ToBytes(timestamp);
|
const timestampBytes = int64ToBytes(timestamp)
|
||||||
const feeBytes = int64ToBytes(fee * 100000000);
|
const feeBytes = int64ToBytes(fee * 100000000)
|
||||||
const nameSizeBytes = int32ToBytes(name.length);
|
const nameSizeBytes = int32ToBytes(name.length)
|
||||||
const valueSizeBytes = int32ToBytes(value.length);
|
const valueSizeBytes = int32ToBytes(value.length)
|
||||||
|
|
||||||
let data = new Uint8Array();
|
let data = new Uint8Array()
|
||||||
|
|
||||||
data = appendBuffer(data, typeBytes);
|
data = appendBuffer(data, typeBytes)
|
||||||
data = appendBuffer(data, timestampBytes);
|
data = appendBuffer(data, timestampBytes)
|
||||||
data = appendBuffer(data, lastReference);
|
data = appendBuffer(data, lastReference)
|
||||||
data = appendBuffer(data, publicKey);
|
data = appendBuffer(data, publicKey)
|
||||||
data = appendBuffer(data, owner);
|
data = appendBuffer(data, owner)
|
||||||
data = appendBuffer(data, nameSizeBytes);
|
data = appendBuffer(data, nameSizeBytes)
|
||||||
data = appendBuffer(data, name);
|
data = appendBuffer(data, name)
|
||||||
data = appendBuffer(data, valueSizeBytes);
|
data = appendBuffer(data, valueSizeBytes)
|
||||||
data = appendBuffer(data, value);
|
data = appendBuffer(data, value)
|
||||||
data = appendBuffer(data, feeBytes);
|
data = appendBuffer(data, feeBytes)
|
||||||
|
|
||||||
return data;
|
return data
|
||||||
}
|
}
|
||||||
}())
|
}())
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
'use strict'
|
||||||
import TransactionBase from "../TransactionBase.js"
|
import TransactionBase from '../TransactionBase.js'
|
||||||
import publicKeyToAddress from '../../wallet/publicKeyToAddress.js'
|
import publicKeyToAddress from '../../wallet/publicKeyToAddress.js'
|
||||||
import { Base58 } from "../../deps/deps.js";
|
import { Base58 } from '../../deps/deps.js'
|
||||||
|
|
||||||
export default class RemoveRewardShareTransaction extends TransactionBase {
|
export default class RemoveRewardShareTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -20,11 +20,11 @@ export default class RemoveRewardShareTransaction extends TransactionBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set rewarddialog5(rewarddialog5) {
|
set rewarddialog5(rewarddialog5) {
|
||||||
this._rewarddialog5 = rewarddialog5;
|
this._rewarddialog5 = rewarddialog5
|
||||||
}
|
}
|
||||||
|
|
||||||
set rewarddialog6(rewarddialog6) {
|
set rewarddialog6(rewarddialog6) {
|
||||||
this._rewarddialog6 = rewarddialog6;
|
this._rewarddialog6 = rewarddialog6
|
||||||
}
|
}
|
||||||
|
|
||||||
set rewardShareKeyPairPublicKey(rewardShareKeyPairPublicKey) {
|
set rewardShareKeyPairPublicKey(rewardShareKeyPairPublicKey) {
|
||||||
@ -50,6 +50,6 @@ export default class RemoveRewardShareTransaction extends TransactionBase {
|
|||||||
this._percentageShareBytes,
|
this._percentageShareBytes,
|
||||||
this._feeBytes
|
this._feeBytes
|
||||||
)
|
)
|
||||||
return params;
|
return params
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"use strict";
|
'use strict'
|
||||||
import publicKeyToAddress from '../../wallet/publicKeyToAddress.js'
|
import publicKeyToAddress from '../../wallet/publicKeyToAddress.js'
|
||||||
import TransactionBase from "../TransactionBase.js"
|
import TransactionBase from "../TransactionBase.js"
|
||||||
import nacl from '../../deps/nacl-fast.js'
|
import nacl from '../../deps/nacl-fast.js'
|
||||||
@ -23,19 +23,19 @@ export default class RewardShareTransaction extends TransactionBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set rewarddialog1(rewarddialog1) {
|
set rewarddialog1(rewarddialog1) {
|
||||||
this._rewarddialog1 = rewarddialog1;
|
this._rewarddialog1 = rewarddialog1
|
||||||
}
|
}
|
||||||
|
|
||||||
set rewarddialog2(rewarddialog2) {
|
set rewarddialog2(rewarddialog2) {
|
||||||
this._rewarddialog2 = rewarddialog2;
|
this._rewarddialog2 = rewarddialog2
|
||||||
}
|
}
|
||||||
|
|
||||||
set rewarddialog3(rewarddialog3) {
|
set rewarddialog3(rewarddialog3) {
|
||||||
this._rewarddialog3 = rewarddialog3;
|
this._rewarddialog3 = rewarddialog3
|
||||||
}
|
}
|
||||||
|
|
||||||
set rewarddialog4(rewarddialog4) {
|
set rewarddialog4(rewarddialog4) {
|
||||||
this._rewarddialog4 = rewarddialog4;
|
this._rewarddialog4 = rewarddialog4
|
||||||
}
|
}
|
||||||
|
|
||||||
set recipientPublicKey(recipientPublicKey) {
|
set recipientPublicKey(recipientPublicKey) {
|
||||||
@ -46,7 +46,6 @@ export default class RewardShareTransaction extends TransactionBase {
|
|||||||
|
|
||||||
this.fee = (recipientPublicKey === this.constructor.Base58.encode(this._keyPair.publicKey) ? 0 : 0.001)
|
this.fee = (recipientPublicKey === this.constructor.Base58.encode(this._keyPair.publicKey) ? 0 : 0.001)
|
||||||
|
|
||||||
// Reward share keys
|
|
||||||
const convertedPrivateKey = ed2curve.convertSecretKey(this._keyPair.privateKey)
|
const convertedPrivateKey = ed2curve.convertSecretKey(this._keyPair.privateKey)
|
||||||
const convertedPublicKey = ed2curve.convertPublicKey(this._recipientPublicKey)
|
const convertedPublicKey = ed2curve.convertPublicKey(this._recipientPublicKey)
|
||||||
const sharedSecret = new Uint8Array(32);
|
const sharedSecret = new Uint8Array(32);
|
||||||
@ -57,7 +56,7 @@ export default class RewardShareTransaction extends TransactionBase {
|
|||||||
this._rewardShareKeyPair = nacl.sign.keyPair.fromSeed(this._rewardShareSeed)
|
this._rewardShareKeyPair = nacl.sign.keyPair.fromSeed(this._rewardShareSeed)
|
||||||
}
|
}
|
||||||
|
|
||||||
set recipient(recipient) { // Always Base58 encoded. Accepts Uint8Array or Base58 string.
|
set recipient(recipient) {
|
||||||
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,6 +73,6 @@ export default class RewardShareTransaction extends TransactionBase {
|
|||||||
this._percentageShareBytes,
|
this._percentageShareBytes,
|
||||||
this._feeBytes
|
this._feeBytes
|
||||||
)
|
)
|
||||||
return params;
|
return params
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,62 +10,46 @@ export default class TradeBotCreateRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createTransaction(txnReq) {
|
createTransaction(txnReq) {
|
||||||
|
this.creatorPublicKey(txnReq.creatorPublicKey)
|
||||||
|
this.qortAmount(txnReq.qortAmount)
|
||||||
|
this.fundingQortAmount(txnReq.fundingQortAmount)
|
||||||
|
this.foreignBlockchain(txnReq.foreignBlockchain)
|
||||||
|
this.foreignAmount(txnReq.foreignAmount)
|
||||||
|
this.tradeTimeout(txnReq.tradeTimeout)
|
||||||
|
this.receivingAddress(txnReq.receivingAddress)
|
||||||
|
|
||||||
this.creatorPublicKey(txnReq.creatorPublicKey);
|
return this.txnRequest()
|
||||||
|
|
||||||
this.qortAmount(txnReq.qortAmount);
|
|
||||||
|
|
||||||
this.fundingQortAmount(txnReq.fundingQortAmount);
|
|
||||||
|
|
||||||
this.foreignBlockchain(txnReq.foreignBlockchain);
|
|
||||||
|
|
||||||
this.foreignAmount(txnReq.foreignAmount);
|
|
||||||
|
|
||||||
this.tradeTimeout(txnReq.tradeTimeout);
|
|
||||||
|
|
||||||
this.receivingAddress(txnReq.receivingAddress);
|
|
||||||
|
|
||||||
return this.txnRequest();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
creatorPublicKey(creatorPublicKey) {
|
creatorPublicKey(creatorPublicKey) {
|
||||||
|
this._creatorPublicKey = creatorPublicKey
|
||||||
this._creatorPublicKey = creatorPublicKey;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qortAmount(qortAmount) {
|
qortAmount(qortAmount) {
|
||||||
this._qortAmount = qortAmount;
|
this._qortAmount = qortAmount
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fundingQortAmount(fundingQortAmount) {
|
fundingQortAmount(fundingQortAmount) {
|
||||||
|
this._fundingQortAmount = fundingQortAmount
|
||||||
this._fundingQortAmount = fundingQortAmount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreignBlockchain(foreignBlockchain) {
|
foreignBlockchain(foreignBlockchain) {
|
||||||
|
this._foreignBlockchain = foreignBlockchain
|
||||||
this._foreignBlockchain = foreignBlockchain;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreignAmount(foreignAmount) {
|
foreignAmount(foreignAmount) {
|
||||||
|
this._foreignAmount = foreignAmount
|
||||||
this._foreignAmount = foreignAmount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tradeTimeout(tradeTimeout) {
|
tradeTimeout(tradeTimeout) {
|
||||||
|
this._tradeTimeout = tradeTimeout
|
||||||
this._tradeTimeout = tradeTimeout;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
receivingAddress(receivingAddress) {
|
receivingAddress(receivingAddress) {
|
||||||
|
this._receivingAddress = receivingAddress
|
||||||
this._receivingAddress = receivingAddress;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
txnRequest() {
|
txnRequest() {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
creatorPublicKey: this._creatorPublicKey,
|
creatorPublicKey: this._creatorPublicKey,
|
||||||
qortAmount: this._qortAmount,
|
qortAmount: this._qortAmount,
|
||||||
|
@ -10,18 +10,14 @@ export default class TradeBotRespondRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createTransaction(txnReq) {
|
createTransaction(txnReq) {
|
||||||
|
|
||||||
this.atAddress(txnReq.atAddress)
|
this.atAddress(txnReq.atAddress)
|
||||||
|
|
||||||
this.foreignKey(txnReq.foreignKey)
|
this.foreignKey(txnReq.foreignKey)
|
||||||
|
|
||||||
this.receivingAddress(txnReq.receivingAddress)
|
this.receivingAddress(txnReq.receivingAddress)
|
||||||
|
|
||||||
return this.txnRequest()
|
return this.txnRequest()
|
||||||
}
|
}
|
||||||
|
|
||||||
atAddress(atAddress) {
|
atAddress(atAddress) {
|
||||||
|
|
||||||
this._atAddress = atAddress
|
this._atAddress = atAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,12 +26,10 @@ export default class TradeBotRespondRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
receivingAddress(receivingAddress) {
|
receivingAddress(receivingAddress) {
|
||||||
|
|
||||||
this._receivingAddress = receivingAddress
|
this._receivingAddress = receivingAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
txnRequest() {
|
txnRequest() {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
atAddress: this._atAddress,
|
atAddress: this._atAddress,
|
||||||
foreignKey: this._foreignKey,
|
foreignKey: this._foreignKey,
|
||||||
|
@ -2,9 +2,7 @@ import Base58 from '../../../deps/Base58.js'
|
|||||||
import nacl from '../../../deps/nacl-fast.js'
|
import nacl from '../../../deps/nacl-fast.js'
|
||||||
import utils from '../../../deps/utils.js'
|
import utils from '../../../deps/utils.js'
|
||||||
|
|
||||||
|
|
||||||
const signTradeBotTransaction = (unsignedTxn, keyPair) => {
|
const signTradeBotTransaction = (unsignedTxn, keyPair) => {
|
||||||
|
|
||||||
if (!unsignedTxn) {
|
if (!unsignedTxn) {
|
||||||
throw new Error('Unsigned Transaction Bytes not defined')
|
throw new Error('Unsigned Transaction Bytes not defined')
|
||||||
}
|
}
|
||||||
@ -16,19 +14,14 @@ const signTradeBotTransaction = (unsignedTxn, keyPair) => {
|
|||||||
const txnBuffer = Base58.decode(unsignedTxn)
|
const txnBuffer = Base58.decode(unsignedTxn)
|
||||||
|
|
||||||
if (keyPair.privateKey.length === undefined) {
|
if (keyPair.privateKey.length === undefined) {
|
||||||
|
const _privateKey = Object.keys(keyPair.privateKey).map(function (key) { return keyPair.privateKey[key]; })
|
||||||
const _privateKey = Object.keys(keyPair.privateKey).map(function (key) { return keyPair.privateKey[key]; });
|
|
||||||
const privateKey = new Uint8Array(_privateKey)
|
const privateKey = new Uint8Array(_privateKey)
|
||||||
|
|
||||||
const signature = nacl.sign.detached(txnBuffer, privateKey)
|
const signature = nacl.sign.detached(txnBuffer, privateKey)
|
||||||
|
|
||||||
const signedBytes = utils.appendBuffer(txnBuffer, signature)
|
const signedBytes = utils.appendBuffer(txnBuffer, signature)
|
||||||
|
|
||||||
return signedBytes
|
return signedBytes
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
const signature = nacl.sign.detached(txnBuffer, keyPair.privateKey)
|
const signature = nacl.sign.detached(txnBuffer, keyPair.privateKey)
|
||||||
|
|
||||||
const signedBytes = utils.appendBuffer(txnBuffer, signature)
|
const signedBytes = utils.appendBuffer(txnBuffer, signature)
|
||||||
|
|
||||||
return signedBytes
|
return signedBytes
|
||||||
|
@ -10,27 +10,21 @@ export default class DeleteTradeOffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createTransaction(txnReq) {
|
createTransaction(txnReq) {
|
||||||
|
|
||||||
this.creatorPublicKey(txnReq.creatorPublicKey)
|
this.creatorPublicKey(txnReq.creatorPublicKey)
|
||||||
|
|
||||||
this.atAddress(txnReq.atAddress)
|
this.atAddress(txnReq.atAddress)
|
||||||
|
|
||||||
return this.txnRequest()
|
return this.txnRequest()
|
||||||
}
|
}
|
||||||
|
|
||||||
creatorPublicKey(creatorPublicKey) {
|
creatorPublicKey(creatorPublicKey) {
|
||||||
|
|
||||||
this._creatorPublicKey = creatorPublicKey
|
this._creatorPublicKey = creatorPublicKey
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
atAddress(atAddress) {
|
atAddress(atAddress) {
|
||||||
|
|
||||||
this._atAddress = atAddress
|
this._atAddress = atAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
txnRequest() {
|
txnRequest() {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
creatorPublicKey: this._creatorPublicKey,
|
creatorPublicKey: this._creatorPublicKey,
|
||||||
atAddress: this._atAddress
|
atAddress: this._atAddress
|
||||||
|
@ -1,24 +1,25 @@
|
|||||||
import { request } from '../../../fetch-request.js'
|
import { request } from '../../../fetch-request.js'
|
||||||
import { deleteTradeOffer, signTradeBotTxn } from '../../../tradeRequest.js';
|
import { deleteTradeOffer, signTradeBotTxn } from '../../../tradeRequest.js'
|
||||||
import { processTransaction } from '../../../createTransaction.js'
|
import { processTransaction } from '../../../createTransaction.js'
|
||||||
|
|
||||||
export const cancelAllOffers = async (requestObject) => {
|
export const cancelAllOffers = async (requestObject) => {
|
||||||
const keyPair = requestObject.keyPair;
|
const keyPair = requestObject.keyPair
|
||||||
const publicKey = requestObject.base58PublicKey;
|
const publicKey = requestObject.base58PublicKey
|
||||||
const address = requestObject.address;
|
const address = requestObject.address
|
||||||
|
|
||||||
const getMyOpenOffers = async () => {
|
const getMyOpenOffers = async () => {
|
||||||
const res = await request('/crosschain/tradeoffers');
|
const res = await request('/crosschain/tradeoffers')
|
||||||
const myOpenTradeOrders = await res.filter(order => order.mode === "OFFERING" && order.qortalCreator === address);
|
const myOpenTradeOrders = await res.filter(order => order.mode === "OFFERING" && order.qortalCreator === address)
|
||||||
return myOpenTradeOrders;
|
return myOpenTradeOrders
|
||||||
}
|
}
|
||||||
|
|
||||||
const myOpenOffers = await getMyOpenOffers();
|
const myOpenOffers = await getMyOpenOffers()
|
||||||
let response = true;
|
let response = true
|
||||||
myOpenOffers.forEach( async (openOffer) => {
|
|
||||||
let unsignedTxn = await deleteTradeOffer({ creatorPublicKey: publicKey, atAddress: openOffer.qortalAtAddress });
|
myOpenOffers.forEach(async (openOffer) => {
|
||||||
let signedTxnBytes = await signTradeBotTxn(unsignedTxn, keyPair);
|
let unsignedTxn = await deleteTradeOffer({ creatorPublicKey: publicKey, atAddress: openOffer.qortalAtAddress })
|
||||||
await processTransaction(signedTxnBytes);
|
let signedTxnBytes = await signTradeBotTxn(unsignedTxn, keyPair)
|
||||||
});
|
await processTransaction(signedTxnBytes)
|
||||||
|
})
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
import publicKeyToAddress from './publicKeyToAddress'
|
import publicKeyToAddress from './publicKeyToAddress'
|
||||||
import Base58 from '../deps/Base58.js'
|
import Base58 from '../deps/Base58.js'
|
||||||
|
|
||||||
|
|
||||||
export const base58PublicKeyToAddress = (base58pubkey, qora = false) => {
|
export const base58PublicKeyToAddress = (base58pubkey, qora = false) => {
|
||||||
const decodePubKey = Base58.decode(base58pubkey)
|
const decodePubKey = Base58.decode(base58pubkey)
|
||||||
|
|
||||||
const address = publicKeyToAddress(decodePubKey, qora)
|
const address = publicKeyToAddress(decodePubKey, qora)
|
||||||
|
|
||||||
return address
|
return address
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
import RIPEMD160 from '../deps/ripemd160.js'
|
|
||||||
import BROKEN_RIPEMD160 from '../deps/broken-ripemd160.js'
|
|
||||||
import { Sha256 } from 'asmcrypto.js'
|
|
||||||
|
|
||||||
import utils from '../deps/utils.js'
|
|
||||||
import Base58 from '../deps/Base58.js'
|
import Base58 from '../deps/Base58.js'
|
||||||
import { Buffer } from 'buffer'
|
import BROKEN_RIPEMD160 from '../deps/broken-ripemd160.js'
|
||||||
|
import RIPEMD160 from '../deps/ripemd160.js'
|
||||||
|
import utils from '../deps/utils.js'
|
||||||
import { ADDRESS_VERSION } from '../constants.js'
|
import { ADDRESS_VERSION } from '../constants.js'
|
||||||
|
import { Buffer } from 'buffer'
|
||||||
|
import { Sha256 } from 'asmcrypto.js'
|
||||||
|
|
||||||
const repeatSHA256 = (passphrase, hashes) => {
|
const repeatSHA256 = (passphrase, hashes) => {
|
||||||
let hash = passphrase
|
let hash = passphrase
|
||||||
@ -19,8 +17,8 @@ const repeatSHA256 = (passphrase, hashes) => {
|
|||||||
const publicKeyToAddress = (publicKey, qora = false) => {
|
const publicKeyToAddress = (publicKey, qora = false) => {
|
||||||
const publicKeySha256 = new Sha256().process(publicKey).finish().result
|
const publicKeySha256 = new Sha256().process(publicKey).finish().result
|
||||||
const _publicKeyHash = qora ? new BROKEN_RIPEMD160().digest(publicKeySha256) : new RIPEMD160().update(Buffer.from(publicKeySha256)).digest('hex')
|
const _publicKeyHash = qora ? new BROKEN_RIPEMD160().digest(publicKeySha256) : new RIPEMD160().update(Buffer.from(publicKeySha256)).digest('hex')
|
||||||
|
|
||||||
const publicKeyHash = qora ? _publicKeyHash : _publicKeyHash
|
const publicKeyHash = qora ? _publicKeyHash : _publicKeyHash
|
||||||
|
|
||||||
let address = new Uint8Array()
|
let address = new Uint8Array()
|
||||||
|
|
||||||
address = utils.appendBuffer(address, [ADDRESS_VERSION])
|
address = utils.appendBuffer(address, [ADDRESS_VERSION])
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user