@cityofzion/bs-ethereum 2.7.10 → 2.8.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.
|
@@ -8,4 +8,6 @@ export declare class BlockscoutESEthereum implements ExplorerService {
|
|
|
8
8
|
buildTransactionUrl(hash: string): string;
|
|
9
9
|
buildContractUrl(contractHash: string): string;
|
|
10
10
|
buildNftUrl(params: BuildNftUrlParams): string;
|
|
11
|
+
getAddressTemplateUrl(): string | undefined;
|
|
12
|
+
getTxTemplateUrl(): string | undefined;
|
|
11
13
|
}
|
|
@@ -42,6 +42,18 @@ class BlockscoutESEthereum {
|
|
|
42
42
|
const baseURL = BlockscoutESEthereum.BASE_URL_BY_CHAIN_ID[__classPrivateFieldGet(this, _BlockscoutESEthereum_network, "f").id];
|
|
43
43
|
return `${baseURL}/token/${params.contractHash}/instance/${params.tokenId}`;
|
|
44
44
|
}
|
|
45
|
+
getAddressTemplateUrl() {
|
|
46
|
+
if (!BlockscoutESEthereum.isSupported(__classPrivateFieldGet(this, _BlockscoutESEthereum_network, "f")))
|
|
47
|
+
return undefined;
|
|
48
|
+
const baseUrl = BlockscoutESEthereum.BASE_URL_BY_CHAIN_ID[__classPrivateFieldGet(this, _BlockscoutESEthereum_network, "f").id];
|
|
49
|
+
return `${baseUrl}/address/{address}`;
|
|
50
|
+
}
|
|
51
|
+
getTxTemplateUrl() {
|
|
52
|
+
if (!BlockscoutESEthereum.isSupported(__classPrivateFieldGet(this, _BlockscoutESEthereum_network, "f")))
|
|
53
|
+
return undefined;
|
|
54
|
+
const baseUrl = BlockscoutESEthereum.BASE_URL_BY_CHAIN_ID[__classPrivateFieldGet(this, _BlockscoutESEthereum_network, "f").id];
|
|
55
|
+
return `${baseUrl}/tx/{txId}`;
|
|
56
|
+
}
|
|
45
57
|
}
|
|
46
58
|
exports.BlockscoutESEthereum = BlockscoutESEthereum;
|
|
47
59
|
_BlockscoutESEthereum_network = new WeakMap();
|
|
@@ -72,7 +72,7 @@ class EthersLedgerSigner extends ethers_1.Signer {
|
|
|
72
72
|
}
|
|
73
73
|
getAddress() {
|
|
74
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
const { address } = yield __classPrivateFieldGet(this, _EthersLedgerSigner_ledgerApp, "f").getAddress(__classPrivateFieldGet(this, _EthersLedgerSigner_bip44Path, "f"));
|
|
75
|
+
const { address } = yield BSEthereumHelper_1.BSEthereumHelper.retry(() => __classPrivateFieldGet(this, _EthersLedgerSigner_ledgerApp, "f").getAddress(__classPrivateFieldGet(this, _EthersLedgerSigner_bip44Path, "f")));
|
|
76
76
|
return address;
|
|
77
77
|
});
|
|
78
78
|
}
|
|
@@ -98,32 +98,25 @@ class EthersLedgerSigner extends ethers_1.Signer {
|
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
signTransaction(transaction) {
|
|
101
|
-
var _a, _b, _c
|
|
101
|
+
var _a, _b, _c;
|
|
102
102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
103
103
|
try {
|
|
104
104
|
const tx = yield ethers_1.ethers.utils.resolveProperties(transaction);
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
gasLimit: (_c = tx.gasLimit) !== null && _c !== void 0 ? _c : undefined,
|
|
109
|
-
gasPrice: (_d = tx.gasPrice) !== null && _d !== void 0 ? _d : undefined,
|
|
110
|
-
nonce: tx.nonce ? ethers_1.ethers.BigNumber.from(tx.nonce).toNumber() : undefined,
|
|
111
|
-
to: (_e = tx.to) !== null && _e !== void 0 ? _e : undefined,
|
|
112
|
-
value: (_f = tx.value) !== null && _f !== void 0 ? _f : undefined,
|
|
113
|
-
};
|
|
114
|
-
const serializedUnsignedTransaction = ethers_1.ethers.utils.serializeTransaction(unsignedTransaction).substring(2);
|
|
105
|
+
const serializedUnsignedTransaction = ethers_1.ethers.utils
|
|
106
|
+
.serializeTransaction(tx)
|
|
107
|
+
.substring(2);
|
|
115
108
|
const resolution = yield hw_app_eth_1.ledgerService.resolveTransaction(serializedUnsignedTransaction, {}, {});
|
|
116
|
-
(
|
|
109
|
+
(_a = __classPrivateFieldGet(this, _EthersLedgerSigner_emitter, "f")) === null || _a === void 0 ? void 0 : _a.emit('getSignatureStart');
|
|
117
110
|
const signature = yield BSEthereumHelper_1.BSEthereumHelper.retry(() => __classPrivateFieldGet(this, _EthersLedgerSigner_ledgerApp, "f").signTransaction(__classPrivateFieldGet(this, _EthersLedgerSigner_bip44Path, "f"), serializedUnsignedTransaction, resolution));
|
|
118
|
-
(
|
|
119
|
-
return ethers_1.ethers.utils.serializeTransaction(
|
|
111
|
+
(_b = __classPrivateFieldGet(this, _EthersLedgerSigner_emitter, "f")) === null || _b === void 0 ? void 0 : _b.emit('getSignatureEnd');
|
|
112
|
+
return ethers_1.ethers.utils.serializeTransaction(tx, {
|
|
120
113
|
v: ethers_1.ethers.BigNumber.from('0x' + signature.v).toNumber(),
|
|
121
114
|
r: '0x' + signature.r,
|
|
122
115
|
s: '0x' + signature.s,
|
|
123
116
|
});
|
|
124
117
|
}
|
|
125
118
|
catch (error) {
|
|
126
|
-
(
|
|
119
|
+
(_c = __classPrivateFieldGet(this, _EthersLedgerSigner_emitter, "f")) === null || _c === void 0 ? void 0 : _c.emit('getSignatureEnd');
|
|
127
120
|
throw error;
|
|
128
121
|
}
|
|
129
122
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-ethereum",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"repository": "https://github.com/CityOfZion/blockchain-services",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@ledgerhq/hw-app-eth": "~6.35.7",
|
|
21
21
|
"@ethersproject/abstract-signer": "~5.7.0",
|
|
22
22
|
"@ethersproject/properties": "~5.7.0",
|
|
23
|
-
"@cityofzion/blockchain-service": "1.13.
|
|
23
|
+
"@cityofzion/blockchain-service": "1.13.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@ledgerhq/hw-transport-node-hid": "~6.28.5",
|