@cityofzion/bs-solana 2.0.11 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BSSolana.d.ts +1 -1
- package/dist/BSSolana.js +3 -13
- package/dist/helpers/BSSolanaHelper.d.ts +0 -2
- package/dist/helpers/BSSolanaHelper.js +0 -6
- package/dist/services/blockchain-data/TatumRpcBDSSolana.d.ts +5 -7
- package/dist/services/blockchain-data/TatumRpcBDSSolana.js +79 -30
- package/dist/services/ledger/Web3LedgerServiceSolana.js +2 -3
- package/package.json +8 -7
package/dist/BSSolana.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare class BSSolana<N extends string = string> implements IBSSolana<N>
|
|
|
16
16
|
readonly defaultNetwork: TBSNetwork<TBSSolanaNetworkId>;
|
|
17
17
|
ledgerService: Web3LedgerServiceSolana<N>;
|
|
18
18
|
exchangeDataService: IExchangeDataService;
|
|
19
|
-
blockchainDataService: IBlockchainDataService
|
|
19
|
+
blockchainDataService: IBlockchainDataService<N>;
|
|
20
20
|
nftDataService: INftDataService;
|
|
21
21
|
explorerService: IExplorerService;
|
|
22
22
|
tokenService: ITokenService;
|
package/dist/BSSolana.js
CHANGED
|
@@ -181,17 +181,9 @@ class BSSolana {
|
|
|
181
181
|
}
|
|
182
182
|
transfer(param) {
|
|
183
183
|
return __awaiter(this, void 0, void 0, function* () {
|
|
184
|
-
const { transaction
|
|
184
|
+
const { transaction } = yield __classPrivateFieldGet(this, _BSSolana_instances, "m", _BSSolana_buildTransferParams).call(this, param);
|
|
185
185
|
const signedTransaction = yield __classPrivateFieldGet(this, _BSSolana_instances, "m", _BSSolana_signTransaction).call(this, transaction, param.senderAccount);
|
|
186
186
|
const signature = yield __classPrivateFieldGet(this, _BSSolana_connection, "f").sendRawTransaction(signedTransaction);
|
|
187
|
-
const status = yield __classPrivateFieldGet(this, _BSSolana_connection, "f").confirmTransaction({
|
|
188
|
-
blockhash: latestBlockhash.blockhash,
|
|
189
|
-
lastValidBlockHeight: latestBlockhash.lastValidBlockHeight,
|
|
190
|
-
signature,
|
|
191
|
-
});
|
|
192
|
-
if (status.value.err) {
|
|
193
|
-
throw new Error('Transaction failed: ' + status.value.err);
|
|
194
|
-
}
|
|
195
187
|
return [signature];
|
|
196
188
|
});
|
|
197
189
|
}
|
|
@@ -245,7 +237,6 @@ _BSSolana_connection = new WeakMap(), _BSSolana_instances = new WeakSet(), _BSSo
|
|
|
245
237
|
});
|
|
246
238
|
}, _BSSolana_buildTransferParams = function _BSSolana_buildTransferParams(param) {
|
|
247
239
|
return __awaiter(this, void 0, void 0, function* () {
|
|
248
|
-
var _a;
|
|
249
240
|
const latestBlockhash = yield __classPrivateFieldGet(this, _BSSolana_connection, "f").getLatestBlockhash();
|
|
250
241
|
const senderPublicKey = new web3_js_1.default.PublicKey(param.senderAccount.address);
|
|
251
242
|
const transaction = new web3_js_1.default.Transaction();
|
|
@@ -254,9 +245,9 @@ _BSSolana_connection = new WeakMap(), _BSSolana_instances = new WeakSet(), _BSSo
|
|
|
254
245
|
transaction.lastValidBlockHeight = latestBlockhash.lastValidBlockHeight;
|
|
255
246
|
for (const intent of param.intents) {
|
|
256
247
|
const amountBn = blockchain_service_1.BSBigNumberHelper.fromNumber(intent.amount);
|
|
257
|
-
const amount = Number(blockchain_service_1.BSBigNumberHelper.toDecimals(amountBn,
|
|
248
|
+
const amount = Number(blockchain_service_1.BSBigNumberHelper.toDecimals(amountBn, intent.token.decimals));
|
|
258
249
|
const receiverPublicKey = new web3_js_1.default.PublicKey(intent.receiverAddress);
|
|
259
|
-
const normalizedTokenHash = this.tokenService.normalizeHash(intent.
|
|
250
|
+
const normalizedTokenHash = this.tokenService.normalizeHash(intent.token.hash);
|
|
260
251
|
const isNative = normalizedTokenHash === this.tokenService.normalizeHash(BSSolanaConstants_1.BSSolanaConstants.NATIVE_TOKEN.hash);
|
|
261
252
|
if (isNative) {
|
|
262
253
|
transaction.add(web3_js_1.default.SystemProgram.transfer({
|
|
@@ -286,7 +277,6 @@ _BSSolana_connection = new WeakMap(), _BSSolana_instances = new WeakSet(), _BSSo
|
|
|
286
277
|
return {
|
|
287
278
|
transaction,
|
|
288
279
|
senderPublicKey,
|
|
289
|
-
latestBlockhash,
|
|
290
280
|
};
|
|
291
281
|
});
|
|
292
282
|
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { TBSNetwork } from '@cityofzion/blockchain-service';
|
|
2
2
|
import { TBSSolanaNetworkId } from '../types';
|
|
3
3
|
export declare class BSSolanaHelper {
|
|
4
|
-
static fixBip44Path(bip44Path: string): string;
|
|
5
|
-
static getBip44Path(path: string, index: number): string;
|
|
6
4
|
static isMainnetNetwork(network: TBSNetwork<TBSSolanaNetworkId>): boolean;
|
|
7
5
|
}
|
|
@@ -3,12 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BSSolanaHelper = void 0;
|
|
4
4
|
const BSSolanaConstants_1 = require("../constants/BSSolanaConstants");
|
|
5
5
|
class BSSolanaHelper {
|
|
6
|
-
static fixBip44Path(bip44Path) {
|
|
7
|
-
return bip44Path.replace('m/', '');
|
|
8
|
-
}
|
|
9
|
-
static getBip44Path(path, index) {
|
|
10
|
-
return this.fixBip44Path(path.replace('?', index.toString()));
|
|
11
|
-
}
|
|
12
6
|
static isMainnetNetwork(network) {
|
|
13
7
|
return BSSolanaConstants_1.BSSolanaConstants.MAINNET_NETWORK.id === network.id && network.type === 'mainnet';
|
|
14
8
|
}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import { TBalanceResponse,
|
|
1
|
+
import { TBalanceResponse, IBlockchainDataService, TBSNetwork, TBSToken, type TContractResponse, type TTransaction, type TGetTransactionsByAddressParams, type TGetTransactionsByAddressResponse } from '@cityofzion/blockchain-service';
|
|
2
2
|
import solanaSDK from '@solana/web3.js';
|
|
3
3
|
import { IBSSolana, TBSSolanaNetworkId } from '../../types';
|
|
4
|
-
export declare class TatumRpcBDSSolana<N extends string> implements IBlockchainDataService {
|
|
4
|
+
export declare class TatumRpcBDSSolana<N extends string> implements IBlockchainDataService<N> {
|
|
5
5
|
#private;
|
|
6
6
|
static URL_BY_NETWORK_ID: Record<TBSSolanaNetworkId, string>;
|
|
7
7
|
static getConnection(network: TBSNetwork<TBSSolanaNetworkId>): solanaSDK.Connection;
|
|
8
8
|
readonly maxTimeToConfirmTransactionInMs: number;
|
|
9
9
|
constructor(service: IBSSolana<N>);
|
|
10
|
-
getTransaction(txid: string): Promise<
|
|
11
|
-
getTransactionsByAddress(params:
|
|
12
|
-
|
|
13
|
-
exportFullTransactionsByAddress(_params: TExportTransactionsByAddressParams): Promise<string>;
|
|
14
|
-
getContract(_contractHash: string): Promise<ContractResponse>;
|
|
10
|
+
getTransaction(txid: string): Promise<TTransaction<N>>;
|
|
11
|
+
getTransactionsByAddress(params: TGetTransactionsByAddressParams): Promise<TGetTransactionsByAddressResponse<N>>;
|
|
12
|
+
getContract(_contractHash: string): Promise<TContractResponse>;
|
|
15
13
|
getTokenInfo(tokenHash: string): Promise<TBSToken>;
|
|
16
14
|
getBalance(address: string): Promise<TBalanceResponse[]>;
|
|
17
15
|
getBlockHeight(): Promise<number>;
|
|
@@ -96,30 +96,33 @@ class TatumRpcBDSSolana {
|
|
|
96
96
|
throw new Error('Block time not found');
|
|
97
97
|
if (!transaction.meta)
|
|
98
98
|
throw new Error('Transaction meta not found');
|
|
99
|
-
const
|
|
99
|
+
const events = [];
|
|
100
100
|
const allInstructions = [
|
|
101
101
|
...transaction.transaction.message.instructions,
|
|
102
102
|
...((_b = (_a = transaction.meta.innerInstructions) === null || _a === void 0 ? void 0 : _a.flatMap(item => item.instructions)) !== null && _b !== void 0 ? _b : []),
|
|
103
103
|
].filter((item) => 'parsed' in item);
|
|
104
104
|
for (const instruction of allInstructions) {
|
|
105
105
|
try {
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
transfers.push(transfer);
|
|
106
|
+
const event = yield __classPrivateFieldGet(this, _TatumRpcBDSSolana_instances, "m", _TatumRpcBDSSolana_parseInstruction).call(this, instruction, allInstructions);
|
|
107
|
+
events.push(event);
|
|
109
108
|
}
|
|
110
109
|
catch (_c) {
|
|
111
110
|
/* empty */
|
|
112
111
|
}
|
|
113
112
|
}
|
|
114
|
-
const
|
|
115
|
-
const
|
|
113
|
+
const txTemplateUrl = __classPrivateFieldGet(this, _TatumRpcBDSSolana_service, "f").explorerService.getTxTemplateUrl();
|
|
114
|
+
const txId = transaction.transaction.signatures[0];
|
|
115
|
+
const txIdUrl = txTemplateUrl === null || txTemplateUrl === void 0 ? void 0 : txTemplateUrl.replace('{txId}', txId);
|
|
116
116
|
return {
|
|
117
117
|
block: transaction.slot,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
fee,
|
|
118
|
+
txId: transaction.transaction.signatures[0],
|
|
119
|
+
txIdUrl,
|
|
120
|
+
invocationCount: 0,
|
|
121
|
+
notificationCount: 0,
|
|
122
|
+
networkFeeAmount: blockchain_service_1.BSBigNumberHelper.format(blockchain_service_1.BSBigNumberHelper.fromDecimals(transaction.meta.fee, __classPrivateFieldGet(this, _TatumRpcBDSSolana_service, "f").feeToken.decimals), { decimals: __classPrivateFieldGet(this, _TatumRpcBDSSolana_service, "f").feeToken.decimals }),
|
|
123
|
+
systemFeeAmount: blockchain_service_1.BSBigNumberHelper.format(0, { decimals: __classPrivateFieldGet(this, _TatumRpcBDSSolana_service, "f").feeToken.decimals }),
|
|
124
|
+
date: new Date(transaction.blockTime).toISOString(),
|
|
125
|
+
events,
|
|
123
126
|
type: 'default',
|
|
124
127
|
};
|
|
125
128
|
});
|
|
@@ -144,16 +147,6 @@ class TatumRpcBDSSolana {
|
|
|
144
147
|
};
|
|
145
148
|
});
|
|
146
149
|
}
|
|
147
|
-
getFullTransactionsByAddress(_params) {
|
|
148
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
149
|
-
throw new Error('Method not supported.');
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
exportFullTransactionsByAddress(_params) {
|
|
153
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
-
throw new Error('Method not supported.');
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
150
|
getContract(_contractHash) {
|
|
158
151
|
return __awaiter(this, void 0, void 0, function* () {
|
|
159
152
|
throw new Error('Method not supported.');
|
|
@@ -215,7 +208,7 @@ class TatumRpcBDSSolana {
|
|
|
215
208
|
exports.TatumRpcBDSSolana = TatumRpcBDSSolana;
|
|
216
209
|
_TatumRpcBDSSolana_service = new WeakMap(), _TatumRpcBDSSolana_connection = new WeakMap(), _TatumRpcBDSSolana_functionByProgramIdAndMethod = new WeakMap(), _TatumRpcBDSSolana_instances = new WeakSet(), _TatumRpcBDSSolana_parseSplTransferCheckedInstruction = function _TatumRpcBDSSolana_parseSplTransferCheckedInstruction(instruction, allInstructions) {
|
|
217
210
|
return __awaiter(this, void 0, void 0, function* () {
|
|
218
|
-
var _a;
|
|
211
|
+
var _a, _b;
|
|
219
212
|
const info = instruction.parsed.info;
|
|
220
213
|
if (!info.destination || !info.source || !info.mint) {
|
|
221
214
|
throw new Error('Unsupported instruction format');
|
|
@@ -234,17 +227,34 @@ _TatumRpcBDSSolana_service = new WeakMap(), _TatumRpcBDSSolana_connection = new
|
|
|
234
227
|
if (!fromTokenAddress) {
|
|
235
228
|
throw new Error('From account not found');
|
|
236
229
|
}
|
|
230
|
+
const addressTemplateUrl = __classPrivateFieldGet(this, _TatumRpcBDSSolana_service, "f").explorerService.getAddressTemplateUrl();
|
|
231
|
+
const contractTemplateUrl = __classPrivateFieldGet(this, _TatumRpcBDSSolana_service, "f").explorerService.getContractTemplateUrl();
|
|
232
|
+
const nftTemplateUrl = __classPrivateFieldGet(this, _TatumRpcBDSSolana_service, "f").explorerService.getNftTemplateUrl();
|
|
237
233
|
const from = fromTokenAddress.toBase58();
|
|
234
|
+
const fromUrl = addressTemplateUrl === null || addressTemplateUrl === void 0 ? void 0 : addressTemplateUrl.replace('{address}', from);
|
|
235
|
+
const toUrl = addressTemplateUrl === null || addressTemplateUrl === void 0 ? void 0 : addressTemplateUrl.replace('{address}', to);
|
|
236
|
+
const contractHashUrl = contractTemplateUrl === null || contractTemplateUrl === void 0 ? void 0 : contractTemplateUrl.replace('{hash}', contractHash);
|
|
238
237
|
if ((metaplex === null || metaplex === void 0 ? void 0 : metaplex.model) === 'nft') {
|
|
239
238
|
if (!((_a = metaplex.collection) === null || _a === void 0 ? void 0 : _a.address)) {
|
|
240
239
|
throw new Error('Collection address not found');
|
|
241
240
|
}
|
|
241
|
+
const collectionHash = metaplex.collection.address.toBase58();
|
|
242
|
+
const nftUrl = nftTemplateUrl === null || nftTemplateUrl === void 0 ? void 0 : nftTemplateUrl.replace('{tokenHash}', contractHash).replace('{collectionHash}', contractHash);
|
|
242
243
|
return {
|
|
243
|
-
|
|
244
|
+
eventType: 'nft',
|
|
244
245
|
from,
|
|
246
|
+
fromUrl,
|
|
245
247
|
to,
|
|
248
|
+
toUrl,
|
|
246
249
|
tokenHash: contractHash,
|
|
247
|
-
collectionHash
|
|
250
|
+
collectionHash,
|
|
251
|
+
collectionHashUrl: contractHashUrl,
|
|
252
|
+
methodName: 'transferChecked',
|
|
253
|
+
tokenType: 'spl',
|
|
254
|
+
amount: '1',
|
|
255
|
+
nftImageUrl: (_b = metaplex === null || metaplex === void 0 ? void 0 : metaplex.json) === null || _b === void 0 ? void 0 : _b.image,
|
|
256
|
+
name: metaplex.name,
|
|
257
|
+
nftUrl,
|
|
248
258
|
};
|
|
249
259
|
}
|
|
250
260
|
const token = {
|
|
@@ -256,17 +266,22 @@ _TatumRpcBDSSolana_service = new WeakMap(), _TatumRpcBDSSolana_connection = new
|
|
|
256
266
|
const amountBn = blockchain_service_1.BSBigNumberHelper.fromDecimals(info.tokenAmount.amount, token.decimals);
|
|
257
267
|
const amount = blockchain_service_1.BSBigNumberHelper.toNumber(amountBn);
|
|
258
268
|
return {
|
|
259
|
-
|
|
269
|
+
eventType: 'token',
|
|
260
270
|
amount,
|
|
261
271
|
contractHash,
|
|
272
|
+
contractHashUrl,
|
|
262
273
|
from,
|
|
274
|
+
fromUrl,
|
|
263
275
|
to,
|
|
276
|
+
toUrl,
|
|
264
277
|
token,
|
|
278
|
+
methodName: 'transferChecked',
|
|
279
|
+
tokenType: 'spl',
|
|
265
280
|
};
|
|
266
281
|
});
|
|
267
282
|
}, _TatumRpcBDSSolana_parseSplTransferInstruction = function _TatumRpcBDSSolana_parseSplTransferInstruction(instruction, allInstructions) {
|
|
268
283
|
return __awaiter(this, void 0, void 0, function* () {
|
|
269
|
-
var _a;
|
|
284
|
+
var _a, _b;
|
|
270
285
|
const info = instruction.parsed.info;
|
|
271
286
|
if (!info.destination || !info.source || !info.amount) {
|
|
272
287
|
throw new Error('Unsupported instruction format');
|
|
@@ -295,16 +310,32 @@ _TatumRpcBDSSolana_service = new WeakMap(), _TatumRpcBDSSolana_connection = new
|
|
|
295
310
|
if (!fromTokenAddress) {
|
|
296
311
|
throw new Error('From account not found');
|
|
297
312
|
}
|
|
313
|
+
const addressTemplateUrl = __classPrivateFieldGet(this, _TatumRpcBDSSolana_service, "f").explorerService.getAddressTemplateUrl();
|
|
314
|
+
const contractTemplateUrl = __classPrivateFieldGet(this, _TatumRpcBDSSolana_service, "f").explorerService.getContractTemplateUrl();
|
|
315
|
+
const nftTemplateUrl = __classPrivateFieldGet(this, _TatumRpcBDSSolana_service, "f").explorerService.getNftTemplateUrl();
|
|
298
316
|
const from = fromTokenAddress.toBase58();
|
|
317
|
+
const fromUrl = addressTemplateUrl === null || addressTemplateUrl === void 0 ? void 0 : addressTemplateUrl.replace('{address}', from);
|
|
318
|
+
const toUrl = addressTemplateUrl === null || addressTemplateUrl === void 0 ? void 0 : addressTemplateUrl.replace('{address}', to);
|
|
319
|
+
const contractHashUrl = contractTemplateUrl === null || contractTemplateUrl === void 0 ? void 0 : contractTemplateUrl.replace('{hash}', contractHash);
|
|
299
320
|
if ((metaplex === null || metaplex === void 0 ? void 0 : metaplex.model) === 'nft') {
|
|
300
321
|
if (!((_a = metaplex.collection) === null || _a === void 0 ? void 0 : _a.address)) {
|
|
301
322
|
throw new Error('Collection address not found');
|
|
302
323
|
}
|
|
324
|
+
const nftUrl = nftTemplateUrl === null || nftTemplateUrl === void 0 ? void 0 : nftTemplateUrl.replace('{tokenHash}', contractHash).replace('{collectionHash}', contractHash);
|
|
303
325
|
return {
|
|
304
|
-
|
|
326
|
+
eventType: 'nft',
|
|
305
327
|
from,
|
|
328
|
+
fromUrl,
|
|
306
329
|
to,
|
|
330
|
+
toUrl,
|
|
331
|
+
tokenType: 'spl',
|
|
332
|
+
methodName: 'transfer',
|
|
333
|
+
nftImageUrl: (_b = metaplex === null || metaplex === void 0 ? void 0 : metaplex.json) === null || _b === void 0 ? void 0 : _b.image,
|
|
334
|
+
name: metaplex.name,
|
|
335
|
+
nftUrl,
|
|
307
336
|
collectionHash: metaplex.collection.address.toBase58(),
|
|
337
|
+
collectionHashUrl: contractHashUrl,
|
|
338
|
+
amount: '1',
|
|
308
339
|
tokenHash: contractHash,
|
|
309
340
|
};
|
|
310
341
|
}
|
|
@@ -317,11 +348,16 @@ _TatumRpcBDSSolana_service = new WeakMap(), _TatumRpcBDSSolana_connection = new
|
|
|
317
348
|
const amountBn = blockchain_service_1.BSBigNumberHelper.fromDecimals(info.tokenAmount.amount, token.decimals);
|
|
318
349
|
const amount = blockchain_service_1.BSBigNumberHelper.toNumber(amountBn);
|
|
319
350
|
return {
|
|
320
|
-
|
|
351
|
+
eventType: 'token',
|
|
321
352
|
amount,
|
|
322
353
|
contractHash,
|
|
323
354
|
from,
|
|
355
|
+
fromUrl,
|
|
324
356
|
to,
|
|
357
|
+
toUrl,
|
|
358
|
+
methodName: 'transfer',
|
|
359
|
+
tokenType: 'spl',
|
|
360
|
+
contractHashUrl,
|
|
325
361
|
token,
|
|
326
362
|
};
|
|
327
363
|
});
|
|
@@ -334,12 +370,25 @@ _TatumRpcBDSSolana_service = new WeakMap(), _TatumRpcBDSSolana_connection = new
|
|
|
334
370
|
}
|
|
335
371
|
const amountBn = blockchain_service_1.BSBigNumberHelper.fromDecimals(info.lamports, BSSolanaConstants_1.BSSolanaConstants.NATIVE_TOKEN.decimals);
|
|
336
372
|
const amount = blockchain_service_1.BSBigNumberHelper.toNumber(amountBn);
|
|
373
|
+
const addressTemplateUrl = __classPrivateFieldGet(this, _TatumRpcBDSSolana_service, "f").explorerService.getAddressTemplateUrl();
|
|
374
|
+
const contractTemplateUrl = __classPrivateFieldGet(this, _TatumRpcBDSSolana_service, "f").explorerService.getContractTemplateUrl();
|
|
375
|
+
const from = info.source;
|
|
376
|
+
const to = info.destination;
|
|
377
|
+
const contractHash = BSSolanaConstants_1.BSSolanaConstants.NATIVE_TOKEN.hash;
|
|
378
|
+
const fromUrl = addressTemplateUrl === null || addressTemplateUrl === void 0 ? void 0 : addressTemplateUrl.replace('{address}', from);
|
|
379
|
+
const toUrl = addressTemplateUrl === null || addressTemplateUrl === void 0 ? void 0 : addressTemplateUrl.replace('{address}', to);
|
|
380
|
+
const contractHashUrl = contractTemplateUrl === null || contractTemplateUrl === void 0 ? void 0 : contractTemplateUrl.replace('{hash}', contractHash);
|
|
337
381
|
return {
|
|
338
|
-
|
|
382
|
+
eventType: 'token',
|
|
339
383
|
amount,
|
|
384
|
+
methodName: 'transfer',
|
|
385
|
+
tokenType: 'native',
|
|
340
386
|
from: info.source,
|
|
387
|
+
fromUrl,
|
|
341
388
|
to: info.destination,
|
|
342
|
-
|
|
389
|
+
toUrl,
|
|
390
|
+
contractHash,
|
|
391
|
+
contractHashUrl,
|
|
343
392
|
token: BSSolanaConstants_1.BSSolanaConstants.NATIVE_TOKEN,
|
|
344
393
|
};
|
|
345
394
|
});
|
|
@@ -29,7 +29,6 @@ const blockchain_service_1 = require("@cityofzion/blockchain-service");
|
|
|
29
29
|
const hw_app_solana_1 = __importDefault(require("@ledgerhq/hw-app-solana"));
|
|
30
30
|
const events_1 = __importDefault(require("events"));
|
|
31
31
|
const web3_js_1 = __importDefault(require("@solana/web3.js"));
|
|
32
|
-
const BSSolanaHelper_1 = require("../../helpers/BSSolanaHelper");
|
|
33
32
|
class Web3LedgerServiceSolana {
|
|
34
33
|
constructor(blockchainService, getLedgerTransport) {
|
|
35
34
|
_Web3LedgerServiceSolana_service.set(this, void 0);
|
|
@@ -49,7 +48,7 @@ class Web3LedgerServiceSolana {
|
|
|
49
48
|
getAccount(transport, index) {
|
|
50
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
50
|
const ledgerApp = new hw_app_solana_1.default(transport);
|
|
52
|
-
const bip44Path =
|
|
51
|
+
const bip44Path = blockchain_service_1.BSKeychainHelper.getBip44Path(blockchain_service_1.BSKeychainHelper.fixBip44Path(__classPrivateFieldGet(this, _Web3LedgerServiceSolana_service, "f").bip44DerivationPath), index);
|
|
53
52
|
const publicKey = yield blockchain_service_1.BSUtilsHelper.retry(() => __awaiter(this, void 0, void 0, function* () {
|
|
54
53
|
const response = yield ledgerApp.getAddress(bip44Path);
|
|
55
54
|
return new web3_js_1.default.PublicKey(response.address);
|
|
@@ -73,7 +72,7 @@ class Web3LedgerServiceSolana {
|
|
|
73
72
|
const ledgerApp = new hw_app_solana_1.default(transport);
|
|
74
73
|
const serializedTransaction = transaction.compileMessage().serialize();
|
|
75
74
|
(_a = this.emitter) === null || _a === void 0 ? void 0 : _a.emit('getSignatureStart');
|
|
76
|
-
const bip44Path =
|
|
75
|
+
const bip44Path = blockchain_service_1.BSKeychainHelper.fixBip44Path(account.bip44Path);
|
|
77
76
|
const { signature } = yield ledgerApp.signTransaction(bip44Path, serializedTransaction);
|
|
78
77
|
(_b = this.emitter) === null || _b === void 0 ? void 0 : _b.emit('getSignatureEnd');
|
|
79
78
|
transaction.addSignature(new web3_js_1.default.PublicKey(account.address), signature);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-solana",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"repository": "https://github.com/CityOfZion/blockchain-services",
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
"bs58": "~6.0.0",
|
|
18
18
|
"@solana/spl-token": "~0.4.14",
|
|
19
19
|
"@bonfida/spl-name-service": "~3.0.16",
|
|
20
|
-
"@ledgerhq/hw-app-solana": "~7.
|
|
21
|
-
"@ledgerhq/hw-transport": "~6.
|
|
20
|
+
"@ledgerhq/hw-app-solana": "~7.7.0",
|
|
21
|
+
"@ledgerhq/hw-transport": "~6.32.0",
|
|
22
22
|
"@metaplex-foundation/js": "~0.20.1",
|
|
23
23
|
"date-fns": "~4.1.0",
|
|
24
|
-
"@cityofzion/blockchain-service": "
|
|
24
|
+
"@cityofzion/blockchain-service": "3.0.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@ledgerhq/hw-transport-node-hid": "~6.
|
|
27
|
+
"@ledgerhq/hw-transport-node-hid": "~6.30.0",
|
|
28
28
|
"@types/jest": "~30.0.0",
|
|
29
29
|
"eslint": "~9.36.0",
|
|
30
30
|
"jest": "~30.1.3",
|
|
@@ -33,10 +33,11 @@
|
|
|
33
33
|
"typescript": "~5.9.2"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
|
-
"build": "rm -rf ./dist && tsc --project tsconfig.build.json",
|
|
36
|
+
"build": "rm -rf ./dist && npm run typecheck && tsc --project tsconfig.build.json",
|
|
37
37
|
"test": "jest -i --config jest.config.ts",
|
|
38
38
|
"lint": "eslint .",
|
|
39
39
|
"format": "eslint --fix",
|
|
40
|
-
"package": "npm run build && npm pack"
|
|
40
|
+
"package": "npm run build && npm pack",
|
|
41
|
+
"typecheck": "tsc --noEmit"
|
|
41
42
|
}
|
|
42
43
|
}
|