Skip to content

Commit a4b8fce

Browse files
committed
fix stellar issues
1 parent 37b4574 commit a4b8fce

File tree

4 files changed

+83
-89
lines changed

4 files changed

+83
-89
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ It is recommended to add this repository main branch to your project as a submod
1616

1717
After adding, you need to run 'npm install' in the root directory of this module in order to install all prerequisites.
1818

19-
## Warning!
19+
## Note
2020
if you get any error about node-gyp or sodium-native. try deleting this two files
2121

2222
C:\Users\{YourUserName}\AppData\Local\node-gyp

data/ProkeyCoinsInfo.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35809,8 +35809,8 @@
3580935809
},
3581035810
{
3581135811
"name": "Stellar Testnet",
35812-
"shortcut": "tXlm",
35813-
"slip44": 148,
35812+
"shortcut": "tXLM",
35813+
"slip44": 1,
3581435814
"decimals": 0,
3581535815
"priority": 100,
3581635816
"on_device": "Stellar Testnet",

src/blockchain/servers/prokey/src/stellar/StellarModels.ts

Lines changed: 77 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,24 @@
1515
*/
1616

1717
export interface StellarFee {
18-
"last_ledger": string,
19-
"last_ledger_base_fee": string,
20-
"ledger_capacity_usage": string,
21-
"min_accepted_fee": string,
22-
"mode_accepted_fee": string,
23-
"p10_accepted_fee": string,
24-
"p20_accepted_fee": string,
25-
"p30_accepted_fee": string,
26-
"p40_accepted_fee": string,
27-
"p50_accepted_fee": string,
28-
"p60_accepted_fee": string,
29-
"p70_accepted_fee": string,
30-
"p80_accepted_fee": string,
31-
"p90_accepted_fee": string,
32-
"p95_accepted_fee": string,
33-
"p99_accepted_fee": string,
34-
"fee_charged": FeeState,
35-
"max_fee": FeeState
18+
last_ledger: string,
19+
last_ledger_base_fee: string,
20+
ledger_capacity_usage: string,
21+
min_accepted_fee: string,
22+
mode_accepted_fee: string,
23+
p10_accepted_fee: string,
24+
p20_accepted_fee: string,
25+
p30_accepted_fee: string,
26+
p40_accepted_fee: string,
27+
p50_accepted_fee: string,
28+
p60_accepted_fee: string,
29+
p70_accepted_fee: string,
30+
p80_accepted_fee: string,
31+
p90_accepted_fee: string,
32+
p95_accepted_fee: string,
33+
p99_accepted_fee: string,
34+
fee_charged: FeeState,
35+
max_fee: FeeState
3636
}
3737

3838
export interface StellarAccountInfo {
@@ -51,84 +51,84 @@ export interface StellarAccountInfo {
5151
}
5252

5353
export interface StellarTransactionResponse {
54-
"transactions": StellarTransaction[],
55-
"nextPageCursor": string,
56-
"prevPageCursor": string
54+
transactions: StellarTransaction[],
55+
nextPageCursor: string,
56+
prevPageCursor: string
5757
}
5858

5959
export interface StellarTransaction {
60-
"hash": string,
61-
"ledger": number,
62-
"created_at": string,
63-
"source_account": string,
64-
"fee_account": string,
65-
"successful": boolean,
66-
"paging_token": string,
67-
"source_account_sequence": number,
68-
"fee_charged": number,
69-
"max_fee": number,
70-
"operation_count": number,
71-
"envelope_xdr": string,
72-
"result_xdr": string,
73-
"result_meta_xdr": string,
74-
"signatures": string[],
75-
"fee_bump_transaction": FeeBumpTransaction,
76-
"inner_transaction": InnerTransaction,
77-
"memo_type": string,
78-
"memo": string,
79-
"memo_bytes": string
60+
hash: string,
61+
ledger: number,
62+
created_at: string,
63+
source_account: string,
64+
fee_account: string,
65+
successful: boolean,
66+
paging_token: string,
67+
source_account_sequence: number,
68+
fee_charged: number,
69+
max_fee: number,
70+
operation_count: number,
71+
envelope_xdr: string,
72+
result_xdr: string,
73+
result_meta_xdr: string,
74+
signatures: string[],
75+
fee_bump_transaction: FeeBumpTransaction,
76+
inner_transaction: InnerTransaction,
77+
memo_type: string,
78+
memo: string,
79+
memo_bytes: string
8080
}
8181

8282
export interface StellarTransactionOperationResponse {
83-
"operations": StellarTransactionOperation[],
84-
"nextPageCursor": string,
85-
"prevPageCursor": string
83+
operations: StellarTransactionOperation[],
84+
nextPageCursor: string,
85+
prevPageCursor: string
8686
}
8787

8888
export interface StellarTransactionOperation {
89-
"id": number,
90-
"source_account": string,
91-
"paging_token": string,
92-
"type": string,
93-
"type_i": number,
94-
"created_at": string,
95-
"transaction_hash": string,
96-
"transaction_successful": boolean
97-
"asset_type": string,
98-
"from": string,
99-
"to": string,
100-
"amount": string,
101-
"name": string,
102-
"value": string,
103-
"funder": string,
104-
"account": string,
105-
"starting_balance": string
89+
id: number,
90+
source_account: string,
91+
paging_token: string,
92+
type: string,
93+
type_i: number,
94+
created_at: string,
95+
transaction_hash: string,
96+
transaction_successful: boolean
97+
asset_type: string,
98+
from: string,
99+
to: string,
100+
amount: string,
101+
name: string,
102+
value: string,
103+
funder: string,
104+
account: string,
105+
starting_balance: string
106106
}
107107

108108
interface FeeState {
109-
"max": string;
110-
"min": string;
111-
"mode": string;
112-
"p10": string;
113-
"p20": string;
114-
"p30": string;
115-
"p40": string;
116-
"p50": string;
117-
"p60": string;
118-
"p70": string;
119-
"p80": string;
120-
"p90": string;
121-
"p95": string;
122-
"p99": string;
109+
max: string;
110+
min: string;
111+
mode: string;
112+
p10: string;
113+
p20: string;
114+
p30: string;
115+
p40: string;
116+
p50: string;
117+
p60: string;
118+
p70: string;
119+
p80: string;
120+
p90: string;
121+
p95: string;
122+
p99: string;
123123
}
124124

125125
export interface FeeBumpTransaction {
126-
"hash": string,
126+
hash: string,
127127
signatures: string[]
128128
}
129129

130130
export interface InnerTransaction {
131-
"hash": string,
131+
hash: string,
132132
signatures: string,
133133
max_fee: number
134134
}

src/device/StellarCommands.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import {
77
PublicKey,
88
StellarAddress,
99
StellarSignedTx,
10-
StellarSignTransactionRequest, StellarTxOpRequest,
10+
StellarSignTransactionRequest,
11+
StellarTxOpRequest,
1112
Success
1213
} from "../models/Prokey";
1314
import {GeneralErrors, GeneralResponse} from "../models/GeneralResponse";
@@ -16,7 +17,6 @@ import * as ProkeyResponses from "../models/Prokey";
1617
import {MyConsole} from "../utils/console";
1718
import {StrKey} from "stellar-base";
1819
import * as Utility from "../utils/utils";
19-
import { ByteArrayToHexString } from "../utils/utils"
2020

2121
export class StellarCommands implements ICoinCommands {
2222
private readonly _coinInfo: StellarCoinInfoModel;
@@ -149,12 +149,6 @@ export class StellarCommands implements ICoinCommands {
149149
* @constructor
150150
*/
151151
public async SignTransaction(device: Device, transactionForSign: StellarSignTransactionRequest): Promise<string> {
152-
var OnFailure = (reason: any) => {
153-
device.RemoveOnFailureCallBack(OnFailure);
154-
155-
throw new Error(`Signing transaction failed: ${reason.message}`);
156-
};
157-
158152
MyConsole.Info("StellarSignTx", transactionForSign);
159153

160154
if (!transactionForSign) {
@@ -203,7 +197,7 @@ export class StellarCommands implements ICoinCommands {
203197
private static async prepareTransactionForBroadcast(transactionForSign: StellarSignTransactionRequest, signResponse: StellarSignedTx) {
204198
let transactionModel = transactionForSign.transactionModel;
205199

206-
let stringSignature = ByteArrayToHexString(signResponse.signature);
200+
let stringSignature = Utility.ByteArrayToHexString(signResponse.signature);
207201
let decodedPublicKey = StrKey.encodeEd25519PublicKey(Buffer.from(signResponse.public_key));
208202
transactionModel.addSignature(
209203
decodedPublicKey,

0 commit comments

Comments
 (0)