Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This is part of PROKEY HARDWARE WALLET project
* Copyright (C) Prokey.io
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
Expand All @@ -17,7 +17,7 @@
*/

import { ProkeyBaseBlockChain } from "../ProkeyBaseBlockChain";
import { RippleAccountInfo, RippleFee, RippleTransactionDataInfo } from "./RippleModel";
import { RippleAccount, RippleFee, RippleTransactionDataInfo } from "./RippleModel";
import {RequestAddressInfo} from "../../../../../models/GenericWalletModel";
import * as Utils from '../../../../../utils/utils';

Expand All @@ -36,10 +36,10 @@ export class ProkeyRippleBlockchain extends ProkeyBaseBlockChain {
* @param reqAddress Address
* @returns Ripple account info
*/
public async GetAddressInfo(reqAddress: RequestAddressInfo): Promise<RippleAccountInfo | null>
{
public async GetAddressInfo(reqAddress: RequestAddressInfo): Promise<RippleAccount | null>
{
try {
return await this.GetFromServer<RippleAccountInfo>(`address/${this._coinName}/${reqAddress.address}`);
return await this.GetFromServer<RippleAccount>(`address/${this._coinName}/${reqAddress.address}`);
} catch (error) {
return null;
}
Expand Down Expand Up @@ -72,7 +72,7 @@ export class ProkeyRippleBlockchain extends ProkeyBaseBlockChain {
/**
* Broadcasting the transaction
* @param data Signed data to be broadcasted to network
* @returns
* @returns
*/
public async BroadCastTransaction(data: string): Promise<any> {
let data_any = data as any;
Expand All @@ -92,4 +92,4 @@ export class ProkeyRippleBlockchain extends ProkeyBaseBlockChain {
private async SendTransaction(data: string): Promise<any> {
return await this.GetFromServer<any>(`Transaction/send/${this._coinName}/${data}`);
}
}
}
18 changes: 9 additions & 9 deletions src/blockchain/servers/prokey/src/ripple/RippleModel.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This is part of PROKEY HARDWARE WALLET project
* Copyright (C) Prokey.io
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
Expand All @@ -18,15 +18,15 @@

import { AddressModel } from "../../../../../models/Prokey";

export interface RippleAccountInfo
export interface RippleAccount
{
Account: string,
AccountTxnID?: string,
Balance?: string,
Domain?: null,
EmailHash?: null,
MessageKey?: null,
RegularKey?: null,
Domain?: string,
EmailHash?: string,
MessageKey?: string,
RegularKey?: string,
OwnerCount: number,
PreviousTxnID: string,
PreviousTxnLgrSeq: number,
Expand Down Expand Up @@ -62,15 +62,15 @@ export interface RippleTransactionDataInfo
validated: boolean
}

export interface RippleDrop
export interface RippleDrop
{
base_fee: string,
median_fee: string,
minimum_fee: string,
open_ledger_fee: string
}

export interface RippleFee
export interface RippleFee
{
current_ledger_size: string,
current_queue_size: string,
Expand All @@ -81,4 +81,4 @@ export interface RippleFee
max_queue_size: string,
status: string,
validated: boolean
}
}
11 changes: 5 additions & 6 deletions src/models/BitcoinWalletModel.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This is part of PROKEY HARDWARE WALLET project
* Copyright (C) Prokey.io
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
Expand All @@ -17,6 +17,7 @@
*/

import { AddressModel } from "./Prokey";
import {BaseAccountInfoModel} from "./GeneralModels";

/**
* For account discovery, BitcoinAccountAddressReq should be used as starting point
Expand All @@ -27,7 +28,7 @@ export interface BitcoinDiscoveryWalletReq {
path?: Array<number> | string,
publicKey?: string,
pubkeyIndex?: number,
isGetUtxo?: boolean,
isGetUtxo?: boolean,
}

/**
Expand All @@ -43,12 +44,10 @@ export interface BitcoinWalletModel {
/**
* Each wallet contains a list of accounts
* Most of the times there are just one account
*
*
* Result of account discovery is total account balance and list of Addresses with all info
*/
export interface BitcoinAccountInfo {
balance: number,
accountIndex: number,
export interface BitcoinAccountInfo extends BaseAccountInfoModel{
isDiscoveryFinished: boolean,
addresses: Array<BitcoinAddressInfo>,
changeAddresses: Array<BitcoinAddressInfo>,
Expand Down
13 changes: 6 additions & 7 deletions src/models/EthereumWalletModel.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This is part of PROKEY HARDWARE WALLET project
* Copyright (C) Prokey.io
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
Expand All @@ -17,6 +17,7 @@
*/

import { AddressModel } from "./Prokey";
import {BaseAccountInfoModel} from "./GeneralModels";


export interface EthereumAddressInfo {
Expand All @@ -40,12 +41,10 @@ export interface EthereumWalletModel {
/**
* Each wallet contains a list of accounts
* Most of the times there is just one account
*
*
* Result of account discovery is total account balance and list of Addresses with all info
*/
export interface EthereumAccountInfo {
balance: number,
accountIndex: number,
export interface EthereumAccountInfo extends BaseAccountInfoModel {
nonce?: number,
addressModel?: AddressModel,
transactions?: Array<EthereumTransaction>,
Expand All @@ -61,7 +60,7 @@ export interface EthereumTransaction {
gasPrice?: number,
block?: number,
nonce?: number,

//! ERC20
logIndex?: number,
}
Expand All @@ -75,4 +74,4 @@ export interface EthereumTransaction {
received?: string,
sent?: string,
fee?: number,
}
}
9 changes: 9 additions & 0 deletions src/models/GeneralModels.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export interface BaseWalletModel<T extends BaseAccountInfoModel> {
totalBalance: number,
accounts?: Array<T>,
}

export interface BaseAccountInfoModel {
balance: number,
accountIndex: number
}
11 changes: 5 additions & 6 deletions src/models/OmniWalletModel.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* This is part of PROKEY HARDWARE WALLET project
* Copyright (C) Prokey.io
*
*
* Hadi Robati, hadi@prokey.io
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
Expand All @@ -19,6 +19,7 @@
*/

import { AddressModel } from "./Prokey";
import {BaseAccountInfoModel} from "./GeneralModels";

/**
* This is the result of account discovery
Expand All @@ -30,9 +31,7 @@ export interface OmniWalletModel {
accounts?: Array<OmniAccountInfo>,
}

export interface OmniAccountInfo {
balance: number,
accountIndex: number,
export interface OmniAccountInfo extends BaseAccountInfoModel {
addressModel?: AddressModel,
trKeys?: Array<number>
}
Expand Down Expand Up @@ -66,4 +65,4 @@ export interface OmniTxInfo {
valid: boolean,
invalidReason?: string,
timeStamp: number,
}
}
23 changes: 23 additions & 0 deletions src/models/RippleWalletModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import {AddressModel} from "./Prokey";
import {BaseAccountInfoModel} from "./GeneralModels";

export interface RippleAccountInfo extends BaseAccountInfoModel
{
Account: string,
AccountTxnID?: string,
Domain?: string,
EmailHash?: string,
MessageKey?: string,
RegularKey?: string,
OwnerCount: number,
PreviousTxnID: string,
PreviousTxnLgrSeq: number,
Sequence: number,
TickSize: number,
TransferRate: number,
LedgerEntryType: string,
Flags: number,
index: string,

addressModel?: AddressModel,
}
Loading