@airgap/coinlib-core 0.13.7-beta.2 → 0.13.7-beta.4
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/airgap-coinlib-core.min.js +1413 -815
- package/package.json +1 -1
- package/protocols/ICoinBaseProtocol.d.ts +15 -15
- package/protocols/ICoinSubProtocol.d.ts +3 -3
- package/protocols/aeternity/AeternityProtocol.d.ts +31 -31
- package/protocols/aeternity/AeternityProtocol.js +142 -55
- package/protocols/aeternity/AeternityProtocol.js.map +1 -1
- package/protocols/bitcoin/BitcoinProtocol.d.ts +31 -31
- package/protocols/bitcoin/BitcoinProtocol.js +157 -67
- package/protocols/bitcoin/BitcoinProtocol.js.map +1 -1
- package/protocols/bitcoin/BitcoinSegwitProtocol.d.ts +4 -4
- package/protocols/bitcoin/BitcoinSegwitProtocol.js +15 -15
- package/protocols/bitcoin/BitcoinSegwitProtocol.js.map +1 -1
- package/protocols/bitcoin/BitcoinTestnetProtocol.d.ts +3 -6
- package/protocols/bitcoin/BitcoinTestnetProtocol.js +3 -6
- package/protocols/bitcoin/BitcoinTestnetProtocol.js.map +1 -1
- package/protocols/cosmos/CosmosProtocol.d.ts +29 -29
- package/protocols/cosmos/CosmosProtocol.js +129 -39
- package/protocols/cosmos/CosmosProtocol.js.map +1 -1
- package/protocols/ethereum/BaseEthereumProtocol.d.ts +31 -31
- package/protocols/ethereum/BaseEthereumProtocol.js +148 -58
- package/protocols/ethereum/BaseEthereumProtocol.js.map +1 -1
- package/protocols/ethereum/EthereumProtocol.d.ts +4 -6
- package/protocols/ethereum/EthereumProtocol.js +6 -8
- package/protocols/ethereum/EthereumProtocol.js.map +1 -1
- package/protocols/ethereum/clients/info-clients/EtherscanInfoClient.js +4 -4
- package/protocols/ethereum/clients/info-clients/EtherscanInfoClient.js.map +1 -1
- package/protocols/ethereum/erc20/GenericERC20.d.ts +8 -9
- package/protocols/ethereum/erc20/GenericERC20.js +42 -25
- package/protocols/ethereum/erc20/GenericERC20.js.map +1 -1
- package/protocols/groestlcoin/GroestlcoinProtocol.d.ts +15 -29
- package/protocols/groestlcoin/GroestlcoinProtocol.js +17 -31
- package/protocols/groestlcoin/GroestlcoinProtocol.js.map +1 -1
- package/protocols/substrate/SubstrateDelegateProtocol.js +32 -32
- package/protocols/substrate/SubstrateDelegateProtocol.js.map +1 -1
- package/protocols/substrate/SubstrateProtocol.d.ts +31 -31
- package/protocols/substrate/SubstrateProtocol.js +143 -43
- package/protocols/substrate/SubstrateProtocol.js.map +1 -1
- package/protocols/substrate/astar/AstarProtocol.d.ts +15 -28
- package/protocols/substrate/astar/AstarProtocol.js +17 -30
- package/protocols/substrate/astar/AstarProtocol.js.map +1 -1
- package/protocols/substrate/astar/shiden/ShidenProtocol.d.ts +12 -22
- package/protocols/substrate/astar/shiden/ShidenProtocol.js +14 -24
- package/protocols/substrate/astar/shiden/ShidenProtocol.js.map +1 -1
- package/protocols/substrate/kusama/KusamaProtocol.d.ts +15 -28
- package/protocols/substrate/kusama/KusamaProtocol.js +17 -30
- package/protocols/substrate/kusama/KusamaProtocol.js.map +1 -1
- package/protocols/substrate/moonbeam/MoonbeamProtocol.d.ts +15 -28
- package/protocols/substrate/moonbeam/MoonbeamProtocol.js +44 -57
- package/protocols/substrate/moonbeam/MoonbeamProtocol.js.map +1 -1
- package/protocols/substrate/moonbeam/moonbase/MoonbaseProtocol.d.ts +11 -20
- package/protocols/substrate/moonbeam/moonbase/MoonbaseProtocol.js +13 -22
- package/protocols/substrate/moonbeam/moonbase/MoonbaseProtocol.js.map +1 -1
- package/protocols/substrate/moonbeam/moonriver/MoonriverProtocol.d.ts +11 -20
- package/protocols/substrate/moonbeam/moonriver/MoonriverProtocol.js +13 -22
- package/protocols/substrate/moonbeam/moonriver/MoonriverProtocol.js.map +1 -1
- package/protocols/substrate/polkadot/PolkadotProtocol.d.ts +15 -28
- package/protocols/substrate/polkadot/PolkadotProtocol.js +17 -30
- package/protocols/substrate/polkadot/PolkadotProtocol.js.map +1 -1
- package/protocols/tezos/TezosProtocol.d.ts +31 -31
- package/protocols/tezos/TezosProtocol.js +165 -75
- package/protocols/tezos/TezosProtocol.js.map +1 -1
- package/protocols/tezos/fa/TezosFA1Protocol.js +2 -2
- package/protocols/tezos/fa/TezosFA1Protocol.js.map +1 -1
- package/protocols/tezos/fa/TezosFA2Protocol.d.ts +3 -3
- package/protocols/tezos/fa/TezosFA2Protocol.js +14 -8
- package/protocols/tezos/fa/TezosFA2Protocol.js.map +1 -1
- package/protocols/tezos/fa/TezosFAProtocol.d.ts +9 -9
- package/protocols/tezos/fa/TezosFAProtocol.js +54 -36
- package/protocols/tezos/fa/TezosFAProtocol.js.map +1 -1
- package/protocols/tezos/kt/TezosKtProtocol.d.ts +7 -6
- package/protocols/tezos/kt/TezosKtProtocol.js +27 -8
- package/protocols/tezos/kt/TezosKtProtocol.js.map +1 -1
- package/protocols/tezos/sapling/TezosSaplingProtocol.d.ts +31 -31
- package/protocols/tezos/sapling/TezosSaplingProtocol.js +145 -55
- package/protocols/tezos/sapling/TezosSaplingProtocol.js.map +1 -1
- package/serializer/unsigned-transactions/xtz-btc-transactions.validator.js +1 -1
- package/serializer/unsigned-transactions/xtz-btc-transactions.validator.js.map +1 -1
- package/serializer/validators/validators.js +5 -5
- package/serializer/validators/validators.js.map +1 -1
- package/serializer-v3/unsigned-transactions/xtz-btc-transactions.validator.js +1 -1
- package/serializer-v3/unsigned-transactions/xtz-btc-transactions.validator.js.map +1 -1
- package/serializer-v3/validators/validators.js +5 -5
- package/serializer-v3/validators/validators.js.map +1 -1
- package/utils/protocolsByIdentifier.js +4 -4
- package/utils/protocolsByIdentifier.js.map +1 -1
- package/utils/supportedProtocols.js +9 -9
- package/utils/supportedProtocols.js.map +1 -1
- package/wallet/AirGapCoinWallet.js +2 -2
- package/wallet/AirGapCoinWallet.js.map +1 -1
- package/wallet/AirGapMarketWallet.js +1 -1
- package/wallet/AirGapMarketWallet.js.map +1 -1
- package/wallet/AirGapNFTWallet.js +1 -1
- package/wallet/AirGapNFTWallet.js.map +1 -1
- package/wallet/AirGapWallet.js +3 -3
- package/wallet/AirGapWallet.js.map +1 -1
|
@@ -124674,65 +124674,155 @@ var AeternityCryptoClient_1 = require("./AeternityCryptoClient");
|
|
|
124674
124674
|
var AeternityProtocolOptions_1 = require("./AeternityProtocolOptions");
|
|
124675
124675
|
var AeternityProtocol = /** @class */ (function (_super) {
|
|
124676
124676
|
__extends(AeternityProtocol, _super);
|
|
124677
|
-
function AeternityProtocol(
|
|
124678
|
-
if (
|
|
124677
|
+
function AeternityProtocol(options) {
|
|
124678
|
+
if (options === void 0) { options = new AeternityProtocolOptions_1.AeternityProtocolOptions(); }
|
|
124679
124679
|
var _this = _super.call(this) || this;
|
|
124680
|
-
_this.
|
|
124681
|
-
_this.
|
|
124682
|
-
_this.
|
|
124683
|
-
_this.
|
|
124684
|
-
_this.
|
|
124685
|
-
_this.
|
|
124686
|
-
_this.
|
|
124687
|
-
_this.
|
|
124688
|
-
_this.
|
|
124689
|
-
_this._decimals = 18;
|
|
124690
|
-
_this.decimals = Promise.resolve(_this._decimals);
|
|
124691
|
-
_this._feeDecimals = 18;
|
|
124692
|
-
_this.feeDecimals = Promise.resolve(_this._feeDecimals);
|
|
124693
|
-
_this._identifier = ProtocolSymbols_1.MainProtocolSymbols.AE;
|
|
124694
|
-
_this.identifier = Promise.resolve(_this._identifier);
|
|
124695
|
-
_this._feeDefaults = {
|
|
124680
|
+
_this.options = options;
|
|
124681
|
+
_this.symbol = 'AE';
|
|
124682
|
+
_this.name = 'æternity';
|
|
124683
|
+
_this.marketSymbol = 'ae';
|
|
124684
|
+
_this.feeSymbol = 'ae';
|
|
124685
|
+
_this.decimals = 18;
|
|
124686
|
+
_this.feeDecimals = 18;
|
|
124687
|
+
_this.identifier = ProtocolSymbols_1.MainProtocolSymbols.AE;
|
|
124688
|
+
_this.feeDefaults = {
|
|
124696
124689
|
low: '0.00021',
|
|
124697
124690
|
medium: '0.000315',
|
|
124698
124691
|
high: '0.00084'
|
|
124699
124692
|
};
|
|
124700
|
-
_this.
|
|
124701
|
-
_this._units = [
|
|
124693
|
+
_this.units = [
|
|
124702
124694
|
{
|
|
124703
124695
|
unitSymbol: 'AE',
|
|
124704
124696
|
factor: '1'
|
|
124705
124697
|
}
|
|
124706
124698
|
];
|
|
124707
|
-
_this.
|
|
124708
|
-
_this.
|
|
124709
|
-
_this.
|
|
124710
|
-
_this.
|
|
124711
|
-
_this.
|
|
124712
|
-
_this._addressIsCaseSensitive = true;
|
|
124713
|
-
_this.addressIsCaseSensitive = Promise.resolve(_this._addressIsCaseSensitive);
|
|
124714
|
-
_this._addressValidationPattern = '^ak_+[1-9A-Za-z]{49,50}$';
|
|
124715
|
-
_this.addressValidationPattern = Promise.resolve(_this._addressValidationPattern);
|
|
124716
|
-
_this._addressPlaceholder = 'ak_abc...';
|
|
124717
|
-
_this.addressPlaceholder = Promise.resolve(_this._addressPlaceholder);
|
|
124718
|
-
_this.options = Promise.resolve(_this._options);
|
|
124699
|
+
_this.supportsHD = false;
|
|
124700
|
+
_this.standardDerivationPath = "m/44h/457h/0h/0h/0h";
|
|
124701
|
+
_this.addressIsCaseSensitive = true;
|
|
124702
|
+
_this.addressValidationPattern = '^ak_+[1-9A-Za-z]{49,50}$';
|
|
124703
|
+
_this.addressPlaceholder = 'ak_abc...';
|
|
124719
124704
|
// ae specifics
|
|
124720
124705
|
_this.defaultNetworkId = 'ae_mainnet';
|
|
124721
124706
|
_this.feesURL = 'https://api-airgap.gke.papers.tech/fees';
|
|
124722
124707
|
_this.cryptoClient = new AeternityCryptoClient_1.AeternityCryptoClient();
|
|
124723
124708
|
return _this;
|
|
124724
124709
|
}
|
|
124710
|
+
AeternityProtocol.prototype.getSymbol = function () {
|
|
124711
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124712
|
+
return __generator(this, function (_a) {
|
|
124713
|
+
return [2 /*return*/, this.symbol];
|
|
124714
|
+
});
|
|
124715
|
+
});
|
|
124716
|
+
};
|
|
124717
|
+
AeternityProtocol.prototype.getName = function () {
|
|
124718
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124719
|
+
return __generator(this, function (_a) {
|
|
124720
|
+
return [2 /*return*/, this.name];
|
|
124721
|
+
});
|
|
124722
|
+
});
|
|
124723
|
+
};
|
|
124724
|
+
AeternityProtocol.prototype.getMarketSymbol = function () {
|
|
124725
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124726
|
+
return __generator(this, function (_a) {
|
|
124727
|
+
return [2 /*return*/, this.marketSymbol];
|
|
124728
|
+
});
|
|
124729
|
+
});
|
|
124730
|
+
};
|
|
124731
|
+
AeternityProtocol.prototype.getFeeSymbol = function () {
|
|
124732
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124733
|
+
return __generator(this, function (_a) {
|
|
124734
|
+
return [2 /*return*/, this.feeSymbol];
|
|
124735
|
+
});
|
|
124736
|
+
});
|
|
124737
|
+
};
|
|
124738
|
+
AeternityProtocol.prototype.getDecimals = function () {
|
|
124739
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124740
|
+
return __generator(this, function (_a) {
|
|
124741
|
+
return [2 /*return*/, this.decimals];
|
|
124742
|
+
});
|
|
124743
|
+
});
|
|
124744
|
+
};
|
|
124745
|
+
AeternityProtocol.prototype.getFeeDecimals = function () {
|
|
124746
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124747
|
+
return __generator(this, function (_a) {
|
|
124748
|
+
return [2 /*return*/, this.feeDecimals];
|
|
124749
|
+
});
|
|
124750
|
+
});
|
|
124751
|
+
};
|
|
124752
|
+
AeternityProtocol.prototype.getIdentifier = function () {
|
|
124753
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124754
|
+
return __generator(this, function (_a) {
|
|
124755
|
+
return [2 /*return*/, this.identifier];
|
|
124756
|
+
});
|
|
124757
|
+
});
|
|
124758
|
+
};
|
|
124759
|
+
AeternityProtocol.prototype.getFeeDefaults = function () {
|
|
124760
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124761
|
+
return __generator(this, function (_a) {
|
|
124762
|
+
return [2 /*return*/, this.feeDefaults];
|
|
124763
|
+
});
|
|
124764
|
+
});
|
|
124765
|
+
};
|
|
124766
|
+
AeternityProtocol.prototype.getUnits = function () {
|
|
124767
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124768
|
+
return __generator(this, function (_a) {
|
|
124769
|
+
return [2 /*return*/, this.units];
|
|
124770
|
+
});
|
|
124771
|
+
});
|
|
124772
|
+
};
|
|
124773
|
+
AeternityProtocol.prototype.getSupportsHD = function () {
|
|
124774
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124775
|
+
return __generator(this, function (_a) {
|
|
124776
|
+
return [2 /*return*/, this.supportsHD];
|
|
124777
|
+
});
|
|
124778
|
+
});
|
|
124779
|
+
};
|
|
124780
|
+
AeternityProtocol.prototype.getStandardDerivationPath = function () {
|
|
124781
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124782
|
+
return __generator(this, function (_a) {
|
|
124783
|
+
return [2 /*return*/, this.standardDerivationPath];
|
|
124784
|
+
});
|
|
124785
|
+
});
|
|
124786
|
+
};
|
|
124787
|
+
AeternityProtocol.prototype.getAddressIsCaseSensitive = function () {
|
|
124788
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124789
|
+
return __generator(this, function (_a) {
|
|
124790
|
+
return [2 /*return*/, this.addressIsCaseSensitive];
|
|
124791
|
+
});
|
|
124792
|
+
});
|
|
124793
|
+
};
|
|
124794
|
+
AeternityProtocol.prototype.getAddressValidationPattern = function () {
|
|
124795
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124796
|
+
return __generator(this, function (_a) {
|
|
124797
|
+
return [2 /*return*/, this.addressValidationPattern];
|
|
124798
|
+
});
|
|
124799
|
+
});
|
|
124800
|
+
};
|
|
124801
|
+
AeternityProtocol.prototype.getAddressPlaceholder = function () {
|
|
124802
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124803
|
+
return __generator(this, function (_a) {
|
|
124804
|
+
return [2 /*return*/, this.addressPlaceholder];
|
|
124805
|
+
});
|
|
124806
|
+
});
|
|
124807
|
+
};
|
|
124808
|
+
AeternityProtocol.prototype.getOptions = function () {
|
|
124809
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124810
|
+
return __generator(this, function (_a) {
|
|
124811
|
+
return [2 /*return*/, this.options];
|
|
124812
|
+
});
|
|
124813
|
+
});
|
|
124814
|
+
};
|
|
124725
124815
|
AeternityProtocol.prototype.getBlockExplorerLinkForAddress = function (address) {
|
|
124726
124816
|
return __awaiter(this, void 0, void 0, function () {
|
|
124727
124817
|
return __generator(this, function (_a) {
|
|
124728
|
-
return [2 /*return*/, this.
|
|
124818
|
+
return [2 /*return*/, this.options.network.blockExplorer.getAddressLink(address)];
|
|
124729
124819
|
});
|
|
124730
124820
|
});
|
|
124731
124821
|
};
|
|
124732
124822
|
AeternityProtocol.prototype.getBlockExplorerLinkForTxId = function (txId) {
|
|
124733
124823
|
return __awaiter(this, void 0, void 0, function () {
|
|
124734
124824
|
return __generator(this, function (_a) {
|
|
124735
|
-
return [2 /*return*/, this.
|
|
124825
|
+
return [2 /*return*/, this.options.network.blockExplorer.getTransactionLink(txId)];
|
|
124736
124826
|
});
|
|
124737
124827
|
});
|
|
124738
124828
|
};
|
|
@@ -124826,8 +124916,8 @@ var AeternityProtocol = /** @class */ (function (_super) {
|
|
|
124826
124916
|
switch (_a.label) {
|
|
124827
124917
|
case 0: return [4 /*yield*/, Promise.all(addresses.map(function (address) {
|
|
124828
124918
|
var url = cursor
|
|
124829
|
-
? _this.
|
|
124830
|
-
: _this.
|
|
124919
|
+
? _this.options.network.rpcUrl + "/mdw/txs/backward?account=" + address + "&page=" + cursor.page + "&limit=" + limit
|
|
124920
|
+
: _this.options.network.rpcUrl + "/mdw/txs/backward?account=" + address + "&page=1&limit=" + limit;
|
|
124831
124921
|
return index_1.default.get(url);
|
|
124832
124922
|
}))];
|
|
124833
124923
|
case 1:
|
|
@@ -124842,8 +124932,8 @@ var AeternityProtocol = /** @class */ (function (_super) {
|
|
|
124842
124932
|
fee: new bignumber_1.default(obj.tx.fee).toString(10),
|
|
124843
124933
|
from: [obj.tx.sender_id],
|
|
124844
124934
|
isInbound: addresses.indexOf(obj.tx.recipient_id) !== -1,
|
|
124845
|
-
protocolIdentifier: _this.
|
|
124846
|
-
network: _this.
|
|
124935
|
+
protocolIdentifier: _this.identifier,
|
|
124936
|
+
network: _this.options.network,
|
|
124847
124937
|
to: [obj.tx.recipient_id],
|
|
124848
124938
|
hash: obj.hash,
|
|
124849
124939
|
blockHeight: obj.block_height
|
|
@@ -124930,8 +125020,8 @@ var AeternityProtocol = /** @class */ (function (_super) {
|
|
|
124930
125020
|
fee: new bignumber_1.default(parseInt(rlpDecodedTx[5].toString('hex'), 16)).toString(10),
|
|
124931
125021
|
from: [fromAddress.address],
|
|
124932
125022
|
isInbound: false,
|
|
124933
|
-
protocolIdentifier: this.
|
|
124934
|
-
network: this.
|
|
125023
|
+
protocolIdentifier: this.identifier,
|
|
125024
|
+
network: this.options.network,
|
|
124935
125025
|
to: [toAddress.address],
|
|
124936
125026
|
data: (rlpDecodedTx[8] || '').toString('utf8'),
|
|
124937
125027
|
transactionDetails: unsignedTx.transaction
|
|
@@ -124973,7 +125063,7 @@ var AeternityProtocol = /** @class */ (function (_super) {
|
|
|
124973
125063
|
_a.label = 2;
|
|
124974
125064
|
case 2:
|
|
124975
125065
|
_a.trys.push([2, 4, , 5]);
|
|
124976
|
-
return [4 /*yield*/, index_1.default.get(this.
|
|
125066
|
+
return [4 /*yield*/, index_1.default.get(this.options.network.rpcUrl + "/v2/accounts/" + address)];
|
|
124977
125067
|
case 3:
|
|
124978
125068
|
data = (_a.sent()).data;
|
|
124979
125069
|
balance = balance.plus(new bignumber_1.default(data.balance));
|
|
@@ -125022,28 +125112,25 @@ var AeternityProtocol = /** @class */ (function (_super) {
|
|
|
125022
125112
|
};
|
|
125023
125113
|
AeternityProtocol.prototype.estimateMaxTransactionValueFromPublicKey = function (publicKey, recipients, fee) {
|
|
125024
125114
|
return __awaiter(this, void 0, void 0, function () {
|
|
125025
|
-
var balance, balanceWrapper, maxFee, estimatedFeeDefaults,
|
|
125026
|
-
return __generator(this, function (
|
|
125027
|
-
switch (
|
|
125115
|
+
var balance, balanceWrapper, maxFee, estimatedFeeDefaults, amountWithoutFees;
|
|
125116
|
+
return __generator(this, function (_a) {
|
|
125117
|
+
switch (_a.label) {
|
|
125028
125118
|
case 0: return [4 /*yield*/, this.getBalanceOfPublicKey(publicKey)];
|
|
125029
125119
|
case 1:
|
|
125030
|
-
balance =
|
|
125120
|
+
balance = _a.sent();
|
|
125031
125121
|
balanceWrapper = new bignumber_1.default(balance);
|
|
125032
125122
|
if (!(fee !== undefined)) return [3 /*break*/, 2];
|
|
125033
125123
|
maxFee = new bignumber_1.default(fee);
|
|
125034
|
-
return [3 /*break*/,
|
|
125124
|
+
return [3 /*break*/, 4];
|
|
125035
125125
|
case 2: return [4 /*yield*/, this.estimateFeeDefaultsFromPublicKey(publicKey, recipients, [balance])];
|
|
125036
125126
|
case 3:
|
|
125037
|
-
estimatedFeeDefaults =
|
|
125038
|
-
|
|
125039
|
-
return [4 /*yield*/, this.decimals];
|
|
125040
|
-
case 4:
|
|
125041
|
-
maxFee = _b.apply(_a, [_c.sent()]);
|
|
125127
|
+
estimatedFeeDefaults = _a.sent();
|
|
125128
|
+
maxFee = new bignumber_1.default(estimatedFeeDefaults.medium).shiftedBy(this.decimals);
|
|
125042
125129
|
if (maxFee.gte(balanceWrapper)) {
|
|
125043
125130
|
maxFee = new bignumber_1.default(0);
|
|
125044
125131
|
}
|
|
125045
|
-
|
|
125046
|
-
case
|
|
125132
|
+
_a.label = 4;
|
|
125133
|
+
case 4:
|
|
125047
125134
|
amountWithoutFees = balanceWrapper.minus(maxFee);
|
|
125048
125135
|
if (amountWithoutFees.isNegative()) {
|
|
125049
125136
|
amountWithoutFees = new bignumber_1.default(0);
|
|
@@ -125076,7 +125163,7 @@ var AeternityProtocol = /** @class */ (function (_super) {
|
|
|
125076
125163
|
_b.label = 2;
|
|
125077
125164
|
case 2:
|
|
125078
125165
|
_b.trys.push([2, 4, , 5]);
|
|
125079
|
-
return [4 /*yield*/, index_1.default.get(this.
|
|
125166
|
+
return [4 /*yield*/, index_1.default.get(this.options.network.rpcUrl + "/v2/accounts/" + address.address)];
|
|
125080
125167
|
case 3:
|
|
125081
125168
|
accountResponse = (_b.sent()).data;
|
|
125082
125169
|
nonce = accountResponse.nonce + 1;
|
|
@@ -125137,7 +125224,7 @@ var AeternityProtocol = /** @class */ (function (_super) {
|
|
|
125137
125224
|
var data;
|
|
125138
125225
|
return __generator(this, function (_a) {
|
|
125139
125226
|
switch (_a.label) {
|
|
125140
|
-
case 0: return [4 /*yield*/, index_1.default.post(this.
|
|
125227
|
+
case 0: return [4 /*yield*/, index_1.default.post(this.options.network.rpcUrl + "/v2/transactions", { tx: rawTransaction }, { headers: { 'Content-Type': 'application/json' } })];
|
|
125141
125228
|
case 1:
|
|
125142
125229
|
data = (_a.sent()).data;
|
|
125143
125230
|
return [2 /*return*/, data.tx_hash];
|
|
@@ -125509,30 +125596,22 @@ var errors_1 = require("../../errors");
|
|
|
125509
125596
|
var coinlib_error_1 = require("../../errors/coinlib-error");
|
|
125510
125597
|
var DUST_AMOUNT = 50;
|
|
125511
125598
|
var BitcoinProtocol = /** @class */ (function () {
|
|
125512
|
-
function BitcoinProtocol(
|
|
125513
|
-
if (
|
|
125514
|
-
this.
|
|
125515
|
-
this.
|
|
125516
|
-
this.
|
|
125517
|
-
this.
|
|
125518
|
-
this.
|
|
125519
|
-
this.
|
|
125520
|
-
this.marketSymbol = Promise.resolve(this._marketSymbol);
|
|
125521
|
-
this._feeSymbol = 'btc';
|
|
125522
|
-
this.feeSymbol = Promise.resolve(this._feeSymbol);
|
|
125523
|
-
this._feeDefaults = {
|
|
125599
|
+
function BitcoinProtocol(options) {
|
|
125600
|
+
if (options === void 0) { options = new BitcoinProtocolOptions_1.BitcoinProtocolOptions(); }
|
|
125601
|
+
this.options = options;
|
|
125602
|
+
this.symbol = 'BTC';
|
|
125603
|
+
this.name = 'Bitcoin (Legacy)';
|
|
125604
|
+
this.marketSymbol = 'btc';
|
|
125605
|
+
this.feeSymbol = 'btc';
|
|
125606
|
+
this.feeDefaults = {
|
|
125524
125607
|
low: '0.00002',
|
|
125525
125608
|
medium: '0.00004',
|
|
125526
125609
|
high: '0.00005'
|
|
125527
125610
|
};
|
|
125528
|
-
this.
|
|
125529
|
-
this.
|
|
125530
|
-
this.
|
|
125531
|
-
this.
|
|
125532
|
-
this.feeDecimals = Promise.resolve(this._feeDecimals);
|
|
125533
|
-
this._identifier = ProtocolSymbols_1.MainProtocolSymbols.BTC;
|
|
125534
|
-
this.identifier = Promise.resolve(this._identifier);
|
|
125535
|
-
this._units = [
|
|
125611
|
+
this.decimals = 8;
|
|
125612
|
+
this.feeDecimals = 8;
|
|
125613
|
+
this.identifier = ProtocolSymbols_1.MainProtocolSymbols.BTC;
|
|
125614
|
+
this.units = [
|
|
125536
125615
|
{
|
|
125537
125616
|
unitSymbol: 'BTC',
|
|
125538
125617
|
factor: '1'
|
|
@@ -125546,31 +125625,129 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
125546
125625
|
factor: '0.00000001'
|
|
125547
125626
|
}
|
|
125548
125627
|
];
|
|
125549
|
-
this.
|
|
125550
|
-
this.
|
|
125551
|
-
this.
|
|
125552
|
-
this.
|
|
125553
|
-
this.
|
|
125554
|
-
this._addressIsCaseSensitive = true;
|
|
125555
|
-
this.addressIsCaseSensitive = Promise.resolve(this._addressIsCaseSensitive);
|
|
125556
|
-
this._addressValidationPattern = '^(?:[13]{1}[a-km-zA-HJ-NP-Z1-9]{25,34}|bc1[a-z0-9]{39,59})$';
|
|
125557
|
-
this.addressValidationPattern = Promise.resolve(this._addressValidationPattern);
|
|
125558
|
-
this._addressPlaceholder = '1ABC...';
|
|
125559
|
-
this.addressPlaceholder = Promise.resolve(this._addressPlaceholder);
|
|
125560
|
-
this.options = Promise.resolve(this._options);
|
|
125628
|
+
this.supportsHD = true;
|
|
125629
|
+
this.standardDerivationPath = "m/44'/0'/0'";
|
|
125630
|
+
this.addressIsCaseSensitive = true;
|
|
125631
|
+
this.addressValidationPattern = '^(?:[13]{1}[a-km-zA-HJ-NP-Z1-9]{25,34}|bc1[a-z0-9]{39,59})$';
|
|
125632
|
+
this.addressPlaceholder = '1ABC...';
|
|
125561
125633
|
this.cryptoClient = new BitcoinCryptoClient_1.BitcoinCryptoClient(this, bitcoinJSMessage);
|
|
125562
125634
|
}
|
|
125635
|
+
BitcoinProtocol.prototype.getSymbol = function () {
|
|
125636
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
125637
|
+
return __generator(this, function (_a) {
|
|
125638
|
+
return [2 /*return*/, this.symbol];
|
|
125639
|
+
});
|
|
125640
|
+
});
|
|
125641
|
+
};
|
|
125642
|
+
BitcoinProtocol.prototype.getName = function () {
|
|
125643
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
125644
|
+
return __generator(this, function (_a) {
|
|
125645
|
+
return [2 /*return*/, this.name];
|
|
125646
|
+
});
|
|
125647
|
+
});
|
|
125648
|
+
};
|
|
125649
|
+
BitcoinProtocol.prototype.getMarketSymbol = function () {
|
|
125650
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
125651
|
+
return __generator(this, function (_a) {
|
|
125652
|
+
return [2 /*return*/, this.marketSymbol];
|
|
125653
|
+
});
|
|
125654
|
+
});
|
|
125655
|
+
};
|
|
125656
|
+
BitcoinProtocol.prototype.getFeeSymbol = function () {
|
|
125657
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
125658
|
+
return __generator(this, function (_a) {
|
|
125659
|
+
return [2 /*return*/, this.feeSymbol];
|
|
125660
|
+
});
|
|
125661
|
+
});
|
|
125662
|
+
};
|
|
125663
|
+
BitcoinProtocol.prototype.getFeeDefaults = function () {
|
|
125664
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
125665
|
+
return __generator(this, function (_a) {
|
|
125666
|
+
return [2 /*return*/, this.feeDefaults];
|
|
125667
|
+
});
|
|
125668
|
+
});
|
|
125669
|
+
};
|
|
125670
|
+
BitcoinProtocol.prototype.getDecimals = function () {
|
|
125671
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
125672
|
+
return __generator(this, function (_a) {
|
|
125673
|
+
return [2 /*return*/, this.decimals];
|
|
125674
|
+
});
|
|
125675
|
+
});
|
|
125676
|
+
};
|
|
125677
|
+
BitcoinProtocol.prototype.getFeeDecimals = function () {
|
|
125678
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
125679
|
+
return __generator(this, function (_a) {
|
|
125680
|
+
return [2 /*return*/, this.feeDecimals];
|
|
125681
|
+
});
|
|
125682
|
+
});
|
|
125683
|
+
};
|
|
125684
|
+
BitcoinProtocol.prototype.getIdentifier = function () {
|
|
125685
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
125686
|
+
return __generator(this, function (_a) {
|
|
125687
|
+
return [2 /*return*/, this.identifier];
|
|
125688
|
+
});
|
|
125689
|
+
});
|
|
125690
|
+
};
|
|
125691
|
+
BitcoinProtocol.prototype.getUnits = function () {
|
|
125692
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
125693
|
+
return __generator(this, function (_a) {
|
|
125694
|
+
return [2 /*return*/, this.units];
|
|
125695
|
+
});
|
|
125696
|
+
});
|
|
125697
|
+
};
|
|
125698
|
+
BitcoinProtocol.prototype.getSupportsHD = function () {
|
|
125699
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
125700
|
+
return __generator(this, function (_a) {
|
|
125701
|
+
return [2 /*return*/, this.supportsHD];
|
|
125702
|
+
});
|
|
125703
|
+
});
|
|
125704
|
+
};
|
|
125705
|
+
BitcoinProtocol.prototype.getStandardDerivationPath = function () {
|
|
125706
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
125707
|
+
return __generator(this, function (_a) {
|
|
125708
|
+
return [2 /*return*/, this.standardDerivationPath];
|
|
125709
|
+
});
|
|
125710
|
+
});
|
|
125711
|
+
};
|
|
125712
|
+
BitcoinProtocol.prototype.getAddressIsCaseSensitive = function () {
|
|
125713
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
125714
|
+
return __generator(this, function (_a) {
|
|
125715
|
+
return [2 /*return*/, this.addressIsCaseSensitive];
|
|
125716
|
+
});
|
|
125717
|
+
});
|
|
125718
|
+
};
|
|
125719
|
+
BitcoinProtocol.prototype.getAddressValidationPattern = function () {
|
|
125720
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
125721
|
+
return __generator(this, function (_a) {
|
|
125722
|
+
return [2 /*return*/, this.addressValidationPattern];
|
|
125723
|
+
});
|
|
125724
|
+
});
|
|
125725
|
+
};
|
|
125726
|
+
BitcoinProtocol.prototype.getAddressPlaceholder = function () {
|
|
125727
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
125728
|
+
return __generator(this, function (_a) {
|
|
125729
|
+
return [2 /*return*/, this.addressPlaceholder];
|
|
125730
|
+
});
|
|
125731
|
+
});
|
|
125732
|
+
};
|
|
125733
|
+
BitcoinProtocol.prototype.getOptions = function () {
|
|
125734
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
125735
|
+
return __generator(this, function (_a) {
|
|
125736
|
+
return [2 /*return*/, this.options];
|
|
125737
|
+
});
|
|
125738
|
+
});
|
|
125739
|
+
};
|
|
125563
125740
|
BitcoinProtocol.prototype.getBlockExplorerLinkForAddress = function (address) {
|
|
125564
125741
|
return __awaiter(this, void 0, void 0, function () {
|
|
125565
125742
|
return __generator(this, function (_a) {
|
|
125566
|
-
return [2 /*return*/, this.
|
|
125743
|
+
return [2 /*return*/, this.options.network.blockExplorer.getAddressLink(address)];
|
|
125567
125744
|
});
|
|
125568
125745
|
});
|
|
125569
125746
|
};
|
|
125570
125747
|
BitcoinProtocol.prototype.getBlockExplorerLinkForTxId = function (txId) {
|
|
125571
125748
|
return __awaiter(this, void 0, void 0, function () {
|
|
125572
125749
|
return __generator(this, function (_a) {
|
|
125573
|
-
return [2 /*return*/, this.
|
|
125750
|
+
return [2 /*return*/, this.options.network.blockExplorer.getTransactionLink(txId)];
|
|
125574
125751
|
});
|
|
125575
125752
|
});
|
|
125576
125753
|
};
|
|
@@ -125605,7 +125782,7 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
125605
125782
|
return __awaiter(this, void 0, void 0, function () {
|
|
125606
125783
|
var bitcoinNode;
|
|
125607
125784
|
return __generator(this, function (_a) {
|
|
125608
|
-
bitcoinNode = this.
|
|
125785
|
+
bitcoinNode = this.options.config.bitcoinJSLib.HDNode.fromSeedHex(secret, this.options.network.extras.network);
|
|
125609
125786
|
return [2 /*return*/, bitcoinNode.derivePath(derivationPath).neutered().toBase58()];
|
|
125610
125787
|
});
|
|
125611
125788
|
});
|
|
@@ -125614,7 +125791,7 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
125614
125791
|
return __awaiter(this, void 0, void 0, function () {
|
|
125615
125792
|
var bitcoinNode;
|
|
125616
125793
|
return __generator(this, function (_a) {
|
|
125617
|
-
bitcoinNode = this.
|
|
125794
|
+
bitcoinNode = this.options.config.bitcoinJSLib.HDNode.fromSeedHex(secret, this.options.network.extras.network);
|
|
125618
125795
|
return [2 /*return*/, bitcoinNode.derivePath(derivationPath).keyPair.d.toBuffer(32).toString('hex')];
|
|
125619
125796
|
});
|
|
125620
125797
|
});
|
|
@@ -125623,7 +125800,7 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
125623
125800
|
return __awaiter(this, void 0, void 0, function () {
|
|
125624
125801
|
var bitcoinNode;
|
|
125625
125802
|
return __generator(this, function (_a) {
|
|
125626
|
-
bitcoinNode = this.
|
|
125803
|
+
bitcoinNode = this.options.config.bitcoinJSLib.HDNode.fromSeedHex(secret, this.options.network.extras.network);
|
|
125627
125804
|
return [2 /*return*/, bitcoinNode.derivePath(derivationPath).toBase58()];
|
|
125628
125805
|
});
|
|
125629
125806
|
});
|
|
@@ -125632,7 +125809,7 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
125632
125809
|
return __awaiter(this, void 0, void 0, function () {
|
|
125633
125810
|
var node, address;
|
|
125634
125811
|
return __generator(this, function (_a) {
|
|
125635
|
-
node = this.
|
|
125812
|
+
node = this.options.config.bitcoinJSLib.HDNode.fromBase58(publicKey, this.options.network.extras.network);
|
|
125636
125813
|
address = BitcoinAddress_1.BitcoinAddress.from(node);
|
|
125637
125814
|
return [2 /*return*/, {
|
|
125638
125815
|
address: address.asString(),
|
|
@@ -125655,7 +125832,7 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
125655
125832
|
return __awaiter(this, void 0, void 0, function () {
|
|
125656
125833
|
var node, address;
|
|
125657
125834
|
return __generator(this, function (_a) {
|
|
125658
|
-
node = this.
|
|
125835
|
+
node = this.options.config.bitcoinJSLib.HDNode.fromBase58(extendedPublicKey, this.options.network.extras.network);
|
|
125659
125836
|
address = BitcoinAddress_1.BitcoinAddress.from(node, visibilityDerivationIndex, addressDerivationIndex);
|
|
125660
125837
|
return [2 /*return*/, {
|
|
125661
125838
|
address: address.asString(),
|
|
@@ -125668,7 +125845,7 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
125668
125845
|
return __awaiter(this, void 0, void 0, function () {
|
|
125669
125846
|
var node, generatorArray;
|
|
125670
125847
|
return __generator(this, function (_a) {
|
|
125671
|
-
node = this.
|
|
125848
|
+
node = this.options.config.bitcoinJSLib.HDNode.fromBase58(extendedPublicKey, this.options.network.extras.network);
|
|
125672
125849
|
generatorArray = Array.from(new Array(addressCount), function (_, i) { return i + offset; });
|
|
125673
125850
|
return [2 /*return*/, Promise.all(generatorArray.map(function (x) {
|
|
125674
125851
|
var address = BitcoinAddress_1.BitcoinAddress.from(node, visibilityDerivationIndex, x);
|
|
@@ -125686,7 +125863,7 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
125686
125863
|
return __generator(this, function (_d) {
|
|
125687
125864
|
switch (_d.label) {
|
|
125688
125865
|
case 0:
|
|
125689
|
-
transactionBuilder = new this.
|
|
125866
|
+
transactionBuilder = new this.options.config.bitcoinJSLib.TransactionBuilder(this.options.network.extras.network);
|
|
125690
125867
|
for (_i = 0, _a = transaction.ins; _i < _a.length; _i++) {
|
|
125691
125868
|
input = _a[_i];
|
|
125692
125869
|
transactionBuilder.addInput(input.txId, input.vout);
|
|
@@ -125725,8 +125902,8 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
125725
125902
|
return __generator(this, function (_d) {
|
|
125726
125903
|
switch (_d.label) {
|
|
125727
125904
|
case 0:
|
|
125728
|
-
transactionBuilder = new this.
|
|
125729
|
-
node = this.
|
|
125905
|
+
transactionBuilder = new this.options.config.bitcoinJSLib.TransactionBuilder(this.options.network.extras.network);
|
|
125906
|
+
node = this.options.config.bitcoinJSLib.HDNode.fromBase58(extendedPrivateKey, this.options.network.extras.network);
|
|
125730
125907
|
for (_i = 0, _a = transaction.ins; _i < _a.length; _i++) {
|
|
125731
125908
|
input = _a[_i];
|
|
125732
125909
|
transactionBuilder.addInput(input.txId, input.vout);
|
|
@@ -125807,8 +125984,8 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
125807
125984
|
.reduce(function (accumulator, currentValue) { return accumulator.plus(currentValue); })
|
|
125808
125985
|
.toString(10),
|
|
125809
125986
|
fee: feeCalculator.toString(10),
|
|
125810
|
-
protocolIdentifier: this.
|
|
125811
|
-
network: this.
|
|
125987
|
+
protocolIdentifier: this.identifier,
|
|
125988
|
+
network: this.options.network,
|
|
125812
125989
|
isInbound: false,
|
|
125813
125990
|
transactionDetails: unsignedTx.transaction,
|
|
125814
125991
|
warnings: warnings
|
|
@@ -125827,14 +126004,14 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
125827
126004
|
from: signedTx.from,
|
|
125828
126005
|
amount: signedTx.amount,
|
|
125829
126006
|
fee: signedTx.fee,
|
|
125830
|
-
protocolIdentifier: this.
|
|
125831
|
-
network: this.
|
|
126007
|
+
protocolIdentifier: this.identifier,
|
|
126008
|
+
network: this.options.network,
|
|
125832
126009
|
isInbound: false,
|
|
125833
126010
|
transactionDetails: signedTx.transaction
|
|
125834
126011
|
};
|
|
125835
|
-
bitcoinTx = this.
|
|
126012
|
+
bitcoinTx = this.options.config.bitcoinJSLib.Transaction.fromHex(signedTx.transaction);
|
|
125836
126013
|
bitcoinTx.outs.forEach(function (output) {
|
|
125837
|
-
var address = _this.
|
|
126014
|
+
var address = _this.options.config.bitcoinJSLib.address.fromOutputScript(output.script, _this.options.network.extras.network);
|
|
125838
126015
|
// only works if one output is target and rest is change, but this way we can filter out change addresses
|
|
125839
126016
|
if (new bignumber_1.default(output.value).isEqualTo(signedTx.amount)) {
|
|
125840
126017
|
tx.to.push(address);
|
|
@@ -125856,7 +126033,7 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
125856
126033
|
case 1:
|
|
125857
126034
|
if (!(_i < addresses_1.length)) return [3 /*break*/, 4];
|
|
125858
126035
|
address = addresses_1[_i];
|
|
125859
|
-
return [4 /*yield*/, index_1.default.get(this.
|
|
126036
|
+
return [4 /*yield*/, index_1.default.get(this.options.network.extras.indexerApi + "/api/v2/address/" + address + "?details=basic", {
|
|
125860
126037
|
responseType: 'json'
|
|
125861
126038
|
})];
|
|
125862
126039
|
case 2:
|
|
@@ -125890,7 +126067,7 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
125890
126067
|
var data;
|
|
125891
126068
|
return __generator(this, function (_a) {
|
|
125892
126069
|
switch (_a.label) {
|
|
125893
|
-
case 0: return [4 /*yield*/, index_1.default.get(this.
|
|
126070
|
+
case 0: return [4 /*yield*/, index_1.default.get(this.options.network.extras.indexerApi + "/api/v2/xpub/" + extendedPublicKey + "?pageSize=1", {
|
|
125894
126071
|
responseType: 'json'
|
|
125895
126072
|
})];
|
|
125896
126073
|
case 1:
|
|
@@ -125933,10 +126110,10 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
125933
126110
|
var result, estimatedFee, feeStepFactor, mediumFee, lowFee, highFee;
|
|
125934
126111
|
return __generator(this, function (_a) {
|
|
125935
126112
|
switch (_a.label) {
|
|
125936
|
-
case 0: return [4 /*yield*/, index_1.default.get(this.
|
|
126113
|
+
case 0: return [4 /*yield*/, index_1.default.get(this.options.network.extras.indexerApi + "/api/v2/estimatefee/5")];
|
|
125937
126114
|
case 1:
|
|
125938
126115
|
result = (_a.sent()).data.result;
|
|
125939
|
-
estimatedFee = new bignumber_1.default(result).shiftedBy(this.
|
|
126116
|
+
estimatedFee = new bignumber_1.default(result).shiftedBy(this.feeDecimals);
|
|
125940
126117
|
if (estimatedFee.isZero()) {
|
|
125941
126118
|
return [2 /*return*/, this.feeDefaults];
|
|
125942
126119
|
}
|
|
@@ -125945,9 +126122,9 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
125945
126122
|
lowFee = mediumFee.minus(mediumFee.times(feeStepFactor)).integerValue(bignumber_1.default.ROUND_FLOOR);
|
|
125946
126123
|
highFee = mediumFee.plus(mediumFee.times(feeStepFactor)).integerValue(bignumber_1.default.ROUND_FLOOR);
|
|
125947
126124
|
return [2 /*return*/, {
|
|
125948
|
-
low: lowFee.shiftedBy(-this.
|
|
125949
|
-
medium: mediumFee.shiftedBy(-this.
|
|
125950
|
-
high: highFee.shiftedBy(-this.
|
|
126125
|
+
low: lowFee.shiftedBy(-this.getFeeDecimals).toFixed(),
|
|
126126
|
+
medium: mediumFee.shiftedBy(-this.getFeeDecimals).toFixed(),
|
|
126127
|
+
high: highFee.shiftedBy(-this.getFeeDecimals).toFixed()
|
|
125951
126128
|
}];
|
|
125952
126129
|
}
|
|
125953
126130
|
});
|
|
@@ -125976,7 +126153,7 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
125976
126153
|
throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.BITCOIN, 'recipients do not match values');
|
|
125977
126154
|
}
|
|
125978
126155
|
return [4 /*yield*/, index_1.default
|
|
125979
|
-
.get(this.
|
|
126156
|
+
.get(this.options.network.extras.indexerApi + "/api/v2/utxo/" + extendedPublicKey + "?confirmed=true", {
|
|
125980
126157
|
responseType: 'json'
|
|
125981
126158
|
})
|
|
125982
126159
|
.catch(function (error) {
|
|
@@ -126084,7 +126261,7 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
126084
126261
|
return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
|
|
126085
126262
|
case 1:
|
|
126086
126263
|
address = (_a.sent()).address;
|
|
126087
|
-
return [4 /*yield*/, index_1.default.get(this.
|
|
126264
|
+
return [4 /*yield*/, index_1.default.get(this.options.network.extras.indexerApi + "/api/v2/utxo/" + address, {
|
|
126088
126265
|
responseType: 'json'
|
|
126089
126266
|
})];
|
|
126090
126267
|
case 2:
|
|
@@ -126137,7 +126314,7 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
126137
126314
|
var data;
|
|
126138
126315
|
return __generator(this, function (_a) {
|
|
126139
126316
|
switch (_a.label) {
|
|
126140
|
-
case 0: return [4 /*yield*/, index_1.default.post(this.
|
|
126317
|
+
case 0: return [4 /*yield*/, index_1.default.post(this.options.network.extras.indexerApi + '/api/v2/sendtx/', rawTransaction)];
|
|
126141
126318
|
case 1:
|
|
126142
126319
|
data = (_a.sent()).data;
|
|
126143
126320
|
return [2 /*return*/, data.result];
|
|
@@ -126154,7 +126331,7 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
126154
126331
|
switch (_g.label) {
|
|
126155
126332
|
case 0:
|
|
126156
126333
|
page = (_a = cursor === null || cursor === void 0 ? void 0 : cursor.page) !== null && _a !== void 0 ? _a : 1;
|
|
126157
|
-
return [4 /*yield*/, index_1.default.get(this.
|
|
126334
|
+
return [4 /*yield*/, index_1.default.get(this.options.network.extras.indexerApi +
|
|
126158
126335
|
'/api/v2/xpub/' +
|
|
126159
126336
|
extendedPublicKey +
|
|
126160
126337
|
("?details=txs&tokens=used&pageSize=" + limit + "&page=" + page), {
|
|
@@ -126204,8 +126381,8 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
126204
126381
|
amount: amount.toString(10),
|
|
126205
126382
|
fee: new bignumber_1.default(transaction.fees).toString(10),
|
|
126206
126383
|
blockHeight: transaction.blockHeight.toString(),
|
|
126207
|
-
protocolIdentifier: this.
|
|
126208
|
-
network: this.
|
|
126384
|
+
protocolIdentifier: this.identifier,
|
|
126385
|
+
network: this.options.network,
|
|
126209
126386
|
timestamp: transaction.blockTime
|
|
126210
126387
|
};
|
|
126211
126388
|
airGapTransactions.push(airGapTransaction);
|
|
@@ -126243,7 +126420,7 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
126243
126420
|
case 0:
|
|
126244
126421
|
airGapTransactions = [];
|
|
126245
126422
|
page = (_a = cursor === null || cursor === void 0 ? void 0 : cursor.page) !== null && _a !== void 0 ? _a : 1;
|
|
126246
|
-
url = this.
|
|
126423
|
+
url = this.options.network.extras.indexerApi + "/api/v2/address/" + addresses[0] + "?page=" + page + "&pageSize=" + limit + "&details=txs";
|
|
126247
126424
|
return [4 /*yield*/, index_1.default.get(url, {
|
|
126248
126425
|
responseType: 'json'
|
|
126249
126426
|
})];
|
|
@@ -126289,8 +126466,8 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
126289
126466
|
amount: amount.toString(10),
|
|
126290
126467
|
fee: new bignumber_1.default(transaction.fees).toString(10),
|
|
126291
126468
|
blockHeight: transaction.blockHeight.toString(),
|
|
126292
|
-
protocolIdentifier: this.
|
|
126293
|
-
network: this.
|
|
126469
|
+
protocolIdentifier: this.identifier,
|
|
126470
|
+
network: this.options.network,
|
|
126294
126471
|
timestamp: transaction.blockTime
|
|
126295
126472
|
};
|
|
126296
126473
|
airGapTransactions.push(airGapTransaction);
|
|
@@ -126333,7 +126510,7 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
126333
126510
|
return __awaiter(this, void 0, void 0, function () {
|
|
126334
126511
|
var childPublicKey;
|
|
126335
126512
|
return __generator(this, function (_a) {
|
|
126336
|
-
childPublicKey = this.
|
|
126513
|
+
childPublicKey = this.options.config.bitcoinJSLib.HDNode.fromBase58(publicKey, this.options.network.extras.network)
|
|
126337
126514
|
.derive(0)
|
|
126338
126515
|
.derive(0)
|
|
126339
126516
|
.getPublicKeyBuffer();
|
|
@@ -126345,7 +126522,7 @@ var BitcoinProtocol = /** @class */ (function () {
|
|
|
126345
126522
|
return __awaiter(this, void 0, void 0, function () {
|
|
126346
126523
|
var childPrivateKey;
|
|
126347
126524
|
return __generator(this, function (_a) {
|
|
126348
|
-
childPrivateKey = this.
|
|
126525
|
+
childPrivateKey = this.options.config.bitcoinJSLib.HDNode.fromBase58(keypair.privateKey, this.options.network.extras.network)
|
|
126349
126526
|
.derive(0)
|
|
126350
126527
|
.derive(0)
|
|
126351
126528
|
.keyPair.d.toBuffer(32);
|
|
@@ -126692,17 +126869,17 @@ var BitcoinSegwitProtocol = /** @class */ (function (_super) {
|
|
|
126692
126869
|
function BitcoinSegwitProtocol(options) {
|
|
126693
126870
|
if (options === void 0) { options = new __1.BitcoinProtocolOptions(); }
|
|
126694
126871
|
var _this = _super.call(this, options) || this;
|
|
126695
|
-
_this.
|
|
126696
|
-
_this.
|
|
126697
|
-
_this.
|
|
126698
|
-
_this.
|
|
126872
|
+
_this.name = 'Bitcoin (Segwit)';
|
|
126873
|
+
_this.identifier = ProtocolSymbols_1.MainProtocolSymbols.BTC_SEGWIT;
|
|
126874
|
+
_this.standardDerivationPath = "m/84'/0'/0'";
|
|
126875
|
+
_this.addressPlaceholder = 'bc1...';
|
|
126699
126876
|
return _this;
|
|
126700
126877
|
}
|
|
126701
126878
|
BitcoinSegwitProtocol.prototype.getPublicKeyFromHexSecret = function (secret, derivationPath) {
|
|
126702
126879
|
return __awaiter(this, void 0, void 0, function () {
|
|
126703
126880
|
var bitcoinNode, neutered, zpub;
|
|
126704
126881
|
return __generator(this, function (_a) {
|
|
126705
|
-
bitcoinNode = bitcoinJS.bip32.fromSeed(Buffer.from(secret, 'hex'), this.
|
|
126882
|
+
bitcoinNode = bitcoinJS.bip32.fromSeed(Buffer.from(secret, 'hex'), this.options.network.extras.network);
|
|
126706
126883
|
neutered = bitcoinNode.derivePath(derivationPath).neutered();
|
|
126707
126884
|
zpub = new ExtendedPublicKey(neutered.toBase58()).toZPub();
|
|
126708
126885
|
return [2 /*return*/, zpub];
|
|
@@ -126714,9 +126891,9 @@ var BitcoinSegwitProtocol = /** @class */ (function (_super) {
|
|
|
126714
126891
|
var bitcoinNode, privateKey;
|
|
126715
126892
|
return __generator(this, function (_a) {
|
|
126716
126893
|
if (!derivationPath) {
|
|
126717
|
-
return [2 /*return*/, bitcoinJS.bip32.fromSeed(Buffer.from(secret, 'hex'), this.
|
|
126894
|
+
return [2 /*return*/, bitcoinJS.bip32.fromSeed(Buffer.from(secret, 'hex'), this.options.network.extras.network)];
|
|
126718
126895
|
}
|
|
126719
|
-
bitcoinNode = bitcoinJS.bip32.fromSeed(Buffer.from(secret, 'hex'), this.
|
|
126896
|
+
bitcoinNode = bitcoinJS.bip32.fromSeed(Buffer.from(secret, 'hex'), this.options.network.extras.network);
|
|
126720
126897
|
privateKey = bitcoinNode.derivePath(derivationPath).privateKey;
|
|
126721
126898
|
if (!privateKey) {
|
|
126722
126899
|
throw new Error('No privatekey!');
|
|
@@ -126738,7 +126915,7 @@ var BitcoinSegwitProtocol = /** @class */ (function (_super) {
|
|
|
126738
126915
|
return __awaiter(this, void 0, void 0, function () {
|
|
126739
126916
|
var bitcoinNode;
|
|
126740
126917
|
return __generator(this, function (_a) {
|
|
126741
|
-
bitcoinNode = bitcoinJS.bip32.fromSeed(Buffer.from(secret, 'hex'), this.
|
|
126918
|
+
bitcoinNode = bitcoinJS.bip32.fromSeed(Buffer.from(secret, 'hex'), this.options.network.extras.network);
|
|
126742
126919
|
return [2 /*return*/, bitcoinNode.derivePath(derivationPath).toBase58()];
|
|
126743
126920
|
});
|
|
126744
126921
|
});
|
|
@@ -126747,7 +126924,7 @@ var BitcoinSegwitProtocol = /** @class */ (function (_super) {
|
|
|
126747
126924
|
return __awaiter(this, void 0, void 0, function () {
|
|
126748
126925
|
var address;
|
|
126749
126926
|
return __generator(this, function (_a) {
|
|
126750
|
-
address = BitcoinSegwitAddress_1.BitcoinSegwitAddress.fromAddress(bitcoinJS.bip32.fromBase58(publicKey, this.
|
|
126927
|
+
address = BitcoinSegwitAddress_1.BitcoinSegwitAddress.fromAddress(bitcoinJS.bip32.fromBase58(publicKey, this.options.network.extras.network).toBase58());
|
|
126751
126928
|
return [2 /*return*/, {
|
|
126752
126929
|
address: address.asString(),
|
|
126753
126930
|
cursor: { hasNext: false }
|
|
@@ -126771,7 +126948,7 @@ var BitcoinSegwitProtocol = /** @class */ (function (_super) {
|
|
|
126771
126948
|
return __generator(this, function (_a) {
|
|
126772
126949
|
xpub = new ExtendedPublicKey(extendedPublicKey).toXpub();
|
|
126773
126950
|
keyPair = bitcoinJS.bip32
|
|
126774
|
-
.fromBase58(xpub, this.
|
|
126951
|
+
.fromBase58(xpub, this.options.network.extras.network)
|
|
126775
126952
|
.derive(visibilityDerivationIndex)
|
|
126776
126953
|
.derive(addressDerivationIndex);
|
|
126777
126954
|
obj = bitcoinJS.payments.p2wpkh({ pubkey: keyPair.publicKey });
|
|
@@ -126789,7 +126966,7 @@ var BitcoinSegwitProtocol = /** @class */ (function (_super) {
|
|
|
126789
126966
|
};
|
|
126790
126967
|
BitcoinSegwitProtocol.prototype.getAddressesFromExtendedPublicKey = function (extendedPublicKey, visibilityDerivationIndex, addressCount, offset) {
|
|
126791
126968
|
// broadcaster knows this (both broadcaster and signer)
|
|
126792
|
-
var node = bitcoinJS.bip32.fromBase58(new ExtendedPublicKey(extendedPublicKey).toXpub(), this.
|
|
126969
|
+
var node = bitcoinJS.bip32.fromBase58(new ExtendedPublicKey(extendedPublicKey).toXpub(), this.options.network.extras.network);
|
|
126793
126970
|
var generatorArray = Array.from(new Array(addressCount), function (x, i) { return i + offset; });
|
|
126794
126971
|
return Promise.all(generatorArray.map(function (x) {
|
|
126795
126972
|
var keyPair = node.derive(visibilityDerivationIndex).derive(x);
|
|
@@ -126876,8 +127053,8 @@ var BitcoinSegwitProtocol = /** @class */ (function (_super) {
|
|
|
126876
127053
|
}),
|
|
126877
127054
|
amount: amount.toString(10),
|
|
126878
127055
|
fee: feeCalculator.toString(10),
|
|
126879
|
-
protocolIdentifier: this.
|
|
126880
|
-
network: this.
|
|
127056
|
+
protocolIdentifier: this.identifier,
|
|
127057
|
+
network: this.options.network,
|
|
126881
127058
|
isInbound: false,
|
|
126882
127059
|
transactionDetails: {
|
|
126883
127060
|
// This is some unstructured data about the PSBT. This is shown in the UI as a JSON for advanced users.
|
|
@@ -126922,7 +127099,7 @@ var BitcoinSegwitProtocol = /** @class */ (function (_super) {
|
|
|
126922
127099
|
if (recipients.length !== wrappedValues.length) {
|
|
126923
127100
|
throw new Error('recipients do not match values');
|
|
126924
127101
|
}
|
|
126925
|
-
return [4 /*yield*/, index_2.default.get(this.
|
|
127102
|
+
return [4 /*yield*/, index_2.default.get(this.options.network.extras.indexerApi + "/api/v2/utxo/" + extendedPublicKey + "?confirmed=true", {
|
|
126926
127103
|
responseType: 'json'
|
|
126927
127104
|
})];
|
|
126928
127105
|
case 1:
|
|
@@ -127015,7 +127192,7 @@ var BitcoinSegwitProtocol = /** @class */ (function (_super) {
|
|
|
127015
127192
|
transaction.ins.forEach(function (tx) {
|
|
127016
127193
|
var indexes = getPathIndexes(tx.derivationPath);
|
|
127017
127194
|
var childNode = keyPair.derivePath(indexes.join('/'));
|
|
127018
|
-
var p2wpkh = bitcoinJS.payments.p2wpkh({ pubkey: childNode.publicKey, network: _this.
|
|
127195
|
+
var p2wpkh = bitcoinJS.payments.p2wpkh({ pubkey: childNode.publicKey, network: _this.options.network.extras.network });
|
|
127019
127196
|
var p2shOutput = p2wpkh.output;
|
|
127020
127197
|
if (!p2shOutput) {
|
|
127021
127198
|
throw new Error('no p2shOutput');
|
|
@@ -127139,12 +127316,9 @@ var BitcoinTestnetProtocol = /** @class */ (function (_super) {
|
|
|
127139
127316
|
__extends(BitcoinTestnetProtocol, _super);
|
|
127140
127317
|
function BitcoinTestnetProtocol() {
|
|
127141
127318
|
var _this = _super.call(this, new BitcoinProtocolOptions_1.BitcoinProtocolOptions(new BitcoinProtocolOptions_1.BitcoinProtocolNetwork('Testnet', ProtocolNetwork_1.NetworkType.TESTNET, '', new BitcoinProtocolOptions_1.BlockcypherBlockExplorer('https://live.blockcypher.com/btc-testnet'), new BitcoinProtocolOptions_1.BitcoinProtocolNetworkExtras('https://bitcoin.prod.gke.papers.tech', bitcoinJS.networks.testnet)), new BitcoinProtocolOptions_1.BitcoinProtocolConfig())) || this;
|
|
127142
|
-
_this.
|
|
127143
|
-
_this.
|
|
127144
|
-
_this.
|
|
127145
|
-
_this.standardDerivationPath = Promise.resolve(_this._standardDerivationPath);
|
|
127146
|
-
_this._addressValidationPattern = '^..[13][a-km-zA-HJ-NP-Z1-9]{25,34}$';
|
|
127147
|
-
_this.addressValidationPattern = Promise.resolve(_this._addressValidationPattern);
|
|
127319
|
+
_this.name = 'Bitcoin Testnet';
|
|
127320
|
+
_this.standardDerivationPath = "m/44'/1'/0'";
|
|
127321
|
+
_this.addressValidationPattern = '^..[13][a-km-zA-HJ-NP-Z1-9]{25,34}$';
|
|
127148
127322
|
return _this;
|
|
127149
127323
|
}
|
|
127150
127324
|
return BitcoinTestnetProtocol;
|
|
@@ -127842,27 +128016,19 @@ var CosmosProtocol = /** @class */ (function (_super) {
|
|
|
127842
128016
|
if (_options === void 0) { _options = new CosmosProtocolOptions_1.CosmosProtocolOptions(); }
|
|
127843
128017
|
var _this = _super.call(this) || this;
|
|
127844
128018
|
_this._options = _options;
|
|
127845
|
-
_this.
|
|
127846
|
-
_this.
|
|
127847
|
-
_this.
|
|
127848
|
-
_this.
|
|
127849
|
-
_this.
|
|
127850
|
-
_this.marketSymbol = Promise.resolve(_this._marketSymbol);
|
|
127851
|
-
_this._feeSymbol = 'atom';
|
|
127852
|
-
_this.feeSymbol = Promise.resolve(_this._feeSymbol);
|
|
127853
|
-
_this._feeDefaults = {
|
|
128019
|
+
_this.symbol = 'ATOM';
|
|
128020
|
+
_this.name = 'Cosmos';
|
|
128021
|
+
_this.marketSymbol = 'atom';
|
|
128022
|
+
_this.feeSymbol = 'atom';
|
|
128023
|
+
_this.feeDefaults = {
|
|
127854
128024
|
low: '0.0005',
|
|
127855
128025
|
medium: '0.005',
|
|
127856
128026
|
high: '0.0075'
|
|
127857
128027
|
};
|
|
127858
|
-
_this.
|
|
127859
|
-
_this.
|
|
127860
|
-
_this.
|
|
127861
|
-
_this.
|
|
127862
|
-
_this.feeDecimals = Promise.resolve(_this._feeDecimals);
|
|
127863
|
-
_this._identifier = ProtocolSymbols_1.MainProtocolSymbols.COSMOS;
|
|
127864
|
-
_this.identifier = Promise.resolve(_this._identifier);
|
|
127865
|
-
_this._units = [
|
|
128028
|
+
_this.decimals = 6;
|
|
128029
|
+
_this.feeDecimals = 6;
|
|
128030
|
+
_this.identifier = ProtocolSymbols_1.MainProtocolSymbols.COSMOS;
|
|
128031
|
+
_this.units = [
|
|
127866
128032
|
{
|
|
127867
128033
|
unitSymbol: 'atom',
|
|
127868
128034
|
factor: '1'
|
|
@@ -127872,20 +128038,13 @@ var CosmosProtocol = /** @class */ (function (_super) {
|
|
|
127872
128038
|
factor: '0.000001'
|
|
127873
128039
|
}
|
|
127874
128040
|
];
|
|
127875
|
-
_this.
|
|
127876
|
-
_this.
|
|
127877
|
-
_this.
|
|
127878
|
-
_this.
|
|
127879
|
-
_this.
|
|
127880
|
-
_this._addressIsCaseSensitive = false;
|
|
127881
|
-
_this.addressIsCaseSensitive = Promise.resolve(_this._addressIsCaseSensitive);
|
|
127882
|
-
_this._addressValidationPattern = '^(cosmos|cosmosvaloper)[a-zA-Z0-9]{39}$';
|
|
127883
|
-
_this.addressValidationPattern = Promise.resolve(_this._addressValidationPattern);
|
|
127884
|
-
_this._addressPlaceholder = 'cosmos...';
|
|
127885
|
-
_this.addressPlaceholder = Promise.resolve(_this._addressPlaceholder);
|
|
128041
|
+
_this.supportsHD = false;
|
|
128042
|
+
_this.standardDerivationPath = "m/44'/118'/0'/0/0";
|
|
128043
|
+
_this.addressIsCaseSensitive = false;
|
|
128044
|
+
_this.addressValidationPattern = '^(cosmos|cosmosvaloper)[a-zA-Z0-9]{39}$';
|
|
128045
|
+
_this.addressPlaceholder = 'cosmos...';
|
|
127886
128046
|
_this.defaultGas = new bignumber_1.default('200000');
|
|
127887
128047
|
_this.cryptoClient = new CosmosCryptoClient_1.CosmosCryptoClient();
|
|
127888
|
-
_this.options = Promise.resolve(_this._options);
|
|
127889
128048
|
return _this;
|
|
127890
128049
|
}
|
|
127891
128050
|
Object.defineProperty(CosmosProtocol.prototype, "nodeClient", {
|
|
@@ -127895,6 +128054,111 @@ var CosmosProtocol = /** @class */ (function (_super) {
|
|
|
127895
128054
|
enumerable: false,
|
|
127896
128055
|
configurable: true
|
|
127897
128056
|
});
|
|
128057
|
+
CosmosProtocol.prototype.getSymbol = function () {
|
|
128058
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128059
|
+
return __generator(this, function (_a) {
|
|
128060
|
+
return [2 /*return*/, this.symbol];
|
|
128061
|
+
});
|
|
128062
|
+
});
|
|
128063
|
+
};
|
|
128064
|
+
CosmosProtocol.prototype.getName = function () {
|
|
128065
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128066
|
+
return __generator(this, function (_a) {
|
|
128067
|
+
return [2 /*return*/, this.name];
|
|
128068
|
+
});
|
|
128069
|
+
});
|
|
128070
|
+
};
|
|
128071
|
+
CosmosProtocol.prototype.getMarketSymbol = function () {
|
|
128072
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128073
|
+
return __generator(this, function (_a) {
|
|
128074
|
+
return [2 /*return*/, this.marketSymbol];
|
|
128075
|
+
});
|
|
128076
|
+
});
|
|
128077
|
+
};
|
|
128078
|
+
CosmosProtocol.prototype.getFeeSymbol = function () {
|
|
128079
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128080
|
+
return __generator(this, function (_a) {
|
|
128081
|
+
return [2 /*return*/, this.feeSymbol];
|
|
128082
|
+
});
|
|
128083
|
+
});
|
|
128084
|
+
};
|
|
128085
|
+
CosmosProtocol.prototype.getFeeDefaults = function () {
|
|
128086
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128087
|
+
return __generator(this, function (_a) {
|
|
128088
|
+
return [2 /*return*/, this.feeDefaults];
|
|
128089
|
+
});
|
|
128090
|
+
});
|
|
128091
|
+
};
|
|
128092
|
+
CosmosProtocol.prototype.getDecimals = function () {
|
|
128093
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128094
|
+
return __generator(this, function (_a) {
|
|
128095
|
+
return [2 /*return*/, this.decimals];
|
|
128096
|
+
});
|
|
128097
|
+
});
|
|
128098
|
+
};
|
|
128099
|
+
CosmosProtocol.prototype.getFeeDecimals = function () {
|
|
128100
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128101
|
+
return __generator(this, function (_a) {
|
|
128102
|
+
return [2 /*return*/, this.feeDecimals];
|
|
128103
|
+
});
|
|
128104
|
+
});
|
|
128105
|
+
};
|
|
128106
|
+
CosmosProtocol.prototype.getIdentifier = function () {
|
|
128107
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128108
|
+
return __generator(this, function (_a) {
|
|
128109
|
+
return [2 /*return*/, this.identifier];
|
|
128110
|
+
});
|
|
128111
|
+
});
|
|
128112
|
+
};
|
|
128113
|
+
CosmosProtocol.prototype.getUnits = function () {
|
|
128114
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128115
|
+
return __generator(this, function (_a) {
|
|
128116
|
+
return [2 /*return*/, this.units];
|
|
128117
|
+
});
|
|
128118
|
+
});
|
|
128119
|
+
};
|
|
128120
|
+
CosmosProtocol.prototype.getSupportsHD = function () {
|
|
128121
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128122
|
+
return __generator(this, function (_a) {
|
|
128123
|
+
return [2 /*return*/, this.supportsHD];
|
|
128124
|
+
});
|
|
128125
|
+
});
|
|
128126
|
+
};
|
|
128127
|
+
CosmosProtocol.prototype.getStandardDerivationPath = function () {
|
|
128128
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128129
|
+
return __generator(this, function (_a) {
|
|
128130
|
+
return [2 /*return*/, this.standardDerivationPath];
|
|
128131
|
+
});
|
|
128132
|
+
});
|
|
128133
|
+
};
|
|
128134
|
+
CosmosProtocol.prototype.getAddressIsCaseSensitive = function () {
|
|
128135
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128136
|
+
return __generator(this, function (_a) {
|
|
128137
|
+
return [2 /*return*/, this.addressIsCaseSensitive];
|
|
128138
|
+
});
|
|
128139
|
+
});
|
|
128140
|
+
};
|
|
128141
|
+
CosmosProtocol.prototype.getAddressValidationPattern = function () {
|
|
128142
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128143
|
+
return __generator(this, function (_a) {
|
|
128144
|
+
return [2 /*return*/, this.addressValidationPattern];
|
|
128145
|
+
});
|
|
128146
|
+
});
|
|
128147
|
+
};
|
|
128148
|
+
CosmosProtocol.prototype.getAddressPlaceholder = function () {
|
|
128149
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128150
|
+
return __generator(this, function (_a) {
|
|
128151
|
+
return [2 /*return*/, this.addressPlaceholder];
|
|
128152
|
+
});
|
|
128153
|
+
});
|
|
128154
|
+
};
|
|
128155
|
+
CosmosProtocol.prototype.getOptions = function () {
|
|
128156
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128157
|
+
return __generator(this, function (_a) {
|
|
128158
|
+
return [2 /*return*/, this._options];
|
|
128159
|
+
});
|
|
128160
|
+
});
|
|
128161
|
+
};
|
|
127898
128162
|
CosmosProtocol.prototype.getBlockExplorerLinkForAddress = function (address) {
|
|
127899
128163
|
return __awaiter(this, void 0, void 0, function () {
|
|
127900
128164
|
return __generator(this, function (_a) {
|
|
@@ -127910,7 +128174,7 @@ var CosmosProtocol = /** @class */ (function (_super) {
|
|
|
127910
128174
|
});
|
|
127911
128175
|
};
|
|
127912
128176
|
CosmosProtocol.prototype.generateKeyPair = function (mnemonic, derivationPath, password) {
|
|
127913
|
-
if (derivationPath === void 0) { derivationPath = this.
|
|
128177
|
+
if (derivationPath === void 0) { derivationPath = this.standardDerivationPath; }
|
|
127914
128178
|
index_2.validateMnemonic(mnemonic);
|
|
127915
128179
|
var seed = index_2.mnemonicToSeed(mnemonic, password);
|
|
127916
128180
|
var node = index_1.fromSeed(seed);
|
|
@@ -128071,7 +128335,7 @@ var CosmosProtocol = /** @class */ (function (_super) {
|
|
|
128071
128335
|
result = result.concat(transaction.tx.body.messages.map(function (msg) {
|
|
128072
128336
|
var tx = {
|
|
128073
128337
|
fee: fee.toFixed(),
|
|
128074
|
-
protocolIdentifier: _this.
|
|
128338
|
+
protocolIdentifier: _this.identifier,
|
|
128075
128339
|
network: _this._options.network,
|
|
128076
128340
|
hash: transaction.txhash,
|
|
128077
128341
|
timestamp: timestamp,
|
|
@@ -128147,7 +128411,7 @@ var CosmosProtocol = /** @class */ (function (_super) {
|
|
|
128147
128411
|
return __awaiter(this, void 0, void 0, function () {
|
|
128148
128412
|
var result;
|
|
128149
128413
|
return __generator(this, function (_a) {
|
|
128150
|
-
result = transaction.transaction.toAirGapTransactions(this.
|
|
128414
|
+
result = transaction.transaction.toAirGapTransactions(this.identifier, this._options.network);
|
|
128151
128415
|
return [2 /*return*/, result];
|
|
128152
128416
|
});
|
|
128153
128417
|
});
|
|
@@ -128177,14 +128441,14 @@ var CosmosProtocol = /** @class */ (function (_super) {
|
|
|
128177
128441
|
switch (type) {
|
|
128178
128442
|
case CosmosMessage_1.CosmosMessageType.Send.value:
|
|
128179
128443
|
var sendMessage = CosmosSendMessage_1.CosmosSendMessage.fromEncodeObject(message);
|
|
128180
|
-
return sendMessage.toAirGapTransaction(_this.
|
|
128444
|
+
return sendMessage.toAirGapTransaction(_this.identifier, _this._options.network, fee);
|
|
128181
128445
|
case CosmosMessage_1.CosmosMessageType.Undelegate.value:
|
|
128182
128446
|
case CosmosMessage_1.CosmosMessageType.Delegate.value:
|
|
128183
128447
|
var delegateMessage = CosmosDelegateMessage_1.CosmosDelegateMessage.fromEncodeObject(message);
|
|
128184
|
-
return delegateMessage.toAirGapTransaction(_this.
|
|
128448
|
+
return delegateMessage.toAirGapTransaction(_this.identifier, _this._options.network, fee);
|
|
128185
128449
|
case CosmosMessage_1.CosmosMessageType.WithdrawDelegationReward.value:
|
|
128186
128450
|
var withdrawMessage = CosmosWithdrawDelegationRewardMessage_1.CosmosWithdrawDelegationRewardMessage.fromEncodeObject(message);
|
|
128187
|
-
return withdrawMessage.toAirGapTransaction(_this.
|
|
128451
|
+
return withdrawMessage.toAirGapTransaction(_this.identifier, _this._options.network, fee);
|
|
128188
128452
|
default:
|
|
128189
128453
|
throw new errors_1.InvalidValueError(coinlib_error_1.Domain.COSMOS, 'Unknown transaction');
|
|
128190
128454
|
}
|
|
@@ -128278,7 +128542,7 @@ var CosmosProtocol = /** @class */ (function (_super) {
|
|
|
128278
128542
|
case 3: return [4 /*yield*/, this.estimateFeeDefaultsFromPublicKey(publicKey, recipients, [balance])];
|
|
128279
128543
|
case 4:
|
|
128280
128544
|
estimatedFeeDefaults = _a.sent();
|
|
128281
|
-
maxFee = new bignumber_1.default(estimatedFeeDefaults.medium).shiftedBy(this.
|
|
128545
|
+
maxFee = new bignumber_1.default(estimatedFeeDefaults.medium).shiftedBy(this.decimals);
|
|
128282
128546
|
if (maxFee.gte(balanceWrapper)) {
|
|
128283
128547
|
maxFee = new bignumber_1.default(0);
|
|
128284
128548
|
}
|
|
@@ -128538,7 +128802,7 @@ var CosmosProtocol = /** @class */ (function (_super) {
|
|
|
128538
128802
|
case 3:
|
|
128539
128803
|
account = _b.sent();
|
|
128540
128804
|
message = new CosmosDelegateMessage_1.CosmosDelegateMessage(address, Array.isArray(validatorAddress) ? validatorAddress[0] : validatorAddress, new CosmosCoin_1.CosmosCoin('uatom', amount), undelegate);
|
|
128541
|
-
return [2 /*return*/, new CosmosTransaction_1.CosmosTransaction([message], new CosmosFee_1.CosmosFee([new CosmosCoin_1.CosmosCoin('uatom', new bignumber_1.default(this.
|
|
128805
|
+
return [2 /*return*/, new CosmosTransaction_1.CosmosTransaction([message], new CosmosFee_1.CosmosFee([new CosmosCoin_1.CosmosCoin('uatom', new bignumber_1.default(this.feeDefaults.low).shiftedBy(this.feeDecimals).toString(10))], this.defaultGas.toString(10)), memo !== undefined ? memo : '', nodeInfo.network, account.value.account_number, (_a = account.value.sequence) !== null && _a !== void 0 ? _a : '0')];
|
|
128542
128806
|
}
|
|
128543
128807
|
});
|
|
128544
128808
|
});
|
|
@@ -128578,7 +128842,7 @@ var CosmosProtocol = /** @class */ (function (_super) {
|
|
|
128578
128842
|
case 7:
|
|
128579
128843
|
account = _b.sent();
|
|
128580
128844
|
messages = validatorAddresses.map(function (validatorAddress) { return new CosmosWithdrawDelegationRewardMessage_1.CosmosWithdrawDelegationRewardMessage(address, validatorAddress); });
|
|
128581
|
-
return [2 /*return*/, new CosmosTransaction_1.CosmosTransaction(messages, new CosmosFee_1.CosmosFee([new CosmosCoin_1.CosmosCoin('uatom', new bignumber_1.default(this.
|
|
128845
|
+
return [2 /*return*/, new CosmosTransaction_1.CosmosTransaction(messages, new CosmosFee_1.CosmosFee([new CosmosCoin_1.CosmosCoin('uatom', new bignumber_1.default(this.feeDefaults.low).shiftedBy(this.feeDecimals).toString(10))], this.defaultGas.toString(10)), memo !== undefined ? memo : '', nodeInfo.network, account.value.account_number, (_a = account.value.sequence) !== null && _a !== void 0 ? _a : '0')];
|
|
128582
128846
|
}
|
|
128583
128847
|
});
|
|
128584
128848
|
});
|
|
@@ -128718,7 +128982,7 @@ var CosmosProtocol = /** @class */ (function (_super) {
|
|
|
128718
128982
|
};
|
|
128719
128983
|
CosmosProtocol.prototype.getAvailableDelegatorActions = function (isDelegating, availableBalance, unclaimedTotalRewards, unclaimedDelegationRewards) {
|
|
128720
128984
|
var actions = [];
|
|
128721
|
-
var requiredFee = new bignumber_1.default(this.
|
|
128985
|
+
var requiredFee = new bignumber_1.default(this.feeDefaults.low).shiftedBy(this.feeDecimals);
|
|
128722
128986
|
var hasSufficientBalance = availableBalance.gt(requiredFee);
|
|
128723
128987
|
if (hasSufficientBalance) {
|
|
128724
128988
|
actions.push({
|
|
@@ -129388,31 +129652,23 @@ var common_1 = __importDefault(require("@ethereumjs/common"));
|
|
|
129388
129652
|
// TODO: ETH TX and ethereumjs-util-5.2.0 removed
|
|
129389
129653
|
var tx_1 = require("@ethereumjs/tx");
|
|
129390
129654
|
var BaseEthereumProtocol = /** @class */ (function () {
|
|
129391
|
-
function BaseEthereumProtocol(
|
|
129392
|
-
if (
|
|
129393
|
-
this.
|
|
129394
|
-
this.
|
|
129395
|
-
this.
|
|
129396
|
-
this.
|
|
129397
|
-
this.
|
|
129398
|
-
this.
|
|
129399
|
-
this.marketSymbol = Promise.resolve(this._marketSymbol);
|
|
129400
|
-
this._feeSymbol = 'eth';
|
|
129401
|
-
this.feeSymbol = Promise.resolve(this._feeSymbol);
|
|
129402
|
-
this._feeDefaults = {
|
|
129655
|
+
function BaseEthereumProtocol(options) {
|
|
129656
|
+
if (options === void 0) { options = new EthereumProtocolOptions_1.EthereumProtocolOptions(); }
|
|
129657
|
+
this.options = options;
|
|
129658
|
+
this.symbol = 'ETH';
|
|
129659
|
+
this.name = 'Ethereum';
|
|
129660
|
+
this.marketSymbol = 'eth';
|
|
129661
|
+
this.feeSymbol = 'eth';
|
|
129662
|
+
this.feeDefaults = {
|
|
129403
129663
|
low: '0.00021',
|
|
129404
129664
|
medium: '0.000315',
|
|
129405
129665
|
high: '0.00084' // 21000 Gas * 40 Gwei
|
|
129406
129666
|
};
|
|
129407
|
-
this.
|
|
129408
|
-
this.
|
|
129409
|
-
this.
|
|
129410
|
-
this._feeDecimals = 18;
|
|
129411
|
-
this.feeDecimals = Promise.resolve(this._feeDecimals);
|
|
129412
|
-
this._identifier = ProtocolSymbols_1.MainProtocolSymbols.ETH;
|
|
129413
|
-
this.identifier = Promise.resolve(this._identifier);
|
|
129667
|
+
this.decimals = 18;
|
|
129668
|
+
this.feeDecimals = 18;
|
|
129669
|
+
this.identifier = ProtocolSymbols_1.MainProtocolSymbols.ETH;
|
|
129414
129670
|
this.MAX_GAS_ESTIMATE = '300000';
|
|
129415
|
-
this.
|
|
129671
|
+
this.units = [
|
|
129416
129672
|
{
|
|
129417
129673
|
unitSymbol: 'ETH',
|
|
129418
129674
|
factor: '1'
|
|
@@ -129426,32 +129682,130 @@ var BaseEthereumProtocol = /** @class */ (function () {
|
|
|
129426
129682
|
factor: '0.000000000000000001'
|
|
129427
129683
|
}
|
|
129428
129684
|
];
|
|
129429
|
-
this.
|
|
129430
|
-
this.
|
|
129431
|
-
this.
|
|
129432
|
-
this.
|
|
129433
|
-
this.
|
|
129434
|
-
this._addressIsCaseSensitive = false;
|
|
129435
|
-
this.addressIsCaseSensitive = Promise.resolve(this._addressIsCaseSensitive);
|
|
129436
|
-
this._addressValidationPattern = '^0x[a-fA-F0-9]{40}$';
|
|
129437
|
-
this.addressValidationPattern = Promise.resolve(this._addressValidationPattern);
|
|
129438
|
-
this._addressPlaceholder = '0xabc...';
|
|
129439
|
-
this.addressPlaceholder = Promise.resolve(this._addressPlaceholder);
|
|
129440
|
-
this.options = Promise.resolve(this._options);
|
|
129685
|
+
this.supportsHD = false;
|
|
129686
|
+
this.standardDerivationPath = "m/44'/60'/0'/0/0";
|
|
129687
|
+
this.addressIsCaseSensitive = false;
|
|
129688
|
+
this.addressValidationPattern = '^0x[a-fA-F0-9]{40}$';
|
|
129689
|
+
this.addressPlaceholder = '0xabc...';
|
|
129441
129690
|
this.cryptoClient = new EthereumCryptoClient_1.EthereumCryptoClient(this);
|
|
129442
129691
|
this.network = bitcoinJS.networks.bitcoin;
|
|
129443
129692
|
}
|
|
129693
|
+
BaseEthereumProtocol.prototype.getSymbol = function () {
|
|
129694
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
129695
|
+
return __generator(this, function (_a) {
|
|
129696
|
+
return [2 /*return*/, this.symbol];
|
|
129697
|
+
});
|
|
129698
|
+
});
|
|
129699
|
+
};
|
|
129700
|
+
BaseEthereumProtocol.prototype.getName = function () {
|
|
129701
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
129702
|
+
return __generator(this, function (_a) {
|
|
129703
|
+
return [2 /*return*/, this.name];
|
|
129704
|
+
});
|
|
129705
|
+
});
|
|
129706
|
+
};
|
|
129707
|
+
BaseEthereumProtocol.prototype.getMarketSymbol = function () {
|
|
129708
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
129709
|
+
return __generator(this, function (_a) {
|
|
129710
|
+
return [2 /*return*/, this.marketSymbol];
|
|
129711
|
+
});
|
|
129712
|
+
});
|
|
129713
|
+
};
|
|
129714
|
+
BaseEthereumProtocol.prototype.getFeeSymbol = function () {
|
|
129715
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
129716
|
+
return __generator(this, function (_a) {
|
|
129717
|
+
return [2 /*return*/, this.feeSymbol];
|
|
129718
|
+
});
|
|
129719
|
+
});
|
|
129720
|
+
};
|
|
129721
|
+
BaseEthereumProtocol.prototype.getFeeDefaults = function () {
|
|
129722
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
129723
|
+
return __generator(this, function (_a) {
|
|
129724
|
+
return [2 /*return*/, this.feeDefaults];
|
|
129725
|
+
});
|
|
129726
|
+
});
|
|
129727
|
+
};
|
|
129728
|
+
BaseEthereumProtocol.prototype.getDecimals = function () {
|
|
129729
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
129730
|
+
return __generator(this, function (_a) {
|
|
129731
|
+
return [2 /*return*/, this.decimals];
|
|
129732
|
+
});
|
|
129733
|
+
});
|
|
129734
|
+
};
|
|
129735
|
+
BaseEthereumProtocol.prototype.getFeeDecimals = function () {
|
|
129736
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
129737
|
+
return __generator(this, function (_a) {
|
|
129738
|
+
return [2 /*return*/, this.feeDecimals];
|
|
129739
|
+
});
|
|
129740
|
+
});
|
|
129741
|
+
};
|
|
129742
|
+
BaseEthereumProtocol.prototype.getIdentifier = function () {
|
|
129743
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
129744
|
+
return __generator(this, function (_a) {
|
|
129745
|
+
return [2 /*return*/, this.identifier];
|
|
129746
|
+
});
|
|
129747
|
+
});
|
|
129748
|
+
};
|
|
129749
|
+
BaseEthereumProtocol.prototype.getUnits = function () {
|
|
129750
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
129751
|
+
return __generator(this, function (_a) {
|
|
129752
|
+
return [2 /*return*/, this.units];
|
|
129753
|
+
});
|
|
129754
|
+
});
|
|
129755
|
+
};
|
|
129756
|
+
BaseEthereumProtocol.prototype.getSupportsHD = function () {
|
|
129757
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
129758
|
+
return __generator(this, function (_a) {
|
|
129759
|
+
return [2 /*return*/, this.supportsHD];
|
|
129760
|
+
});
|
|
129761
|
+
});
|
|
129762
|
+
};
|
|
129763
|
+
BaseEthereumProtocol.prototype.getStandardDerivationPath = function () {
|
|
129764
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
129765
|
+
return __generator(this, function (_a) {
|
|
129766
|
+
return [2 /*return*/, this.standardDerivationPath];
|
|
129767
|
+
});
|
|
129768
|
+
});
|
|
129769
|
+
};
|
|
129770
|
+
BaseEthereumProtocol.prototype.getAddressIsCaseSensitive = function () {
|
|
129771
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
129772
|
+
return __generator(this, function (_a) {
|
|
129773
|
+
return [2 /*return*/, this.addressIsCaseSensitive];
|
|
129774
|
+
});
|
|
129775
|
+
});
|
|
129776
|
+
};
|
|
129777
|
+
BaseEthereumProtocol.prototype.getAddressValidationPattern = function () {
|
|
129778
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
129779
|
+
return __generator(this, function (_a) {
|
|
129780
|
+
return [2 /*return*/, this.addressValidationPattern];
|
|
129781
|
+
});
|
|
129782
|
+
});
|
|
129783
|
+
};
|
|
129784
|
+
BaseEthereumProtocol.prototype.getAddressPlaceholder = function () {
|
|
129785
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
129786
|
+
return __generator(this, function (_a) {
|
|
129787
|
+
return [2 /*return*/, this.addressPlaceholder];
|
|
129788
|
+
});
|
|
129789
|
+
});
|
|
129790
|
+
};
|
|
129791
|
+
BaseEthereumProtocol.prototype.getOptions = function () {
|
|
129792
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
129793
|
+
return __generator(this, function (_a) {
|
|
129794
|
+
return [2 /*return*/, this.options];
|
|
129795
|
+
});
|
|
129796
|
+
});
|
|
129797
|
+
};
|
|
129444
129798
|
BaseEthereumProtocol.prototype.getBlockExplorerLinkForAddress = function (address) {
|
|
129445
129799
|
return __awaiter(this, void 0, void 0, function () {
|
|
129446
129800
|
return __generator(this, function (_a) {
|
|
129447
|
-
return [2 /*return*/, this.
|
|
129801
|
+
return [2 /*return*/, this.options.network.blockExplorer.getAddressLink(address)];
|
|
129448
129802
|
});
|
|
129449
129803
|
});
|
|
129450
129804
|
};
|
|
129451
129805
|
BaseEthereumProtocol.prototype.getBlockExplorerLinkForTxId = function (txId) {
|
|
129452
129806
|
return __awaiter(this, void 0, void 0, function () {
|
|
129453
129807
|
return __generator(this, function (_a) {
|
|
129454
|
-
return [2 /*return*/, this.
|
|
129808
|
+
return [2 /*return*/, this.options.network.blockExplorer.getTransactionLink(txId)];
|
|
129455
129809
|
});
|
|
129456
129810
|
});
|
|
129457
129811
|
};
|
|
@@ -129675,8 +130029,8 @@ var BaseEthereumProtocol = /** @class */ (function () {
|
|
|
129675
130029
|
fee: new bignumber_1.BigNumber(transaction.gasLimit.toString(10))
|
|
129676
130030
|
.multipliedBy(new bignumber_1.BigNumber(transaction.maxFeePerGas.toString(10)))
|
|
129677
130031
|
.toString(10),
|
|
129678
|
-
protocolIdentifier: this.
|
|
129679
|
-
network: this.
|
|
130032
|
+
protocolIdentifier: this.identifier,
|
|
130033
|
+
network: this.options.network,
|
|
129680
130034
|
isInbound: false,
|
|
129681
130035
|
data: transaction.data.toString('hex'),
|
|
129682
130036
|
transactionDetails: unsignedTx
|
|
@@ -129714,8 +130068,8 @@ var BaseEthereumProtocol = /** @class */ (function () {
|
|
|
129714
130068
|
to: [transaction.to],
|
|
129715
130069
|
amount: new bignumber_1.BigNumber(transaction.value).toString(10),
|
|
129716
130070
|
fee: new bignumber_1.BigNumber(transaction.gasLimit).multipliedBy(new bignumber_1.BigNumber(transaction.gasPrice)).toString(10),
|
|
129717
|
-
protocolIdentifier: this.
|
|
129718
|
-
network: this.
|
|
130071
|
+
protocolIdentifier: this.identifier,
|
|
130072
|
+
network: this.options.network,
|
|
129719
130073
|
isInbound: false,
|
|
129720
130074
|
data: transaction.data,
|
|
129721
130075
|
transactionDetails: unsignedTx
|
|
@@ -129748,8 +130102,8 @@ var BaseEthereumProtocol = /** @class */ (function () {
|
|
|
129748
130102
|
to: [to.toString()],
|
|
129749
130103
|
amount: new bignumber_1.BigNumber(parseInt(hexValue, 16)).toString(10),
|
|
129750
130104
|
fee: new bignumber_1.BigNumber(parseInt(hexGasLimit, 16)).multipliedBy(new bignumber_1.BigNumber(parseInt(hexGasPrice, 16))).toString(10),
|
|
129751
|
-
protocolIdentifier: this.
|
|
129752
|
-
network: this.
|
|
130105
|
+
protocolIdentifier: this.identifier,
|
|
130106
|
+
network: this.options.network,
|
|
129753
130107
|
isInbound: tx.toCreationAddress(),
|
|
129754
130108
|
hash: "0x" + tx.hash().toString('hex'),
|
|
129755
130109
|
data: "0x" + tx.data.toString('hex'),
|
|
@@ -129769,8 +130123,8 @@ var BaseEthereumProtocol = /** @class */ (function () {
|
|
|
129769
130123
|
to: [(_b = (_a = feeTx.to) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ''],
|
|
129770
130124
|
amount: new bignumber_1.BigNumber(feeTx.value.toString(10)).toString(10),
|
|
129771
130125
|
fee: new bignumber_1.BigNumber(feeTx.gasLimit.toString(10)).multipliedBy(new bignumber_1.BigNumber(feeTx.maxFeePerGas.toString(10))).toString(10),
|
|
129772
|
-
protocolIdentifier: this.
|
|
129773
|
-
network: this.
|
|
130126
|
+
protocolIdentifier: this.identifier,
|
|
130127
|
+
network: this.options.network,
|
|
129774
130128
|
isInbound: false,
|
|
129775
130129
|
data: feeTx.data.toString('hex'),
|
|
129776
130130
|
extra: {
|
|
@@ -129808,7 +130162,7 @@ var BaseEthereumProtocol = /** @class */ (function () {
|
|
|
129808
130162
|
return __generator(this, function (_a) {
|
|
129809
130163
|
switch (_a.label) {
|
|
129810
130164
|
case 0: return [4 /*yield*/, Promise.all(addresses.map(function (address) {
|
|
129811
|
-
return _this.
|
|
130165
|
+
return _this.options.nodeClient.fetchBalance(address);
|
|
129812
130166
|
}))];
|
|
129813
130167
|
case 1:
|
|
129814
130168
|
balances = _a.sent();
|
|
@@ -129837,10 +130191,10 @@ var BaseEthereumProtocol = /** @class */ (function () {
|
|
|
129837
130191
|
var subProtocolType, subProtocolContractAddress;
|
|
129838
130192
|
return __generator(this, function (_a) {
|
|
129839
130193
|
switch (_a.label) {
|
|
129840
|
-
case 0: return [4 /*yield*/, subProtocol.
|
|
130194
|
+
case 0: return [4 /*yield*/, subProtocol.getSubProtocolType()];
|
|
129841
130195
|
case 1:
|
|
129842
130196
|
subProtocolType = _a.sent();
|
|
129843
|
-
return [4 /*yield*/, subProtocol.
|
|
130197
|
+
return [4 /*yield*/, subProtocol.getContractAddress()];
|
|
129844
130198
|
case 2:
|
|
129845
130199
|
subProtocolContractAddress = _a.sent();
|
|
129846
130200
|
if (subProtocolType === ICoinSubProtocol_1.SubProtocolType.TOKEN && subProtocolContractAddress) {
|
|
@@ -129855,7 +130209,7 @@ var BaseEthereumProtocol = /** @class */ (function () {
|
|
|
129855
130209
|
}); }))];
|
|
129856
130210
|
case 2:
|
|
129857
130211
|
contractAddresses = _a.sent();
|
|
129858
|
-
return [4 /*yield*/, this.
|
|
130212
|
+
return [4 /*yield*/, this.options.nodeClient.callBalanceOfOnContracts(contractAddresses, address)];
|
|
129859
130213
|
case 3:
|
|
129860
130214
|
balances = _a.sent();
|
|
129861
130215
|
return [2 /*return*/, contractAddresses.map(function (contractAddresse) { var _a, _b; return (_b = (_a = balances[contractAddresse]) === null || _a === void 0 ? void 0 : _a.toFixed()) !== null && _b !== void 0 ? _b : '0'; })];
|
|
@@ -129938,7 +130292,7 @@ var BaseEthereumProtocol = /** @class */ (function () {
|
|
|
129938
130292
|
case 2: return [4 /*yield*/, this.estimateFeeDefaultsFromPublicKey(publicKey, recipients, [balance])];
|
|
129939
130293
|
case 3:
|
|
129940
130294
|
estimatedFeeDefaults = _a.sent();
|
|
129941
|
-
maxFee = new bignumber_1.BigNumber(estimatedFeeDefaults.medium).shiftedBy(this.
|
|
130295
|
+
maxFee = new bignumber_1.BigNumber(estimatedFeeDefaults.medium).shiftedBy(this.decimals);
|
|
129942
130296
|
if (maxFee.gte(balanceWrapper)) {
|
|
129943
130297
|
maxFee = new bignumber_1.BigNumber(0);
|
|
129944
130298
|
}
|
|
@@ -129968,10 +130322,10 @@ var BaseEthereumProtocol = /** @class */ (function () {
|
|
|
129968
130322
|
return [4 /*yield*/, this.getAddressFromPublicKey(publicKey).then(function (address) { return address.address; })];
|
|
129969
130323
|
case 1:
|
|
129970
130324
|
address = _a.sent();
|
|
129971
|
-
return [4 /*yield*/, this.
|
|
130325
|
+
return [4 /*yield*/, this.options.nodeClient.estimateTransactionGas(address, recipients[0], utils_1.EthereumUtils.toHex(values[0]), undefined, utils_1.EthereumUtils.toHex(this.MAX_GAS_ESTIMATE))];
|
|
129972
130326
|
case 2:
|
|
129973
130327
|
estimatedGas = _a.sent();
|
|
129974
|
-
return [4 /*yield*/, this.
|
|
130328
|
+
return [4 /*yield*/, this.options.nodeClient.getGasPrice()];
|
|
129975
130329
|
case 3:
|
|
129976
130330
|
gasPrise = _a.sent();
|
|
129977
130331
|
feeStepFactor = new bignumber_1.BigNumber(0.5);
|
|
@@ -129980,9 +130334,9 @@ var BaseEthereumProtocol = /** @class */ (function () {
|
|
|
129980
130334
|
mediumFee = estimatedFee;
|
|
129981
130335
|
highFee = mediumFee.plus(mediumFee.times(feeStepFactor).integerValue(bignumber_1.BigNumber.ROUND_FLOOR));
|
|
129982
130336
|
return [2 /*return*/, {
|
|
129983
|
-
low: lowFee.shiftedBy(-this.
|
|
129984
|
-
medium: mediumFee.shiftedBy(-this.
|
|
129985
|
-
high: highFee.shiftedBy(-this.
|
|
130337
|
+
low: lowFee.shiftedBy(-this.getFeeDecimals).toFixed(),
|
|
130338
|
+
medium: mediumFee.shiftedBy(-this.getFeeDecimals).toFixed(),
|
|
130339
|
+
high: highFee.shiftedBy(-this.getFeeDecimals).toFixed()
|
|
129986
130340
|
}];
|
|
129987
130341
|
}
|
|
129988
130342
|
});
|
|
@@ -130009,12 +130363,12 @@ var BaseEthereumProtocol = /** @class */ (function () {
|
|
|
130009
130363
|
return [4 /*yield*/, this.getBalanceOfPublicKey(publicKey)];
|
|
130010
130364
|
case 2:
|
|
130011
130365
|
balance = _a.sent();
|
|
130012
|
-
return [4 /*yield*/, this.
|
|
130366
|
+
return [4 /*yield*/, this.options.nodeClient.estimateTransactionGas(address, recipients[0], amount, undefined, utils_1.EthereumUtils.toHex(this.MAX_GAS_ESTIMATE))];
|
|
130013
130367
|
case 3:
|
|
130014
130368
|
gasLimit = _a.sent();
|
|
130015
130369
|
gasPrice = wrappedFee.div(gasLimit).integerValue(bignumber_1.BigNumber.ROUND_CEIL);
|
|
130016
130370
|
if (!new bignumber_1.BigNumber(balance).gte(new bignumber_1.BigNumber(wrappedValues[0].plus(wrappedFee)))) return [3 /*break*/, 5];
|
|
130017
|
-
return [4 /*yield*/, this.
|
|
130371
|
+
return [4 /*yield*/, this.options.nodeClient.fetchTransactionCount(address)];
|
|
130018
130372
|
case 4:
|
|
130019
130373
|
txCount = _a.sent();
|
|
130020
130374
|
transaction = {
|
|
@@ -130023,7 +130377,7 @@ var BaseEthereumProtocol = /** @class */ (function () {
|
|
|
130023
130377
|
gasPrice: utils_1.EthereumUtils.toHex(gasPrice.toFixed()),
|
|
130024
130378
|
to: recipients[0],
|
|
130025
130379
|
value: amount,
|
|
130026
|
-
chainId: this.
|
|
130380
|
+
chainId: this.options.network.extras.chainID,
|
|
130027
130381
|
data: '0x'
|
|
130028
130382
|
};
|
|
130029
130383
|
return [2 /*return*/, transaction];
|
|
@@ -130035,7 +130389,7 @@ var BaseEthereumProtocol = /** @class */ (function () {
|
|
|
130035
130389
|
BaseEthereumProtocol.prototype.broadcastTransaction = function (rawTransaction) {
|
|
130036
130390
|
return __awaiter(this, void 0, void 0, function () {
|
|
130037
130391
|
return __generator(this, function (_a) {
|
|
130038
|
-
return [2 /*return*/, this.
|
|
130392
|
+
return [2 /*return*/, this.options.nodeClient.sendSignedTransaction("0x" + rawTransaction)];
|
|
130039
130393
|
});
|
|
130040
130394
|
});
|
|
130041
130395
|
};
|
|
@@ -130072,7 +130426,7 @@ var BaseEthereumProtocol = /** @class */ (function () {
|
|
|
130072
130426
|
var promises = [];
|
|
130073
130427
|
for (var _i = 0, addresses_1 = addresses; _i < addresses_1.length; _i++) {
|
|
130074
130428
|
var address = addresses_1[_i];
|
|
130075
|
-
promises.push(_this.
|
|
130429
|
+
promises.push(_this.options.infoClient.fetchTransactions(_this, address, limit, cursor));
|
|
130076
130430
|
}
|
|
130077
130431
|
Promise.all(promises)
|
|
130078
130432
|
.then(function (values) {
|
|
@@ -130132,7 +130486,7 @@ var BaseEthereumProtocol = /** @class */ (function () {
|
|
|
130132
130486
|
var _this = this;
|
|
130133
130487
|
return __generator(this, function (_a) {
|
|
130134
130488
|
statusPromises = transactionHashes.map(function (txHash) {
|
|
130135
|
-
return _this.
|
|
130489
|
+
return _this.options.nodeClient.getTransactionStatus(txHash);
|
|
130136
130490
|
});
|
|
130137
130491
|
return [2 /*return*/, Promise.all(statusPromises)];
|
|
130138
130492
|
});
|
|
@@ -130719,14 +131073,12 @@ var BaseEthereumProtocol_1 = require("./BaseEthereumProtocol");
|
|
|
130719
131073
|
var EthereumProtocolOptions_1 = require("./EthereumProtocolOptions");
|
|
130720
131074
|
var EthereumProtocol = /** @class */ (function (_super) {
|
|
130721
131075
|
__extends(EthereumProtocol, _super);
|
|
130722
|
-
function EthereumProtocol(
|
|
130723
|
-
if (
|
|
130724
|
-
var _this = _super.call(this,
|
|
130725
|
-
_this.
|
|
130726
|
-
_this.
|
|
130727
|
-
_this.
|
|
130728
|
-
_this._standardDerivationPath = "m/44'/60'/0'";
|
|
130729
|
-
_this.standardDerivationPath = Promise.resolve(_this._standardDerivationPath);
|
|
131076
|
+
function EthereumProtocol(options) {
|
|
131077
|
+
if (options === void 0) { options = new EthereumProtocolOptions_1.EthereumProtocolOptions(); }
|
|
131078
|
+
var _this = _super.call(this, options) || this;
|
|
131079
|
+
_this.options = options;
|
|
131080
|
+
_this.supportsHD = true;
|
|
131081
|
+
_this.standardDerivationPath = "m/44'/60'/0'";
|
|
130730
131082
|
return _this;
|
|
130731
131083
|
}
|
|
130732
131084
|
return EthereumProtocol;
|
|
@@ -131015,10 +131367,10 @@ var EtherscanInfoClient = /** @class */ (function (_super) {
|
|
|
131015
131367
|
fee: fee.toString(10),
|
|
131016
131368
|
blockHeight: transaction.blockNumber
|
|
131017
131369
|
};
|
|
131018
|
-
return [4 /*yield*/, protocol.
|
|
131370
|
+
return [4 /*yield*/, protocol.getIdentifier()];
|
|
131019
131371
|
case 3:
|
|
131020
131372
|
_a.protocolIdentifier = _b.sent();
|
|
131021
|
-
return [4 /*yield*/, protocol.
|
|
131373
|
+
return [4 /*yield*/, protocol.getOptions()];
|
|
131022
131374
|
case 4:
|
|
131023
131375
|
airGapTransaction = (_a.network = (_b.sent()).network,
|
|
131024
131376
|
_a.timestamp = parseInt(transaction.timeStamp, 10),
|
|
@@ -131073,10 +131425,10 @@ var EtherscanInfoClient = /** @class */ (function (_super) {
|
|
|
131073
131425
|
isInbound: transaction.to.toLowerCase() === address.toLowerCase(),
|
|
131074
131426
|
blockHeight: transaction.blockNumber
|
|
131075
131427
|
};
|
|
131076
|
-
return [4 /*yield*/, protocol.
|
|
131428
|
+
return [4 /*yield*/, protocol.getIdentifier()];
|
|
131077
131429
|
case 3:
|
|
131078
131430
|
_a.protocolIdentifier = _b.sent();
|
|
131079
|
-
return [4 /*yield*/, protocol.
|
|
131431
|
+
return [4 /*yield*/, protocol.getOptions()];
|
|
131080
131432
|
case 4:
|
|
131081
131433
|
airGapTransaction = (_a.network = (_b.sent()).network,
|
|
131082
131434
|
_a.amount = new bignumber_1.BigNumber(transaction.value).toString(10),
|
|
@@ -131567,23 +131919,40 @@ var utils_1 = require("../utils/utils");
|
|
|
131567
131919
|
var EthereumTransaction = require('../../../dependencies/src/ethereumjs-tx-1.3.7/index');
|
|
131568
131920
|
var GenericERC20 = /** @class */ (function (_super) {
|
|
131569
131921
|
__extends(GenericERC20, _super);
|
|
131570
|
-
function GenericERC20(
|
|
131571
|
-
var _this = _super.call(this,
|
|
131572
|
-
_this.
|
|
131573
|
-
_this.
|
|
131574
|
-
_this.
|
|
131575
|
-
_this.
|
|
131576
|
-
_this.
|
|
131577
|
-
_this.
|
|
131578
|
-
_this.
|
|
131579
|
-
_this.
|
|
131580
|
-
_this.
|
|
131581
|
-
_this._name = _options.config.name;
|
|
131582
|
-
_this._marketSymbol = _options.config.marketSymbol;
|
|
131583
|
-
_this._identifier = _options.config.identifier;
|
|
131584
|
-
_this._decimals = _options.config.decimals;
|
|
131922
|
+
function GenericERC20(options) {
|
|
131923
|
+
var _this = _super.call(this, options) || this;
|
|
131924
|
+
_this.options = options;
|
|
131925
|
+
_this.isSubProtocol = true;
|
|
131926
|
+
_this.subProtocolType = ICoinSubProtocol_1.SubProtocolType.TOKEN;
|
|
131927
|
+
_this.contractAddress = options.config.contractAddress;
|
|
131928
|
+
_this.symbol = options.config.symbol;
|
|
131929
|
+
_this.name = options.config.name;
|
|
131930
|
+
_this.marketSymbol = options.config.marketSymbol;
|
|
131931
|
+
_this.identifier = options.config.identifier;
|
|
131932
|
+
_this.decimals = options.config.decimals;
|
|
131585
131933
|
return _this;
|
|
131586
131934
|
}
|
|
131935
|
+
GenericERC20.prototype.getIsSubProtocol = function () {
|
|
131936
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
131937
|
+
return __generator(this, function (_a) {
|
|
131938
|
+
return [2 /*return*/, this.isSubProtocol];
|
|
131939
|
+
});
|
|
131940
|
+
});
|
|
131941
|
+
};
|
|
131942
|
+
GenericERC20.prototype.getSubProtocolType = function () {
|
|
131943
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
131944
|
+
return __generator(this, function (_a) {
|
|
131945
|
+
return [2 /*return*/, this.subProtocolType];
|
|
131946
|
+
});
|
|
131947
|
+
});
|
|
131948
|
+
};
|
|
131949
|
+
GenericERC20.prototype.getContractAddress = function () {
|
|
131950
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
131951
|
+
return __generator(this, function (_a) {
|
|
131952
|
+
return [2 /*return*/, this.contractAddress];
|
|
131953
|
+
});
|
|
131954
|
+
});
|
|
131955
|
+
};
|
|
131587
131956
|
GenericERC20.prototype.getBalanceOfPublicKey = function (publicKey) {
|
|
131588
131957
|
return __awaiter(this, void 0, void 0, function () {
|
|
131589
131958
|
var address;
|
|
@@ -131604,7 +131973,7 @@ var GenericERC20 = /** @class */ (function (_super) {
|
|
|
131604
131973
|
return __generator(this, function (_a) {
|
|
131605
131974
|
switch (_a.label) {
|
|
131606
131975
|
case 0: return [4 /*yield*/, Promise.all(addresses.map(function (address) {
|
|
131607
|
-
return _this.
|
|
131976
|
+
return _this.options.nodeClient.callBalanceOf(_this.contractAddress, address);
|
|
131608
131977
|
}))];
|
|
131609
131978
|
case 1:
|
|
131610
131979
|
balances = _a.sent();
|
|
@@ -131624,7 +131993,7 @@ var GenericERC20 = /** @class */ (function (_super) {
|
|
|
131624
131993
|
var result;
|
|
131625
131994
|
return __generator(this, function (_a) {
|
|
131626
131995
|
switch (_a.label) {
|
|
131627
|
-
case 0: return [4 /*yield*/, this.
|
|
131996
|
+
case 0: return [4 /*yield*/, this.options.nodeClient.estimateTransferGas(this.contractAddress, source, recipient, hexValue)];
|
|
131628
131997
|
case 1:
|
|
131629
131998
|
result = _a.sent();
|
|
131630
131999
|
return [2 /*return*/, result];
|
|
@@ -131657,7 +132026,7 @@ var GenericERC20 = /** @class */ (function (_super) {
|
|
|
131657
132026
|
return [4 /*yield*/, this.estimateGas(address, recipients[0], utils_1.EthereumUtils.toHex(values[0]))];
|
|
131658
132027
|
case 2:
|
|
131659
132028
|
estimatedGas = _a.sent();
|
|
131660
|
-
return [4 /*yield*/, this.
|
|
132029
|
+
return [4 /*yield*/, this.options.nodeClient.getGasPrice()];
|
|
131661
132030
|
case 3:
|
|
131662
132031
|
gasPrise = _a.sent();
|
|
131663
132032
|
feeStepFactor = new bignumber_1.default(0.5);
|
|
@@ -131666,9 +132035,9 @@ var GenericERC20 = /** @class */ (function (_super) {
|
|
|
131666
132035
|
mediumFee = estimatedFee;
|
|
131667
132036
|
highFee = mediumFee.plus(mediumFee.times(feeStepFactor).integerValue(bignumber_1.default.ROUND_FLOOR));
|
|
131668
132037
|
return [2 /*return*/, {
|
|
131669
|
-
low: lowFee.shiftedBy(-this.
|
|
131670
|
-
medium: mediumFee.shiftedBy(-this.
|
|
131671
|
-
high: highFee.shiftedBy(-this.
|
|
132038
|
+
low: lowFee.shiftedBy(-this.getFeeDecimals).toFixed(),
|
|
132039
|
+
medium: mediumFee.shiftedBy(-this.getFeeDecimals).toFixed(),
|
|
132040
|
+
high: highFee.shiftedBy(-this.getFeeDecimals).toFixed()
|
|
131672
132041
|
}];
|
|
131673
132042
|
}
|
|
131674
132043
|
});
|
|
@@ -131704,7 +132073,7 @@ var GenericERC20 = /** @class */ (function (_super) {
|
|
|
131704
132073
|
case 4:
|
|
131705
132074
|
estimatedGas = _c.sent();
|
|
131706
132075
|
if (!ethBalance.isGreaterThanOrEqualTo(wrappedFee)) return [3 /*break*/, 6];
|
|
131707
|
-
return [4 /*yield*/, this.
|
|
132076
|
+
return [4 /*yield*/, this.options.nodeClient.fetchTransactionCount(address)];
|
|
131708
132077
|
case 5:
|
|
131709
132078
|
txCount = _c.sent();
|
|
131710
132079
|
gasPrice = wrappedFee.isEqualTo(0)
|
|
@@ -131714,9 +132083,9 @@ var GenericERC20 = /** @class */ (function (_super) {
|
|
|
131714
132083
|
nonce: utils_1.EthereumUtils.toHex(txCount),
|
|
131715
132084
|
gasLimit: utils_1.EthereumUtils.toHex(estimatedGas.toFixed()),
|
|
131716
132085
|
gasPrice: utils_1.EthereumUtils.toHex(gasPrice.toFixed()),
|
|
131717
|
-
to: this.
|
|
132086
|
+
to: this.contractAddress,
|
|
131718
132087
|
value: utils_1.EthereumUtils.toHex(new bignumber_1.default(0).toFixed()),
|
|
131719
|
-
chainId: this.
|
|
132088
|
+
chainId: this.options.network.extras.chainID,
|
|
131720
132089
|
data: new AirGapNodeClient_1.EthereumRPCDataTransfer(recipients[0], utils_1.EthereumUtils.toHex(wrappedValues[0].toFixed())).abiEncoded()
|
|
131721
132090
|
};
|
|
131722
132091
|
return [2 /*return*/, transaction];
|
|
@@ -131734,7 +132103,7 @@ var GenericERC20 = /** @class */ (function (_super) {
|
|
|
131734
132103
|
var promises = [];
|
|
131735
132104
|
for (var _i = 0, addresses_1 = addresses; _i < addresses_1.length; _i++) {
|
|
131736
132105
|
var address = addresses_1[_i];
|
|
131737
|
-
promises.push(_this.
|
|
132106
|
+
promises.push(_this.options.infoClient.fetchContractTransactions(_this, _this.contractAddress, address, limit, cursor));
|
|
131738
132107
|
}
|
|
131739
132108
|
Promise.all(promises)
|
|
131740
132109
|
.then(function (values) {
|
|
@@ -131977,31 +132346,23 @@ var BitcoinProtocol_1 = require("../bitcoin/BitcoinProtocol");
|
|
|
131977
132346
|
var GroestlcoinProtocolOptions_1 = require("./GroestlcoinProtocolOptions");
|
|
131978
132347
|
var GroestlcoinProtocol = /** @class */ (function (_super) {
|
|
131979
132348
|
__extends(GroestlcoinProtocol, _super);
|
|
131980
|
-
function GroestlcoinProtocol(
|
|
131981
|
-
if (
|
|
131982
|
-
var _this = _super.call(this,
|
|
131983
|
-
_this.
|
|
131984
|
-
_this.
|
|
131985
|
-
_this.
|
|
131986
|
-
_this.
|
|
131987
|
-
_this.
|
|
131988
|
-
_this.
|
|
131989
|
-
_this.marketSymbol = Promise.resolve(_this._marketSymbol);
|
|
131990
|
-
_this._feeSymbol = 'grs';
|
|
131991
|
-
_this.feeSymbol = Promise.resolve(_this._feeSymbol);
|
|
131992
|
-
_this._feeDefaults = {
|
|
132349
|
+
function GroestlcoinProtocol(options) {
|
|
132350
|
+
if (options === void 0) { options = new GroestlcoinProtocolOptions_1.GroestlcoinProtocolOptions(); }
|
|
132351
|
+
var _this = _super.call(this, options) || this;
|
|
132352
|
+
_this.options = options;
|
|
132353
|
+
_this.symbol = 'GRS';
|
|
132354
|
+
_this.name = 'Groestlcoin';
|
|
132355
|
+
_this.marketSymbol = 'grs';
|
|
132356
|
+
_this.feeSymbol = 'grs';
|
|
132357
|
+
_this.feeDefaults = {
|
|
131993
132358
|
low: '0.00002',
|
|
131994
132359
|
medium: '0.00004',
|
|
131995
132360
|
high: '0.00005'
|
|
131996
132361
|
};
|
|
131997
|
-
_this.
|
|
131998
|
-
_this.
|
|
131999
|
-
_this.
|
|
132000
|
-
_this.
|
|
132001
|
-
_this.feeDecimals = Promise.resolve(_this._feeDecimals);
|
|
132002
|
-
_this._identifier = ProtocolSymbols_1.MainProtocolSymbols.GRS;
|
|
132003
|
-
_this.identifier = Promise.resolve(_this._identifier);
|
|
132004
|
-
_this._units = [
|
|
132362
|
+
_this.decimals = 8;
|
|
132363
|
+
_this.feeDecimals = 8;
|
|
132364
|
+
_this.identifier = ProtocolSymbols_1.MainProtocolSymbols.GRS;
|
|
132365
|
+
_this.units = [
|
|
132005
132366
|
{
|
|
132006
132367
|
unitSymbol: 'GRS',
|
|
132007
132368
|
factor: '1'
|
|
@@ -132015,16 +132376,10 @@ var GroestlcoinProtocol = /** @class */ (function (_super) {
|
|
|
132015
132376
|
factor: '0.00000001'
|
|
132016
132377
|
}
|
|
132017
132378
|
];
|
|
132018
|
-
_this.
|
|
132019
|
-
_this.
|
|
132020
|
-
_this.
|
|
132021
|
-
_this.
|
|
132022
|
-
_this.standardDerivationPath = Promise.resolve(_this._standardDerivationPath);
|
|
132023
|
-
_this._addressValidationPattern = '^([F3][a-km-zA-HJ-NP-Z1-9]{33}|grs1[a-zA-HJ-NP-Z0-9]{39})$';
|
|
132024
|
-
_this.addressValidationPattern = Promise.resolve(_this._addressValidationPattern);
|
|
132025
|
-
_this._addressPlaceholder = 'Fdb...';
|
|
132026
|
-
_this.addressPlaceholder = Promise.resolve(_this._addressPlaceholder);
|
|
132027
|
-
_this.options = Promise.resolve(_this._options);
|
|
132379
|
+
_this.supportsHD = true;
|
|
132380
|
+
_this.standardDerivationPath = "m/44'/17'/0'";
|
|
132381
|
+
_this.addressValidationPattern = '^([F3][a-km-zA-HJ-NP-Z1-9]{33}|grs1[a-zA-HJ-NP-Z0-9]{39})$';
|
|
132382
|
+
_this.addressPlaceholder = 'Fdb...';
|
|
132028
132383
|
_this.cryptoClient = new BitcoinCryptoClient_1.BitcoinCryptoClient(_this, groestlcoinJSMessage);
|
|
132029
132384
|
return _this;
|
|
132030
132385
|
}
|
|
@@ -132409,7 +132764,7 @@ var SubstrateDelegateProtocol = /** @class */ (function (_super) {
|
|
|
132409
132764
|
if (this.defaultValidator) {
|
|
132410
132765
|
return [2 /*return*/, this.defaultValidator];
|
|
132411
132766
|
}
|
|
132412
|
-
return [4 /*yield*/, this.
|
|
132767
|
+
return [4 /*yield*/, this.options.nodeClient.getValidators()];
|
|
132413
132768
|
case 1:
|
|
132414
132769
|
validators = _a.sent();
|
|
132415
132770
|
return [2 /*return*/, validators ? validators[0].asString() : ''];
|
|
@@ -132420,14 +132775,14 @@ var SubstrateDelegateProtocol = /** @class */ (function (_super) {
|
|
|
132420
132775
|
SubstrateDelegateProtocol.prototype.getCurrentDelegateesForPublicKey = function (publicKey) {
|
|
132421
132776
|
return __awaiter(this, void 0, void 0, function () {
|
|
132422
132777
|
return __generator(this, function (_a) {
|
|
132423
|
-
return [2 /*return*/, this.
|
|
132778
|
+
return [2 /*return*/, this.options.accountController.getCurrentValidators(publicKey)];
|
|
132424
132779
|
});
|
|
132425
132780
|
});
|
|
132426
132781
|
};
|
|
132427
132782
|
SubstrateDelegateProtocol.prototype.getCurrentDelegateesForAddress = function (address) {
|
|
132428
132783
|
return __awaiter(this, void 0, void 0, function () {
|
|
132429
132784
|
return __generator(this, function (_a) {
|
|
132430
|
-
return [2 /*return*/, this.
|
|
132785
|
+
return [2 /*return*/, this.options.accountController.getCurrentValidators(address)];
|
|
132431
132786
|
});
|
|
132432
132787
|
});
|
|
132433
132788
|
};
|
|
@@ -132436,7 +132791,7 @@ var SubstrateDelegateProtocol = /** @class */ (function (_super) {
|
|
|
132436
132791
|
var validatorDetails;
|
|
132437
132792
|
return __generator(this, function (_a) {
|
|
132438
132793
|
switch (_a.label) {
|
|
132439
|
-
case 0: return [4 /*yield*/, this.
|
|
132794
|
+
case 0: return [4 /*yield*/, this.options.accountController.getValidatorDetails(address)];
|
|
132440
132795
|
case 1:
|
|
132441
132796
|
validatorDetails = _a.sent();
|
|
132442
132797
|
return [2 /*return*/, {
|
|
@@ -132451,14 +132806,14 @@ var SubstrateDelegateProtocol = /** @class */ (function (_super) {
|
|
|
132451
132806
|
SubstrateDelegateProtocol.prototype.isPublicKeyDelegating = function (publicKey) {
|
|
132452
132807
|
return __awaiter(this, void 0, void 0, function () {
|
|
132453
132808
|
return __generator(this, function (_a) {
|
|
132454
|
-
return [2 /*return*/, this.
|
|
132809
|
+
return [2 /*return*/, this.options.accountController.isDelegating(publicKey)];
|
|
132455
132810
|
});
|
|
132456
132811
|
});
|
|
132457
132812
|
};
|
|
132458
132813
|
SubstrateDelegateProtocol.prototype.isAddressDelegating = function (address) {
|
|
132459
132814
|
return __awaiter(this, void 0, void 0, function () {
|
|
132460
132815
|
return __generator(this, function (_a) {
|
|
132461
|
-
return [2 /*return*/, this.
|
|
132816
|
+
return [2 /*return*/, this.options.accountController.isDelegating(address)];
|
|
132462
132817
|
});
|
|
132463
132818
|
});
|
|
132464
132819
|
};
|
|
@@ -132478,7 +132833,7 @@ var SubstrateDelegateProtocol = /** @class */ (function (_super) {
|
|
|
132478
132833
|
SubstrateDelegateProtocol.prototype.getDelegatorDetailsFromAddress = function (address) {
|
|
132479
132834
|
return __awaiter(this, void 0, void 0, function () {
|
|
132480
132835
|
return __generator(this, function (_a) {
|
|
132481
|
-
return [2 /*return*/, this.
|
|
132836
|
+
return [2 /*return*/, this.options.accountController.getNominatorDetails(address)];
|
|
132482
132837
|
});
|
|
132483
132838
|
});
|
|
132484
132839
|
};
|
|
@@ -132502,8 +132857,8 @@ var SubstrateDelegateProtocol = /** @class */ (function (_super) {
|
|
|
132502
132857
|
return __generator(this, function (_b) {
|
|
132503
132858
|
switch (_b.label) {
|
|
132504
132859
|
case 0: return [4 /*yield*/, Promise.all([
|
|
132505
|
-
this.
|
|
132506
|
-
Promise.all(delegatees.map(function (validator) { return _this.
|
|
132860
|
+
this.options.accountController.getNominatorDetails(address, delegatees),
|
|
132861
|
+
Promise.all(delegatees.map(function (validator) { return _this.options.accountController.getValidatorDetails(validator); }))
|
|
132507
132862
|
])];
|
|
132508
132863
|
case 1:
|
|
132509
132864
|
_a = _b.sent(), nominatorDetails = _a[0], validatorsDetails = _a[1];
|
|
@@ -132575,12 +132930,12 @@ var SubstrateDelegateProtocol = /** @class */ (function (_super) {
|
|
|
132575
132930
|
var transferableBalance, available, bondFirst, encoded;
|
|
132576
132931
|
return __generator(this, function (_a) {
|
|
132577
132932
|
switch (_a.label) {
|
|
132578
|
-
case 0: return [4 /*yield*/, this.
|
|
132933
|
+
case 0: return [4 /*yield*/, this.options.accountController.getTransferableBalance(publicKey, false, false)];
|
|
132579
132934
|
case 1:
|
|
132580
132935
|
transferableBalance = _a.sent();
|
|
132581
132936
|
available = new bignumber_1.default(transferableBalance).minus(value || 0);
|
|
132582
132937
|
bondFirst = controller !== undefined && value !== undefined && payee !== undefined;
|
|
132583
|
-
return [4 /*yield*/, this.
|
|
132938
|
+
return [4 /*yield*/, this.options.transactionController.prepareSubmittableTransactions(publicKey, available, __spreadArrays((bondFirst
|
|
132584
132939
|
? [
|
|
132585
132940
|
{
|
|
132586
132941
|
type: SubstrateTransaction_1.SubstrateTransactionType.BOND,
|
|
@@ -132614,8 +132969,8 @@ var SubstrateDelegateProtocol = /** @class */ (function (_super) {
|
|
|
132614
132969
|
return __generator(this, function (_b) {
|
|
132615
132970
|
switch (_b.label) {
|
|
132616
132971
|
case 0: return [4 /*yield*/, Promise.all([
|
|
132617
|
-
this.
|
|
132618
|
-
this.
|
|
132972
|
+
this.options.accountController.getTransferableBalance(publicKey, false, false),
|
|
132973
|
+
this.options.accountController.getUnlockingBalance(publicKey)
|
|
132619
132974
|
])];
|
|
132620
132975
|
case 1:
|
|
132621
132976
|
_a = _b.sent(), transferableBalance = _a[0], lockedBalance = _a[1];
|
|
@@ -132652,7 +133007,7 @@ var SubstrateDelegateProtocol = /** @class */ (function (_super) {
|
|
|
132652
133007
|
targets: typeof targets === 'string' ? [targets] : targets
|
|
132653
133008
|
}
|
|
132654
133009
|
});
|
|
132655
|
-
return [4 /*yield*/, this.
|
|
133010
|
+
return [4 /*yield*/, this.options.transactionController.prepareSubmittableTransactions(publicKey, transferableBalance, configs)];
|
|
132656
133011
|
case 2:
|
|
132657
133012
|
encoded = _b.sent();
|
|
132658
133013
|
return [2 /*return*/, [{ encoded: encoded }]];
|
|
@@ -132665,11 +133020,11 @@ var SubstrateDelegateProtocol = /** @class */ (function (_super) {
|
|
|
132665
133020
|
var transferableBalance, keepController, encoded;
|
|
132666
133021
|
return __generator(this, function (_a) {
|
|
132667
133022
|
switch (_a.label) {
|
|
132668
|
-
case 0: return [4 /*yield*/, this.
|
|
133023
|
+
case 0: return [4 /*yield*/, this.options.accountController.getTransferableBalance(publicKey, false, false)];
|
|
132669
133024
|
case 1:
|
|
132670
133025
|
transferableBalance = _a.sent();
|
|
132671
133026
|
keepController = value === undefined;
|
|
132672
|
-
return [4 /*yield*/, this.
|
|
133027
|
+
return [4 /*yield*/, this.options.transactionController.prepareSubmittableTransactions(publicKey, transferableBalance, __spreadArrays([
|
|
132673
133028
|
{
|
|
132674
133029
|
type: SubstrateTransaction_1.SubstrateTransactionType.CANCEL_NOMINATION,
|
|
132675
133030
|
tip: tip,
|
|
@@ -132698,10 +133053,10 @@ var SubstrateDelegateProtocol = /** @class */ (function (_super) {
|
|
|
132698
133053
|
var transferableBalance, encoded;
|
|
132699
133054
|
return __generator(this, function (_a) {
|
|
132700
133055
|
switch (_a.label) {
|
|
132701
|
-
case 0: return [4 /*yield*/, this.
|
|
133056
|
+
case 0: return [4 /*yield*/, this.options.accountController.getTransferableBalance(publicKey, false, false)];
|
|
132702
133057
|
case 1:
|
|
132703
133058
|
transferableBalance = _a.sent();
|
|
132704
|
-
return [4 /*yield*/, this.
|
|
133059
|
+
return [4 /*yield*/, this.options.transactionController.prepareSubmittableTransactions(publicKey, transferableBalance, [
|
|
132705
133060
|
{
|
|
132706
133061
|
type: SubstrateTransaction_1.SubstrateTransactionType.NOMINATE,
|
|
132707
133062
|
tip: tip,
|
|
@@ -132722,10 +133077,10 @@ var SubstrateDelegateProtocol = /** @class */ (function (_super) {
|
|
|
132722
133077
|
var transferableBalance, encoded;
|
|
132723
133078
|
return __generator(this, function (_a) {
|
|
132724
133079
|
switch (_a.label) {
|
|
132725
|
-
case 0: return [4 /*yield*/, this.
|
|
133080
|
+
case 0: return [4 /*yield*/, this.options.accountController.getTransferableBalance(publicKey, false, false)];
|
|
132726
133081
|
case 1:
|
|
132727
133082
|
transferableBalance = _a.sent();
|
|
132728
|
-
return [4 /*yield*/, this.
|
|
133083
|
+
return [4 /*yield*/, this.options.transactionController.prepareSubmittableTransactions(publicKey, transferableBalance, [
|
|
132729
133084
|
{
|
|
132730
133085
|
type: SubstrateTransaction_1.SubstrateTransactionType.UNBOND,
|
|
132731
133086
|
tip: tip,
|
|
@@ -132746,10 +133101,10 @@ var SubstrateDelegateProtocol = /** @class */ (function (_super) {
|
|
|
132746
133101
|
var transferableBalance, encoded;
|
|
132747
133102
|
return __generator(this, function (_a) {
|
|
132748
133103
|
switch (_a.label) {
|
|
132749
|
-
case 0: return [4 /*yield*/, this.
|
|
133104
|
+
case 0: return [4 /*yield*/, this.options.accountController.getTransferableBalance(publicKey, false, false)];
|
|
132750
133105
|
case 1:
|
|
132751
133106
|
transferableBalance = _a.sent();
|
|
132752
|
-
return [4 /*yield*/, this.
|
|
133107
|
+
return [4 /*yield*/, this.options.transactionController.prepareSubmittableTransactions(publicKey, transferableBalance, [
|
|
132753
133108
|
{
|
|
132754
133109
|
type: SubstrateTransaction_1.SubstrateTransactionType.REBOND,
|
|
132755
133110
|
tip: tip,
|
|
@@ -132770,10 +133125,10 @@ var SubstrateDelegateProtocol = /** @class */ (function (_super) {
|
|
|
132770
133125
|
var transferableBalance, encoded;
|
|
132771
133126
|
return __generator(this, function (_a) {
|
|
132772
133127
|
switch (_a.label) {
|
|
132773
|
-
case 0: return [4 /*yield*/, this.
|
|
133128
|
+
case 0: return [4 /*yield*/, this.options.accountController.getTransferableBalance(publicKey, false, false)];
|
|
132774
133129
|
case 1:
|
|
132775
133130
|
transferableBalance = _a.sent();
|
|
132776
|
-
return [4 /*yield*/, this.
|
|
133131
|
+
return [4 /*yield*/, this.options.transactionController.prepareSubmittableTransactions(publicKey, transferableBalance, [
|
|
132777
133132
|
{
|
|
132778
133133
|
type: SubstrateTransaction_1.SubstrateTransactionType.BOND_EXTRA,
|
|
132779
133134
|
tip: tip,
|
|
@@ -132795,8 +133150,8 @@ var SubstrateDelegateProtocol = /** @class */ (function (_super) {
|
|
|
132795
133150
|
return __generator(this, function (_b) {
|
|
132796
133151
|
switch (_b.label) {
|
|
132797
133152
|
case 0: return [4 /*yield*/, Promise.all([
|
|
132798
|
-
this.
|
|
132799
|
-
this.
|
|
133153
|
+
this.options.accountController.getTransferableBalance(publicKey, false, false),
|
|
133154
|
+
this.options.accountController.getUnlockingBalance(publicKey)
|
|
132800
133155
|
])];
|
|
132801
133156
|
case 1:
|
|
132802
133157
|
_a = _b.sent(), transferableBalance = _a[0], lockedBalance = _a[1];
|
|
@@ -132827,7 +133182,7 @@ var SubstrateDelegateProtocol = /** @class */ (function (_super) {
|
|
|
132827
133182
|
}
|
|
132828
133183
|
}
|
|
132829
133184
|
];
|
|
132830
|
-
return [4 /*yield*/, this.
|
|
133185
|
+
return [4 /*yield*/, this.options.transactionController.prepareSubmittableTransactions(publicKey, transferableBalance, configs)];
|
|
132831
133186
|
case 2:
|
|
132832
133187
|
encoded = _b.sent();
|
|
132833
133188
|
return [2 /*return*/, [{ encoded: encoded }]];
|
|
@@ -132841,12 +133196,12 @@ var SubstrateDelegateProtocol = /** @class */ (function (_super) {
|
|
|
132841
133196
|
return __generator(this, function (_b) {
|
|
132842
133197
|
switch (_b.label) {
|
|
132843
133198
|
case 0: return [4 /*yield*/, Promise.all([
|
|
132844
|
-
this.
|
|
132845
|
-
this.
|
|
133199
|
+
this.options.accountController.getTransferableBalance(publicKey, false, false),
|
|
133200
|
+
this.options.accountController.getSlashingSpansNumber(publicKey)
|
|
132846
133201
|
])];
|
|
132847
133202
|
case 1:
|
|
132848
133203
|
_a = _b.sent(), transferableBalance = _a[0], slashingSpansNumber = _a[1];
|
|
132849
|
-
return [4 /*yield*/, this.
|
|
133204
|
+
return [4 /*yield*/, this.options.transactionController.prepareSubmittableTransactions(publicKey, transferableBalance, [
|
|
132850
133205
|
{
|
|
132851
133206
|
type: SubstrateTransaction_1.SubstrateTransactionType.WITHDRAW_UNBONDED,
|
|
132852
133207
|
tip: tip,
|
|
@@ -132866,14 +133221,14 @@ var SubstrateDelegateProtocol = /** @class */ (function (_super) {
|
|
|
132866
133221
|
return __generator(this, function (_a) {
|
|
132867
133222
|
switch (_a.label) {
|
|
132868
133223
|
case 0: return [4 /*yield*/, Promise.all([
|
|
132869
|
-
this.
|
|
133224
|
+
this.options.accountController.getTransferableBalance(address, false, false),
|
|
132870
133225
|
this.getFutureRequiredTransactions(address, 'delegate')
|
|
132871
133226
|
])];
|
|
132872
133227
|
case 1:
|
|
132873
133228
|
results = _a.sent();
|
|
132874
133229
|
transferableBalance = results[0];
|
|
132875
133230
|
futureTransactions = results[1];
|
|
132876
|
-
return [4 /*yield*/, this.
|
|
133231
|
+
return [4 /*yield*/, this.options.transactionController.estimateTransactionFees(address, futureTransactions)];
|
|
132877
133232
|
case 2:
|
|
132878
133233
|
feeEstimate = _a.sent();
|
|
132879
133234
|
if (!feeEstimate) {
|
|
@@ -132978,32 +133333,132 @@ var SubstrateTransaction_1 = require("./common/data/transaction/SubstrateTransac
|
|
|
132978
133333
|
var SubstrateCryptoClient_1 = require("./SubstrateCryptoClient");
|
|
132979
133334
|
var SubstrateProtocol = /** @class */ (function (_super) {
|
|
132980
133335
|
__extends(SubstrateProtocol, _super);
|
|
132981
|
-
function SubstrateProtocol(
|
|
133336
|
+
function SubstrateProtocol(options) {
|
|
132982
133337
|
var _this = _super.call(this) || this;
|
|
132983
|
-
_this.
|
|
132984
|
-
_this.
|
|
132985
|
-
_this.
|
|
132986
|
-
_this.
|
|
132987
|
-
_this.
|
|
132988
|
-
_this._addressValidationPattern = '^5[a-km-zA-HJ-NP-Z1-9]+$';
|
|
132989
|
-
_this.addressValidationPattern = Promise.resolve(_this._addressValidationPattern);
|
|
132990
|
-
_this._addressPlaceholder = "5ABC...";
|
|
132991
|
-
_this.addressPlaceholder = Promise.resolve(_this._addressPlaceholder);
|
|
133338
|
+
_this.options = options;
|
|
133339
|
+
_this.supportsHD = false;
|
|
133340
|
+
_this.addressIsCaseSensitive = true;
|
|
133341
|
+
_this.addressValidationPattern = '^5[a-km-zA-HJ-NP-Z1-9]+$';
|
|
133342
|
+
_this.addressPlaceholder = "5ABC...";
|
|
132992
133343
|
_this.cryptoClient = new SubstrateCryptoClient_1.SubstrateCryptoClient();
|
|
132993
|
-
_this.options = Promise.resolve(_this._options);
|
|
132994
133344
|
return _this;
|
|
132995
133345
|
}
|
|
133346
|
+
SubstrateProtocol.prototype.getSymbol = function () {
|
|
133347
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
133348
|
+
return __generator(this, function (_a) {
|
|
133349
|
+
return [2 /*return*/, this.symbol];
|
|
133350
|
+
});
|
|
133351
|
+
});
|
|
133352
|
+
};
|
|
133353
|
+
SubstrateProtocol.prototype.getName = function () {
|
|
133354
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
133355
|
+
return __generator(this, function (_a) {
|
|
133356
|
+
return [2 /*return*/, this.name];
|
|
133357
|
+
});
|
|
133358
|
+
});
|
|
133359
|
+
};
|
|
133360
|
+
SubstrateProtocol.prototype.getMarketSymbol = function () {
|
|
133361
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
133362
|
+
return __generator(this, function (_a) {
|
|
133363
|
+
return [2 /*return*/, this.marketSymbol];
|
|
133364
|
+
});
|
|
133365
|
+
});
|
|
133366
|
+
};
|
|
133367
|
+
SubstrateProtocol.prototype.getFeeSymbol = function () {
|
|
133368
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
133369
|
+
return __generator(this, function (_a) {
|
|
133370
|
+
return [2 /*return*/, this.feeSymbol];
|
|
133371
|
+
});
|
|
133372
|
+
});
|
|
133373
|
+
};
|
|
133374
|
+
SubstrateProtocol.prototype.getDecimals = function () {
|
|
133375
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
133376
|
+
return __generator(this, function (_a) {
|
|
133377
|
+
return [2 /*return*/, this.decimals];
|
|
133378
|
+
});
|
|
133379
|
+
});
|
|
133380
|
+
};
|
|
133381
|
+
SubstrateProtocol.prototype.getFeeDecimals = function () {
|
|
133382
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
133383
|
+
return __generator(this, function (_a) {
|
|
133384
|
+
return [2 /*return*/, this.feeDecimals];
|
|
133385
|
+
});
|
|
133386
|
+
});
|
|
133387
|
+
};
|
|
133388
|
+
SubstrateProtocol.prototype.getIdentifier = function () {
|
|
133389
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
133390
|
+
return __generator(this, function (_a) {
|
|
133391
|
+
return [2 /*return*/, this.identifier];
|
|
133392
|
+
});
|
|
133393
|
+
});
|
|
133394
|
+
};
|
|
133395
|
+
SubstrateProtocol.prototype.getFeeDefaults = function () {
|
|
133396
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
133397
|
+
return __generator(this, function (_a) {
|
|
133398
|
+
return [2 /*return*/, this.feeDefaults];
|
|
133399
|
+
});
|
|
133400
|
+
});
|
|
133401
|
+
};
|
|
133402
|
+
SubstrateProtocol.prototype.getUnits = function () {
|
|
133403
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
133404
|
+
return __generator(this, function (_a) {
|
|
133405
|
+
return [2 /*return*/, this.units];
|
|
133406
|
+
});
|
|
133407
|
+
});
|
|
133408
|
+
};
|
|
133409
|
+
SubstrateProtocol.prototype.getStandardDerivationPath = function () {
|
|
133410
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
133411
|
+
return __generator(this, function (_a) {
|
|
133412
|
+
return [2 /*return*/, this.standardDerivationPath];
|
|
133413
|
+
});
|
|
133414
|
+
});
|
|
133415
|
+
};
|
|
133416
|
+
SubstrateProtocol.prototype.getSupportsHD = function () {
|
|
133417
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
133418
|
+
return __generator(this, function (_a) {
|
|
133419
|
+
return [2 /*return*/, this.supportsHD];
|
|
133420
|
+
});
|
|
133421
|
+
});
|
|
133422
|
+
};
|
|
133423
|
+
SubstrateProtocol.prototype.getAddressIsCaseSensitive = function () {
|
|
133424
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
133425
|
+
return __generator(this, function (_a) {
|
|
133426
|
+
return [2 /*return*/, this.addressIsCaseSensitive];
|
|
133427
|
+
});
|
|
133428
|
+
});
|
|
133429
|
+
};
|
|
133430
|
+
SubstrateProtocol.prototype.getAddressValidationPattern = function () {
|
|
133431
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
133432
|
+
return __generator(this, function (_a) {
|
|
133433
|
+
return [2 /*return*/, this.addressValidationPattern];
|
|
133434
|
+
});
|
|
133435
|
+
});
|
|
133436
|
+
};
|
|
133437
|
+
SubstrateProtocol.prototype.getAddressPlaceholder = function () {
|
|
133438
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
133439
|
+
return __generator(this, function (_a) {
|
|
133440
|
+
return [2 /*return*/, this.addressPlaceholder];
|
|
133441
|
+
});
|
|
133442
|
+
});
|
|
133443
|
+
};
|
|
133444
|
+
SubstrateProtocol.prototype.getOptions = function () {
|
|
133445
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
133446
|
+
return __generator(this, function (_a) {
|
|
133447
|
+
return [2 /*return*/, this.options];
|
|
133448
|
+
});
|
|
133449
|
+
});
|
|
133450
|
+
};
|
|
132996
133451
|
SubstrateProtocol.prototype.getBlockExplorerLinkForAddress = function (address) {
|
|
132997
133452
|
return __awaiter(this, void 0, void 0, function () {
|
|
132998
133453
|
return __generator(this, function (_a) {
|
|
132999
|
-
return [2 /*return*/, this.
|
|
133454
|
+
return [2 /*return*/, this.options.network.blockExplorer.getAddressLink(address)];
|
|
133000
133455
|
});
|
|
133001
133456
|
});
|
|
133002
133457
|
};
|
|
133003
133458
|
SubstrateProtocol.prototype.getBlockExplorerLinkForTxId = function (txId) {
|
|
133004
133459
|
return __awaiter(this, void 0, void 0, function () {
|
|
133005
133460
|
return __generator(this, function (_a) {
|
|
133006
|
-
return [2 /*return*/, this.
|
|
133461
|
+
return [2 /*return*/, this.options.network.blockExplorer.getTransactionLink(txId)];
|
|
133007
133462
|
});
|
|
133008
133463
|
});
|
|
133009
133464
|
};
|
|
@@ -133012,7 +133467,7 @@ var SubstrateProtocol = /** @class */ (function (_super) {
|
|
|
133012
133467
|
var keyPair;
|
|
133013
133468
|
return __generator(this, function (_a) {
|
|
133014
133469
|
switch (_a.label) {
|
|
133015
|
-
case 0: return [4 /*yield*/, this.
|
|
133470
|
+
case 0: return [4 /*yield*/, this.options.accountController.createKeyPairFromMnemonic(mnemonic, derivationPath, password)];
|
|
133016
133471
|
case 1:
|
|
133017
133472
|
keyPair = _a.sent();
|
|
133018
133473
|
return [2 /*return*/, keyPair.publicKey.toString('hex')];
|
|
@@ -133025,7 +133480,7 @@ var SubstrateProtocol = /** @class */ (function (_super) {
|
|
|
133025
133480
|
var keyPair;
|
|
133026
133481
|
return __generator(this, function (_a) {
|
|
133027
133482
|
switch (_a.label) {
|
|
133028
|
-
case 0: return [4 /*yield*/, this.
|
|
133483
|
+
case 0: return [4 /*yield*/, this.options.accountController.createKeyPairFromMnemonic(mnemonic, derivationPath, password)];
|
|
133029
133484
|
case 1:
|
|
133030
133485
|
keyPair = _a.sent();
|
|
133031
133486
|
return [2 /*return*/, keyPair.privateKey.toString('hex')];
|
|
@@ -133038,7 +133493,7 @@ var SubstrateProtocol = /** @class */ (function (_super) {
|
|
|
133038
133493
|
var keyPair;
|
|
133039
133494
|
return __generator(this, function (_a) {
|
|
133040
133495
|
switch (_a.label) {
|
|
133041
|
-
case 0: return [4 /*yield*/, this.
|
|
133496
|
+
case 0: return [4 /*yield*/, this.options.accountController.createKeyPairFromHexSecret(secret, derivationPath)];
|
|
133042
133497
|
case 1:
|
|
133043
133498
|
keyPair = _a.sent();
|
|
133044
133499
|
return [2 /*return*/, keyPair.publicKey.toString('hex')];
|
|
@@ -133051,7 +133506,7 @@ var SubstrateProtocol = /** @class */ (function (_super) {
|
|
|
133051
133506
|
var keyPair;
|
|
133052
133507
|
return __generator(this, function (_a) {
|
|
133053
133508
|
switch (_a.label) {
|
|
133054
|
-
case 0: return [4 /*yield*/, this.
|
|
133509
|
+
case 0: return [4 /*yield*/, this.options.accountController.createKeyPairFromHexSecret(secret, derivationPath)];
|
|
133055
133510
|
case 1:
|
|
133056
133511
|
keyPair = _a.sent();
|
|
133057
133512
|
return [2 /*return*/, keyPair.privateKey.toString('hex')];
|
|
@@ -133064,7 +133519,7 @@ var SubstrateProtocol = /** @class */ (function (_super) {
|
|
|
133064
133519
|
var address;
|
|
133065
133520
|
return __generator(this, function (_a) {
|
|
133066
133521
|
switch (_a.label) {
|
|
133067
|
-
case 0: return [4 /*yield*/, this.
|
|
133522
|
+
case 0: return [4 /*yield*/, this.options.accountController.createAddressFromPublicKey(publicKey)];
|
|
133068
133523
|
case 1:
|
|
133069
133524
|
address = _a.sent();
|
|
133070
133525
|
return [2 /*return*/, {
|
|
@@ -133106,12 +133561,12 @@ var SubstrateProtocol = /** @class */ (function (_super) {
|
|
|
133106
133561
|
var _this = this;
|
|
133107
133562
|
return __generator(this, function (_a) {
|
|
133108
133563
|
switch (_a.label) {
|
|
133109
|
-
case 0: return [4 /*yield*/, Promise.all(addresses.map(function (address) { return _this.
|
|
133564
|
+
case 0: return [4 /*yield*/, Promise.all(addresses.map(function (address) { return _this.options.blockExplorerClient.getTransactions(address, limit, _this.decimals, cursor); }))];
|
|
133110
133565
|
case 1:
|
|
133111
133566
|
txs = _a.sent();
|
|
133112
133567
|
transactions = txs
|
|
133113
133568
|
.reduce(function (flatten, toFlatten) { return flatten.concat(toFlatten); }, [])
|
|
133114
|
-
.map(function (tx) { return (__assign({ protocolIdentifier: _this.
|
|
133569
|
+
.map(function (tx) { return (__assign({ protocolIdentifier: _this.identifier, network: _this.options.network, from: [], to: [], isInbound: false, amount: '', fee: '' }, tx)); });
|
|
133115
133570
|
return [2 /*return*/, { transactions: transactions, cursor: { page: cursor ? cursor.page + 1 : 1 } }];
|
|
133116
133571
|
}
|
|
133117
133572
|
});
|
|
@@ -133124,12 +133579,12 @@ var SubstrateProtocol = /** @class */ (function (_super) {
|
|
|
133124
133579
|
return __generator(this, function (_a) {
|
|
133125
133580
|
switch (_a.label) {
|
|
133126
133581
|
case 0:
|
|
133127
|
-
txs = this.
|
|
133128
|
-
return [4 /*yield*/, Promise.all(txs.map(function (tx) { return _this.
|
|
133582
|
+
txs = this.options.transactionController.decodeDetails(rawTransaction.encoded);
|
|
133583
|
+
return [4 /*yield*/, Promise.all(txs.map(function (tx) { return _this.options.transactionController.signTransaction(Buffer.from(privateKey, 'hex'), tx.transaction, tx.payload); }))];
|
|
133129
133584
|
case 1:
|
|
133130
133585
|
signed = _a.sent();
|
|
133131
133586
|
txs.forEach(function (tx, index) { return (tx.transaction = signed[index]); });
|
|
133132
|
-
return [2 /*return*/, this.
|
|
133587
|
+
return [2 /*return*/, this.options.transactionController.encodeDetails(txs)];
|
|
133133
133588
|
}
|
|
133134
133589
|
});
|
|
133135
133590
|
});
|
|
@@ -133154,7 +133609,7 @@ var SubstrateProtocol = /** @class */ (function (_super) {
|
|
|
133154
133609
|
var _this = this;
|
|
133155
133610
|
return __generator(this, function (_a) {
|
|
133156
133611
|
switch (_a.label) {
|
|
133157
|
-
case 0: return [4 /*yield*/, Promise.all(addresses.map(function (address) { return _this.
|
|
133612
|
+
case 0: return [4 /*yield*/, Promise.all(addresses.map(function (address) { return _this.options.accountController.getBalance(address); }))];
|
|
133158
133613
|
case 1:
|
|
133159
133614
|
balances = _a.sent();
|
|
133160
133615
|
balance = balances.reduce(function (current, next) { return current.plus(next); });
|
|
@@ -133169,7 +133624,7 @@ var SubstrateProtocol = /** @class */ (function (_super) {
|
|
|
133169
133624
|
var _this = this;
|
|
133170
133625
|
return __generator(this, function (_a) {
|
|
133171
133626
|
switch (_a.label) {
|
|
133172
|
-
case 0: return [4 /*yield*/, Promise.all(addresses.map(function (address) { return _this.
|
|
133627
|
+
case 0: return [4 /*yield*/, Promise.all(addresses.map(function (address) { return _this.options.accountController.getTransferableBalance(address, false); }))];
|
|
133173
133628
|
case 1:
|
|
133174
133629
|
balances = _a.sent();
|
|
133175
133630
|
balance = balances.reduce(function (current, next) { return current.plus(next); });
|
|
@@ -133204,14 +133659,14 @@ var SubstrateProtocol = /** @class */ (function (_super) {
|
|
|
133204
133659
|
return __generator(this, function (_a) {
|
|
133205
133660
|
switch (_a.label) {
|
|
133206
133661
|
case 0: return [4 /*yield*/, Promise.all([
|
|
133207
|
-
this.
|
|
133662
|
+
this.options.accountController.getTransferableBalance(publicKey, data === null || data === void 0 ? void 0 : data.excludeExistentialDeposit),
|
|
133208
133663
|
this.getFutureRequiredTransactions(publicKey, 'transfer')
|
|
133209
133664
|
])];
|
|
133210
133665
|
case 1:
|
|
133211
133666
|
results = _a.sent();
|
|
133212
133667
|
transferableBalance = results[0];
|
|
133213
133668
|
futureTransactions = results[1];
|
|
133214
|
-
return [4 /*yield*/, this.
|
|
133669
|
+
return [4 /*yield*/, this.options.transactionController.estimateTransactionFees(publicKey, futureTransactions)];
|
|
133215
133670
|
case 2:
|
|
133216
133671
|
feeEstimate = _a.sent();
|
|
133217
133672
|
if (!feeEstimate) {
|
|
@@ -133234,22 +133689,22 @@ var SubstrateProtocol = /** @class */ (function (_super) {
|
|
|
133234
133689
|
case 0:
|
|
133235
133690
|
destination = recipients[0];
|
|
133236
133691
|
value = values[0];
|
|
133237
|
-
return [4 /*yield*/, this.
|
|
133692
|
+
return [4 /*yield*/, this.options.transactionController.createTransaction(SubstrateTransaction_1.SubstrateTransactionType.TRANSFER, publicKey, 0, {
|
|
133238
133693
|
to: destination && destination.length > 0 ? destination : publicKey,
|
|
133239
133694
|
value: new bignumber_1.default(value)
|
|
133240
133695
|
})];
|
|
133241
133696
|
case 1:
|
|
133242
133697
|
transaction = _a.sent();
|
|
133243
|
-
return [4 /*yield*/, this.
|
|
133698
|
+
return [4 /*yield*/, this.options.transactionController.calculateTransactionFee(transaction)];
|
|
133244
133699
|
case 2:
|
|
133245
133700
|
fee = _a.sent();
|
|
133246
133701
|
if (!fee) {
|
|
133247
133702
|
return [2 /*return*/, Promise.reject('Could not fetch all necessary data.')];
|
|
133248
133703
|
}
|
|
133249
133704
|
return [2 /*return*/, {
|
|
133250
|
-
low: fee.shiftedBy(-this.
|
|
133251
|
-
medium: fee.shiftedBy(-this.
|
|
133252
|
-
high: fee.shiftedBy(-this.
|
|
133705
|
+
low: fee.shiftedBy(-this.getDecimals).toFixed(),
|
|
133706
|
+
medium: fee.shiftedBy(-this.getDecimals).toFixed(),
|
|
133707
|
+
high: fee.shiftedBy(-this.getDecimals).toFixed()
|
|
133253
133708
|
}];
|
|
133254
133709
|
}
|
|
133255
133710
|
});
|
|
@@ -133266,12 +133721,12 @@ var SubstrateProtocol = /** @class */ (function (_super) {
|
|
|
133266
133721
|
}
|
|
133267
133722
|
recipientsWithValues = recipients.map(function (recipient, index) { return [recipient, values[index]]; });
|
|
133268
133723
|
excludeExistentialDeposit = data === null || data === void 0 ? void 0 : data.excludeExistentialDeposit;
|
|
133269
|
-
return [4 /*yield*/, this.
|
|
133724
|
+
return [4 /*yield*/, this.options.accountController.getTransferableBalance(publicKey, excludeExistentialDeposit)];
|
|
133270
133725
|
case 1:
|
|
133271
133726
|
transferableBalance = _a.sent();
|
|
133272
133727
|
totalValue = values.map(function (value) { return new bignumber_1.default(value); }).reduce(function (total, next) { return total.plus(next); }, new bignumber_1.default(0));
|
|
133273
133728
|
available = new bignumber_1.default(transferableBalance).minus(totalValue);
|
|
133274
|
-
return [4 /*yield*/, this.
|
|
133729
|
+
return [4 /*yield*/, this.options.transactionController.prepareSubmittableTransactions(publicKey, available, recipientsWithValues.map(function (_a) {
|
|
133275
133730
|
var recipient = _a[0], value = _a[1];
|
|
133276
133731
|
return ({
|
|
133277
133732
|
type: SubstrateTransaction_1.SubstrateTransactionType.TRANSFER,
|
|
@@ -133297,11 +133752,11 @@ var SubstrateProtocol = /** @class */ (function (_super) {
|
|
|
133297
133752
|
return __generator(this, function (_b) {
|
|
133298
133753
|
switch (_b.label) {
|
|
133299
133754
|
case 0:
|
|
133300
|
-
txs = this.
|
|
133755
|
+
txs = this.options.transactionController
|
|
133301
133756
|
.decodeDetails(encoded)
|
|
133302
133757
|
.map(function (tx) { return [tx.runtimeVersion, tx.transaction]; });
|
|
133303
133758
|
return [4 /*yield*/, Promise.all(txs.map(function (tx) {
|
|
133304
|
-
return _this.
|
|
133759
|
+
return _this.options.nodeClient.submitTransaction(tx[1].encode({ network: _this.options.network.extras.network, runtimeVersion: tx[0] }));
|
|
133305
133760
|
})).catch(function (error) {
|
|
133306
133761
|
throw new errors_1.NetworkError(coinlib_error_1.Domain.SUBSTRATE, error);
|
|
133307
133762
|
})];
|
|
@@ -133318,11 +133773,11 @@ var SubstrateProtocol = /** @class */ (function (_super) {
|
|
|
133318
133773
|
return __generator(this, function (_a) {
|
|
133319
133774
|
switch (_a.label) {
|
|
133320
133775
|
case 0: return [4 /*yield*/, Promise.all([
|
|
133321
|
-
this.
|
|
133322
|
-
this.
|
|
133323
|
-
this.
|
|
133324
|
-
this.
|
|
133325
|
-
this.
|
|
133776
|
+
this.options.accountController.isBonded(accountId),
|
|
133777
|
+
this.options.accountController.isDelegating(accountId),
|
|
133778
|
+
this.options.accountController.getTransferableBalance(accountId),
|
|
133779
|
+
this.options.accountController.getTransferableBalance(accountId, false, false),
|
|
133780
|
+
this.options.accountController.getUnlockingBalance(accountId)
|
|
133326
133781
|
])];
|
|
133327
133782
|
case 1:
|
|
133328
133783
|
results = _a.sent();
|
|
@@ -133417,10 +133872,10 @@ var SubstrateProtocol = /** @class */ (function (_super) {
|
|
|
133417
133872
|
var txs;
|
|
133418
133873
|
var _this = this;
|
|
133419
133874
|
return __generator(this, function (_a) {
|
|
133420
|
-
txs = this.
|
|
133875
|
+
txs = this.options.transactionController.decodeDetails(encoded);
|
|
133421
133876
|
return [2 /*return*/, txs
|
|
133422
133877
|
.map(function (tx) {
|
|
133423
|
-
return tx.transaction.toAirGapTransactions().map(function (part) { return (__assign({ from: [], to: [], amount: '', fee: tx.fee.toString(), protocolIdentifier: _this.
|
|
133878
|
+
return tx.transaction.toAirGapTransactions().map(function (part) { return (__assign({ from: [], to: [], amount: '', fee: tx.fee.toString(), protocolIdentifier: _this.identifier, network: _this.options.network, isInbound: false }, part)); });
|
|
133424
133879
|
})
|
|
133425
133880
|
.reduce(function (flatten, toFlatten) { return flatten.concat(toFlatten); }, [])];
|
|
133426
133881
|
});
|
|
@@ -133656,31 +134111,23 @@ var SubstrateDelegateProtocol_1 = require("../SubstrateDelegateProtocol");
|
|
|
133656
134111
|
var AstarProtocolOptions_1 = require("./AstarProtocolOptions");
|
|
133657
134112
|
var AstarProtocol = /** @class */ (function (_super) {
|
|
133658
134113
|
__extends(AstarProtocol, _super);
|
|
133659
|
-
function AstarProtocol(
|
|
133660
|
-
if (
|
|
133661
|
-
var _this = _super.call(this,
|
|
133662
|
-
_this.
|
|
133663
|
-
_this.
|
|
133664
|
-
_this.
|
|
133665
|
-
_this.
|
|
133666
|
-
_this.
|
|
133667
|
-
_this.
|
|
133668
|
-
_this.
|
|
133669
|
-
_this.
|
|
133670
|
-
_this.
|
|
133671
|
-
_this._decimals = 18;
|
|
133672
|
-
_this.decimals = Promise.resolve(_this._decimals);
|
|
133673
|
-
_this._feeDecimals = 18;
|
|
133674
|
-
_this.feeDecimals = Promise.resolve(_this._feeDecimals);
|
|
133675
|
-
_this._identifier = ProtocolSymbols_1.MainProtocolSymbols.ASTAR;
|
|
133676
|
-
_this.identifier = Promise.resolve(_this._identifier);
|
|
133677
|
-
_this._feeDefaults = {
|
|
134114
|
+
function AstarProtocol(options) {
|
|
134115
|
+
if (options === void 0) { options = new AstarProtocolOptions_1.AstarProtocolOptions(); }
|
|
134116
|
+
var _this = _super.call(this, options) || this;
|
|
134117
|
+
_this.options = options;
|
|
134118
|
+
_this.symbol = 'ASTR';
|
|
134119
|
+
_this.name = 'Astar';
|
|
134120
|
+
_this.marketSymbol = 'ASTR';
|
|
134121
|
+
_this.feeSymbol = 'ASTR';
|
|
134122
|
+
_this.decimals = 18;
|
|
134123
|
+
_this.feeDecimals = 18;
|
|
134124
|
+
_this.identifier = ProtocolSymbols_1.MainProtocolSymbols.ASTAR;
|
|
134125
|
+
_this.feeDefaults = {
|
|
133678
134126
|
low: '0.001',
|
|
133679
134127
|
medium: '0.001',
|
|
133680
134128
|
high: '0.001'
|
|
133681
134129
|
};
|
|
133682
|
-
_this.
|
|
133683
|
-
_this._units = [
|
|
134130
|
+
_this.units = [
|
|
133684
134131
|
{
|
|
133685
134132
|
unitSymbol: 'ASTR',
|
|
133686
134133
|
factor: '1'
|
|
@@ -133710,15 +134157,10 @@ var AstarProtocol = /** @class */ (function (_super) {
|
|
|
133710
134157
|
factor: '0.000000000000000001'
|
|
133711
134158
|
}
|
|
133712
134159
|
];
|
|
133713
|
-
_this.
|
|
133714
|
-
_this.
|
|
133715
|
-
_this.
|
|
133716
|
-
_this.
|
|
133717
|
-
_this.addressIsCaseSensitive = Promise.resolve(_this._addressIsCaseSensitive);
|
|
133718
|
-
_this._addressValidationPattern = '^[a-km-zA-HJ-NP-Z1-9]+$';
|
|
133719
|
-
_this.addressValidationPattern = Promise.resolve(_this._addressValidationPattern);
|
|
133720
|
-
_this._addressPlaceholder = "ABC...";
|
|
133721
|
-
_this.addressPlaceholder = Promise.resolve(_this._addressPlaceholder);
|
|
134160
|
+
_this.standardDerivationPath = "m/44'/810'/0'/0/0";
|
|
134161
|
+
_this.addressIsCaseSensitive = true;
|
|
134162
|
+
_this.addressValidationPattern = '^[a-km-zA-HJ-NP-Z1-9]+$';
|
|
134163
|
+
_this.addressPlaceholder = "ABC...";
|
|
133722
134164
|
return _this;
|
|
133723
134165
|
}
|
|
133724
134166
|
return AstarProtocol;
|
|
@@ -133842,21 +134284,16 @@ var AstarProtocol_1 = require("../AstarProtocol");
|
|
|
133842
134284
|
var ShidenProtocolOptions_1 = require("./ShidenProtocolOptions");
|
|
133843
134285
|
var ShidenProtocol = /** @class */ (function (_super) {
|
|
133844
134286
|
__extends(ShidenProtocol, _super);
|
|
133845
|
-
function ShidenProtocol(
|
|
133846
|
-
if (
|
|
133847
|
-
var _this = _super.call(this,
|
|
133848
|
-
_this.
|
|
133849
|
-
_this.
|
|
133850
|
-
_this.
|
|
133851
|
-
_this.
|
|
133852
|
-
_this.
|
|
133853
|
-
_this.
|
|
133854
|
-
_this.
|
|
133855
|
-
_this._feeSymbol = 'SDN';
|
|
133856
|
-
_this.feeSymbol = Promise.resolve(_this._feeSymbol);
|
|
133857
|
-
_this._identifier = ProtocolSymbols_1.MainProtocolSymbols.SHIDEN;
|
|
133858
|
-
_this.identifier = Promise.resolve(_this._identifier);
|
|
133859
|
-
_this._units = [
|
|
134287
|
+
function ShidenProtocol(options) {
|
|
134288
|
+
if (options === void 0) { options = new ShidenProtocolOptions_1.ShidenProtocolOptions(); }
|
|
134289
|
+
var _this = _super.call(this, options) || this;
|
|
134290
|
+
_this.options = options;
|
|
134291
|
+
_this.symbol = 'SDN';
|
|
134292
|
+
_this.name = 'Shiden';
|
|
134293
|
+
_this.marketSymbol = 'SDN';
|
|
134294
|
+
_this.feeSymbol = 'SDN';
|
|
134295
|
+
_this.identifier = ProtocolSymbols_1.MainProtocolSymbols.SHIDEN;
|
|
134296
|
+
_this.units = [
|
|
133860
134297
|
{
|
|
133861
134298
|
unitSymbol: 'SDN',
|
|
133862
134299
|
factor: '1'
|
|
@@ -133886,15 +134323,10 @@ var ShidenProtocol = /** @class */ (function (_super) {
|
|
|
133886
134323
|
factor: '0.000000000000000001'
|
|
133887
134324
|
}
|
|
133888
134325
|
];
|
|
133889
|
-
_this.
|
|
133890
|
-
_this.
|
|
133891
|
-
_this.
|
|
133892
|
-
_this.
|
|
133893
|
-
_this.addressIsCaseSensitive = Promise.resolve(_this._addressIsCaseSensitive);
|
|
133894
|
-
_this._addressValidationPattern = '^[a-km-zA-HJ-NP-Z1-9]+$';
|
|
133895
|
-
_this.addressValidationPattern = Promise.resolve(_this._addressValidationPattern);
|
|
133896
|
-
_this._addressPlaceholder = "ABC...";
|
|
133897
|
-
_this.addressPlaceholder = Promise.resolve(_this._addressPlaceholder);
|
|
134326
|
+
_this.standardDerivationPath = "m/44'/810'/0'/0/0";
|
|
134327
|
+
_this.addressIsCaseSensitive = true;
|
|
134328
|
+
_this.addressValidationPattern = '^[a-km-zA-HJ-NP-Z1-9]+$';
|
|
134329
|
+
_this.addressPlaceholder = "ABC...";
|
|
133898
134330
|
return _this;
|
|
133899
134331
|
}
|
|
133900
134332
|
return ShidenProtocol;
|
|
@@ -141897,31 +142329,23 @@ var SubstrateDelegateProtocol_1 = require("../SubstrateDelegateProtocol");
|
|
|
141897
142329
|
var KusamaProtocolOptions_1 = require("./KusamaProtocolOptions");
|
|
141898
142330
|
var KusamaProtocol = /** @class */ (function (_super) {
|
|
141899
142331
|
__extends(KusamaProtocol, _super);
|
|
141900
|
-
function KusamaProtocol(
|
|
141901
|
-
if (
|
|
141902
|
-
var _this = _super.call(this,
|
|
141903
|
-
_this.
|
|
141904
|
-
_this.
|
|
141905
|
-
_this.
|
|
141906
|
-
_this.
|
|
141907
|
-
_this.
|
|
141908
|
-
_this.
|
|
141909
|
-
_this.
|
|
141910
|
-
_this.
|
|
141911
|
-
_this.
|
|
141912
|
-
_this._decimals = 12;
|
|
141913
|
-
_this.decimals = Promise.resolve(_this._decimals);
|
|
141914
|
-
_this._feeDecimals = 12;
|
|
141915
|
-
_this.feeDecimals = Promise.resolve(_this._feeDecimals);
|
|
141916
|
-
_this._identifier = ProtocolSymbols_1.MainProtocolSymbols.KUSAMA;
|
|
141917
|
-
_this.identifier = Promise.resolve(_this._identifier);
|
|
141918
|
-
_this._feeDefaults = {
|
|
142332
|
+
function KusamaProtocol(options) {
|
|
142333
|
+
if (options === void 0) { options = new KusamaProtocolOptions_1.KusamaProtocolOptions(); }
|
|
142334
|
+
var _this = _super.call(this, options) || this;
|
|
142335
|
+
_this.options = options;
|
|
142336
|
+
_this.symbol = 'KSM';
|
|
142337
|
+
_this.name = 'Kusama';
|
|
142338
|
+
_this.marketSymbol = 'KSM';
|
|
142339
|
+
_this.feeSymbol = 'KSM';
|
|
142340
|
+
_this.decimals = 12;
|
|
142341
|
+
_this.feeDecimals = 12;
|
|
142342
|
+
_this.identifier = ProtocolSymbols_1.MainProtocolSymbols.KUSAMA;
|
|
142343
|
+
_this.feeDefaults = {
|
|
141919
142344
|
low: '0.001',
|
|
141920
142345
|
medium: '0.001',
|
|
141921
142346
|
high: '0.001'
|
|
141922
142347
|
};
|
|
141923
|
-
_this.
|
|
141924
|
-
_this._units = [
|
|
142348
|
+
_this.units = [
|
|
141925
142349
|
{
|
|
141926
142350
|
unitSymbol: 'KSM',
|
|
141927
142351
|
factor: '1'
|
|
@@ -141943,15 +142367,10 @@ var KusamaProtocol = /** @class */ (function (_super) {
|
|
|
141943
142367
|
factor: '0.000000000001'
|
|
141944
142368
|
}
|
|
141945
142369
|
];
|
|
141946
|
-
_this.
|
|
141947
|
-
_this.
|
|
141948
|
-
_this.
|
|
141949
|
-
_this.
|
|
141950
|
-
_this.addressIsCaseSensitive = Promise.resolve(_this._addressIsCaseSensitive);
|
|
141951
|
-
_this._addressValidationPattern = '^[C-HJ][a-km-zA-HJ-NP-Z1-9]+$';
|
|
141952
|
-
_this.addressValidationPattern = Promise.resolve(_this._addressValidationPattern);
|
|
141953
|
-
_this._addressPlaceholder = "C/D/E/F/G/H/J...";
|
|
141954
|
-
_this.addressPlaceholder = Promise.resolve(_this._addressPlaceholder);
|
|
142370
|
+
_this.standardDerivationPath = "m/44'/434'/0'/0/0";
|
|
142371
|
+
_this.addressIsCaseSensitive = true;
|
|
142372
|
+
_this.addressValidationPattern = '^[C-HJ][a-km-zA-HJ-NP-Z1-9]+$';
|
|
142373
|
+
_this.addressPlaceholder = "C/D/E/F/G/H/J...";
|
|
141955
142374
|
return _this;
|
|
141956
142375
|
}
|
|
141957
142376
|
return KusamaProtocol;
|
|
@@ -142107,31 +142526,23 @@ var MoonbeamStakingActionType_1 = require("./data/staking/MoonbeamStakingActionT
|
|
|
142107
142526
|
var MoonbeamProtocolOptions_1 = require("./MoonbeamProtocolOptions");
|
|
142108
142527
|
var MoonbeamProtocol = /** @class */ (function (_super) {
|
|
142109
142528
|
__extends(MoonbeamProtocol, _super);
|
|
142110
|
-
function MoonbeamProtocol(
|
|
142111
|
-
if (
|
|
142112
|
-
var _this = _super.call(this,
|
|
142113
|
-
_this.
|
|
142114
|
-
_this.
|
|
142115
|
-
_this.
|
|
142116
|
-
_this.
|
|
142117
|
-
_this.
|
|
142118
|
-
_this.
|
|
142119
|
-
_this.
|
|
142120
|
-
_this.
|
|
142121
|
-
_this.
|
|
142122
|
-
_this._decimals = 18;
|
|
142123
|
-
_this.decimals = Promise.resolve(_this._decimals);
|
|
142124
|
-
_this._feeDecimals = 18;
|
|
142125
|
-
_this.feeDecimals = Promise.resolve(_this._feeDecimals);
|
|
142126
|
-
_this._identifier = ProtocolSymbols_1.MainProtocolSymbols.MOONBEAM;
|
|
142127
|
-
_this.identifier = Promise.resolve(_this._identifier);
|
|
142128
|
-
_this._feeDefaults = {
|
|
142529
|
+
function MoonbeamProtocol(options) {
|
|
142530
|
+
if (options === void 0) { options = new MoonbeamProtocolOptions_1.MoonbeamProtocolOptions(new MoonbeamProtocolOptions_1.MoonbeamProtocolNetwork()); }
|
|
142531
|
+
var _this = _super.call(this, options) || this;
|
|
142532
|
+
_this.options = options;
|
|
142533
|
+
_this.symbol = 'GLMR';
|
|
142534
|
+
_this.name = 'Moonbeam';
|
|
142535
|
+
_this.marketSymbol = 'GLMR';
|
|
142536
|
+
_this.feeSymbol = 'GLMR';
|
|
142537
|
+
_this.decimals = 18;
|
|
142538
|
+
_this.feeDecimals = 18;
|
|
142539
|
+
_this.identifier = ProtocolSymbols_1.MainProtocolSymbols.MOONBEAM;
|
|
142540
|
+
_this.feeDefaults = {
|
|
142129
142541
|
low: '0.000000000125',
|
|
142130
142542
|
medium: '0.000000000125',
|
|
142131
142543
|
high: '0.000000000125'
|
|
142132
142544
|
};
|
|
142133
|
-
_this.
|
|
142134
|
-
_this._units = [
|
|
142545
|
+
_this.units = [
|
|
142135
142546
|
{
|
|
142136
142547
|
unitSymbol: 'GLMR',
|
|
142137
142548
|
factor: '1'
|
|
@@ -142161,15 +142572,10 @@ var MoonbeamProtocol = /** @class */ (function (_super) {
|
|
|
142161
142572
|
factor: '0.000000000000000001'
|
|
142162
142573
|
}
|
|
142163
142574
|
];
|
|
142164
|
-
_this.
|
|
142165
|
-
_this.
|
|
142166
|
-
_this.
|
|
142167
|
-
_this.
|
|
142168
|
-
_this.addressIsCaseSensitive = Promise.resolve(_this._addressIsCaseSensitive);
|
|
142169
|
-
_this._addressValidationPattern = '^0x[a-fA-F0-9]{40}$';
|
|
142170
|
-
_this.addressValidationPattern = Promise.resolve(_this._addressValidationPattern);
|
|
142171
|
-
_this._addressPlaceholder = "0xabc...";
|
|
142172
|
-
_this.addressPlaceholder = Promise.resolve(_this._addressPlaceholder);
|
|
142575
|
+
_this.standardDerivationPath = "m/44'/60'/0'/0/0";
|
|
142576
|
+
_this.addressIsCaseSensitive = false;
|
|
142577
|
+
_this.addressValidationPattern = '^0x[a-fA-F0-9]{40}$';
|
|
142578
|
+
_this.addressPlaceholder = "0xabc...";
|
|
142173
142579
|
return _this;
|
|
142174
142580
|
}
|
|
142175
142581
|
MoonbeamProtocol.prototype.getDefaultDelegatee = function () {
|
|
@@ -142181,7 +142587,7 @@ var MoonbeamProtocol = /** @class */ (function (_super) {
|
|
|
142181
142587
|
if (this.defaultValidator) {
|
|
142182
142588
|
return [2 /*return*/, this.defaultValidator];
|
|
142183
142589
|
}
|
|
142184
|
-
return [4 /*yield*/, this.
|
|
142590
|
+
return [4 /*yield*/, this.options.nodeClient.getCollators()];
|
|
142185
142591
|
case 1:
|
|
142186
142592
|
collators = _a.sent();
|
|
142187
142593
|
return [2 /*return*/, collators ? collators[0].asString() : ''];
|
|
@@ -142192,14 +142598,14 @@ var MoonbeamProtocol = /** @class */ (function (_super) {
|
|
|
142192
142598
|
MoonbeamProtocol.prototype.getCurrentDelegateesForPublicKey = function (publicKey) {
|
|
142193
142599
|
return __awaiter(this, void 0, void 0, function () {
|
|
142194
142600
|
return __generator(this, function (_a) {
|
|
142195
|
-
return [2 /*return*/, this.
|
|
142601
|
+
return [2 /*return*/, this.options.accountController.getCurrentCollators(publicKey)];
|
|
142196
142602
|
});
|
|
142197
142603
|
});
|
|
142198
142604
|
};
|
|
142199
142605
|
MoonbeamProtocol.prototype.getCurrentDelegateesForAddress = function (address) {
|
|
142200
142606
|
return __awaiter(this, void 0, void 0, function () {
|
|
142201
142607
|
return __generator(this, function (_a) {
|
|
142202
|
-
return [2 /*return*/, this.
|
|
142608
|
+
return [2 /*return*/, this.options.accountController.getCurrentCollators(address)];
|
|
142203
142609
|
});
|
|
142204
142610
|
});
|
|
142205
142611
|
};
|
|
@@ -142209,7 +142615,7 @@ var MoonbeamProtocol = /** @class */ (function (_super) {
|
|
|
142209
142615
|
var collatorDetails;
|
|
142210
142616
|
return __generator(this, function (_c) {
|
|
142211
142617
|
switch (_c.label) {
|
|
142212
|
-
case 0: return [4 /*yield*/, this.
|
|
142618
|
+
case 0: return [4 /*yield*/, this.options.accountController.getCollatorDetails(address)];
|
|
142213
142619
|
case 1:
|
|
142214
142620
|
collatorDetails = _c.sent();
|
|
142215
142621
|
return [2 /*return*/, {
|
|
@@ -142224,28 +142630,28 @@ var MoonbeamProtocol = /** @class */ (function (_super) {
|
|
|
142224
142630
|
MoonbeamProtocol.prototype.isPublicKeyDelegating = function (publicKey) {
|
|
142225
142631
|
return __awaiter(this, void 0, void 0, function () {
|
|
142226
142632
|
return __generator(this, function (_a) {
|
|
142227
|
-
return [2 /*return*/, this.
|
|
142633
|
+
return [2 /*return*/, this.options.accountController.isDelegating(publicKey)];
|
|
142228
142634
|
});
|
|
142229
142635
|
});
|
|
142230
142636
|
};
|
|
142231
142637
|
MoonbeamProtocol.prototype.isAddressDelegating = function (address) {
|
|
142232
142638
|
return __awaiter(this, void 0, void 0, function () {
|
|
142233
142639
|
return __generator(this, function (_a) {
|
|
142234
|
-
return [2 /*return*/, this.
|
|
142640
|
+
return [2 /*return*/, this.options.accountController.isDelegating(address)];
|
|
142235
142641
|
});
|
|
142236
142642
|
});
|
|
142237
142643
|
};
|
|
142238
142644
|
MoonbeamProtocol.prototype.getDelegatorDetailsFromPublicKey = function (publicKey) {
|
|
142239
142645
|
return __awaiter(this, void 0, void 0, function () {
|
|
142240
142646
|
return __generator(this, function (_a) {
|
|
142241
|
-
return [2 /*return*/, this.
|
|
142647
|
+
return [2 /*return*/, this.options.accountController.getDelegatorDetails(publicKey)];
|
|
142242
142648
|
});
|
|
142243
142649
|
});
|
|
142244
142650
|
};
|
|
142245
142651
|
MoonbeamProtocol.prototype.getDelegatorDetailsFromAddress = function (address) {
|
|
142246
142652
|
return __awaiter(this, void 0, void 0, function () {
|
|
142247
142653
|
return __generator(this, function (_a) {
|
|
142248
|
-
return [2 /*return*/, this.
|
|
142654
|
+
return [2 /*return*/, this.options.accountController.getDelegatorDetails(address)];
|
|
142249
142655
|
});
|
|
142250
142656
|
});
|
|
142251
142657
|
};
|
|
@@ -142272,7 +142678,7 @@ var MoonbeamProtocol = /** @class */ (function (_super) {
|
|
|
142272
142678
|
throw new errors_1.UnsupportedError(coinlib_error_1.Domain.SUBSTRATE, 'Multiple validators for a single delegation are not supported');
|
|
142273
142679
|
}
|
|
142274
142680
|
collator = delegatees[0];
|
|
142275
|
-
return [4 /*yield*/, this.
|
|
142681
|
+
return [4 /*yield*/, this.options.accountController.getDelegationDetails(address, collator)];
|
|
142276
142682
|
case 1:
|
|
142277
142683
|
delegationDetails = _a.sent();
|
|
142278
142684
|
return [2 /*return*/, {
|
|
@@ -142342,9 +142748,9 @@ var MoonbeamProtocol = /** @class */ (function (_super) {
|
|
|
142342
142748
|
throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.SUBSTRATE, "The amount is too low, it has to be at least " + minAmount.toString());
|
|
142343
142749
|
}
|
|
142344
142750
|
return [4 /*yield*/, Promise.all([
|
|
142345
|
-
this.
|
|
142346
|
-
this.
|
|
142347
|
-
this.
|
|
142751
|
+
this.options.accountController.getDelegatorDetails(publicKey),
|
|
142752
|
+
this.options.accountController.getCollatorDetails(candidate),
|
|
142753
|
+
this.options.nodeClient.getMaxDelegationsPerDelegator(),
|
|
142348
142754
|
this.getBalanceOfPublicKey(publicKey)
|
|
142349
142755
|
])];
|
|
142350
142756
|
case 2:
|
|
@@ -142357,7 +142763,7 @@ var MoonbeamProtocol = /** @class */ (function (_super) {
|
|
|
142357
142763
|
throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.SUBSTRATE, 'This delegator cannot nominate more collators.');
|
|
142358
142764
|
}
|
|
142359
142765
|
available = new bignumber_1.BigNumber(balance).minus(amount);
|
|
142360
|
-
return [4 /*yield*/, this.
|
|
142766
|
+
return [4 /*yield*/, this.options.transactionController.prepareSubmittableTransactions(publicKey, available, [
|
|
142361
142767
|
{
|
|
142362
142768
|
type: SubstrateTransaction_1.SubstrateTransactionType.M_DELEGATE,
|
|
142363
142769
|
tip: tip,
|
|
@@ -142384,7 +142790,7 @@ var MoonbeamProtocol = /** @class */ (function (_super) {
|
|
|
142384
142790
|
case 0: return [4 /*yield*/, this.getBalanceOfPublicKey(publicKey)];
|
|
142385
142791
|
case 1:
|
|
142386
142792
|
balance = _a.sent();
|
|
142387
|
-
return [4 /*yield*/, this.
|
|
142793
|
+
return [4 /*yield*/, this.options.transactionController.prepareSubmittableTransactions(publicKey, balance, [
|
|
142388
142794
|
{
|
|
142389
142795
|
type: SubstrateTransaction_1.SubstrateTransactionType.M_SCHEDULE_REVOKE_DELGATION,
|
|
142390
142796
|
tip: tip,
|
|
@@ -142422,7 +142828,7 @@ var MoonbeamProtocol = /** @class */ (function (_super) {
|
|
|
142422
142828
|
case 0: return [4 /*yield*/, this.getBalanceOfPublicKey(publicKey)];
|
|
142423
142829
|
case 1:
|
|
142424
142830
|
balance = _a.sent();
|
|
142425
|
-
return [4 /*yield*/, this.
|
|
142831
|
+
return [4 /*yield*/, this.options.transactionController.prepareSubmittableTransactions(publicKey, balance, [
|
|
142426
142832
|
{
|
|
142427
142833
|
type: SubstrateTransaction_1.SubstrateTransactionType.M_SCHEDULE_LEAVE_DELEGATORS,
|
|
142428
142834
|
tip: tip,
|
|
@@ -142442,7 +142848,7 @@ var MoonbeamProtocol = /** @class */ (function (_super) {
|
|
|
142442
142848
|
return __generator(this, function (_a) {
|
|
142443
142849
|
switch (_a.label) {
|
|
142444
142850
|
case 0: return [4 /*yield*/, Promise.all([
|
|
142445
|
-
this.
|
|
142851
|
+
this.options.accountController.getDelegatorDetails(publicKey),
|
|
142446
142852
|
this.getBalanceOfPublicKey(publicKey),
|
|
142447
142853
|
this.getAddressFromPublicKey(publicKey)
|
|
142448
142854
|
])];
|
|
@@ -142451,7 +142857,7 @@ var MoonbeamProtocol = /** @class */ (function (_super) {
|
|
|
142451
142857
|
delegatorDetails = results[0];
|
|
142452
142858
|
balance = results[1];
|
|
142453
142859
|
delegator = results[2].address;
|
|
142454
|
-
return [4 /*yield*/, this.
|
|
142860
|
+
return [4 /*yield*/, this.options.transactionController.prepareSubmittableTransactions(publicKey, balance, [
|
|
142455
142861
|
{
|
|
142456
142862
|
type: SubstrateTransaction_1.SubstrateTransactionType.M_EXECUTE_LEAVE_DELEGATORS,
|
|
142457
142863
|
tip: tip,
|
|
@@ -142476,7 +142882,7 @@ var MoonbeamProtocol = /** @class */ (function (_super) {
|
|
|
142476
142882
|
case 0: return [4 /*yield*/, this.getBalanceOfPublicKey(publicKey)];
|
|
142477
142883
|
case 1:
|
|
142478
142884
|
balance = _a.sent();
|
|
142479
|
-
return [4 /*yield*/, this.
|
|
142885
|
+
return [4 /*yield*/, this.options.transactionController.prepareSubmittableTransactions(publicKey, balance, [
|
|
142480
142886
|
{
|
|
142481
142887
|
type: SubstrateTransaction_1.SubstrateTransactionType.M_CANCEL_LEAVE_DELEGATORS,
|
|
142482
142888
|
tip: tip,
|
|
@@ -142499,7 +142905,7 @@ var MoonbeamProtocol = /** @class */ (function (_super) {
|
|
|
142499
142905
|
case 1:
|
|
142500
142906
|
balance = _a.sent();
|
|
142501
142907
|
available = new bignumber_1.BigNumber(balance).minus(more);
|
|
142502
|
-
return [4 /*yield*/, this.
|
|
142908
|
+
return [4 /*yield*/, this.options.transactionController.prepareSubmittableTransactions(publicKey, available, [
|
|
142503
142909
|
{
|
|
142504
142910
|
type: SubstrateTransaction_1.SubstrateTransactionType.M_DELEGATOR_BOND_MORE,
|
|
142505
142911
|
tip: tip,
|
|
@@ -142523,7 +142929,7 @@ var MoonbeamProtocol = /** @class */ (function (_super) {
|
|
|
142523
142929
|
switch (_b.label) {
|
|
142524
142930
|
case 0: return [4 /*yield*/, Promise.all([
|
|
142525
142931
|
this.getBalanceOfPublicKey(publicKey),
|
|
142526
|
-
this.
|
|
142932
|
+
this.options.accountController.getDelegationDetails(publicKey, candidate)
|
|
142527
142933
|
])];
|
|
142528
142934
|
case 1:
|
|
142529
142935
|
_a = _b.sent(), balance = _a[0], delegationDetails = _a[1];
|
|
@@ -142535,7 +142941,7 @@ var MoonbeamProtocol = /** @class */ (function (_super) {
|
|
|
142535
142941
|
else if (requestedAmount.eq(bondAmount)) {
|
|
142536
142942
|
return [2 /*return*/, this.prepareScheduleUndelegate(publicKey, tip, candidate)];
|
|
142537
142943
|
}
|
|
142538
|
-
return [4 /*yield*/, this.
|
|
142944
|
+
return [4 /*yield*/, this.options.transactionController.prepareSubmittableTransactions(publicKey, balance, [
|
|
142539
142945
|
{
|
|
142540
142946
|
type: SubstrateTransaction_1.SubstrateTransactionType.M_SCHEDULE_DELEGATOR_BOND_LESS,
|
|
142541
142947
|
tip: tip,
|
|
@@ -142576,7 +142982,7 @@ var MoonbeamProtocol = /** @class */ (function (_super) {
|
|
|
142576
142982
|
results = _a.sent();
|
|
142577
142983
|
balance = results[0];
|
|
142578
142984
|
delegator = results[1].address;
|
|
142579
|
-
return [4 /*yield*/, this.
|
|
142985
|
+
return [4 /*yield*/, this.options.transactionController.prepareSubmittableTransactions(publicKey, balance, [
|
|
142580
142986
|
{
|
|
142581
142987
|
type: SubstrateTransaction_1.SubstrateTransactionType.M_EXECUTE_DELGATION_REQUEST,
|
|
142582
142988
|
tip: tip,
|
|
@@ -142601,7 +143007,7 @@ var MoonbeamProtocol = /** @class */ (function (_super) {
|
|
|
142601
143007
|
case 0: return [4 /*yield*/, this.getBalanceOfPublicKey(publicKey)];
|
|
142602
143008
|
case 1:
|
|
142603
143009
|
balance = _a.sent();
|
|
142604
|
-
return [4 /*yield*/, this.
|
|
143010
|
+
return [4 /*yield*/, this.options.transactionController.prepareSubmittableTransactions(publicKey, balance, [
|
|
142605
143011
|
{
|
|
142606
143012
|
type: SubstrateTransaction_1.SubstrateTransactionType.M_CANCEL_DELEGATION_REQUEST,
|
|
142607
143013
|
tip: tip,
|
|
@@ -142620,7 +143026,7 @@ var MoonbeamProtocol = /** @class */ (function (_super) {
|
|
|
142620
143026
|
MoonbeamProtocol.prototype.getMinDelegationAmount = function (accountId) {
|
|
142621
143027
|
return __awaiter(this, void 0, void 0, function () {
|
|
142622
143028
|
return __generator(this, function (_a) {
|
|
142623
|
-
return [2 /*return*/, this.
|
|
143029
|
+
return [2 /*return*/, this.options.accountController.getMinDelegationAmount(accountId)];
|
|
142624
143030
|
});
|
|
142625
143031
|
});
|
|
142626
143032
|
};
|
|
@@ -142630,9 +143036,9 @@ var MoonbeamProtocol = /** @class */ (function (_super) {
|
|
|
142630
143036
|
return __generator(this, function (_a) {
|
|
142631
143037
|
switch (_a.label) {
|
|
142632
143038
|
case 0: return [4 /*yield*/, Promise.all([
|
|
142633
|
-
this.
|
|
142634
|
-
this.
|
|
142635
|
-
this.
|
|
143039
|
+
this.options.accountController.isDelegating(accountId),
|
|
143040
|
+
this.options.accountController.getTransferableBalance(accountId),
|
|
143041
|
+
this.options.accountController.getTransferableBalance(accountId, false, false)
|
|
142636
143042
|
])];
|
|
142637
143043
|
case 1:
|
|
142638
143044
|
results = _a.sent();
|
|
@@ -144013,31 +144419,23 @@ var ProtocolSymbols_1 = require("../../../../utils/ProtocolSymbols");
|
|
|
144013
144419
|
var MoonbaseProtocolOptions_1 = require("./MoonbaseProtocolOptions");
|
|
144014
144420
|
var MoonbaseProtocol = /** @class */ (function (_super) {
|
|
144015
144421
|
__extends(MoonbaseProtocol, _super);
|
|
144016
|
-
function MoonbaseProtocol(
|
|
144017
|
-
if (
|
|
144018
|
-
var _this = _super.call(this,
|
|
144019
|
-
_this.
|
|
144020
|
-
_this.
|
|
144021
|
-
_this.
|
|
144022
|
-
_this.
|
|
144023
|
-
_this.
|
|
144024
|
-
_this.
|
|
144025
|
-
_this.
|
|
144026
|
-
_this.
|
|
144027
|
-
_this.
|
|
144028
|
-
_this._decimals = 18;
|
|
144029
|
-
_this.decimals = Promise.resolve(_this._decimals);
|
|
144030
|
-
_this._feeDecimals = 18;
|
|
144031
|
-
_this.feeDecimals = Promise.resolve(_this._feeDecimals);
|
|
144032
|
-
_this._identifier = ProtocolSymbols_1.MainProtocolSymbols.MOONBASE;
|
|
144033
|
-
_this.identifier = Promise.resolve(_this._identifier);
|
|
144034
|
-
_this._feeDefaults = {
|
|
144422
|
+
function MoonbaseProtocol(options) {
|
|
144423
|
+
if (options === void 0) { options = new MoonbaseProtocolOptions_1.MoonbaseProtocolOptions(); }
|
|
144424
|
+
var _this = _super.call(this, options) || this;
|
|
144425
|
+
_this.options = options;
|
|
144426
|
+
_this.symbol = 'DEV';
|
|
144427
|
+
_this.name = 'Moonbase';
|
|
144428
|
+
_this.marketSymbol = 'DEV';
|
|
144429
|
+
_this.feeSymbol = 'DEV';
|
|
144430
|
+
_this.decimals = 18;
|
|
144431
|
+
_this.feeDecimals = 18;
|
|
144432
|
+
_this.identifier = ProtocolSymbols_1.MainProtocolSymbols.MOONBASE;
|
|
144433
|
+
_this.feeDefaults = {
|
|
144035
144434
|
low: '0.000000000125',
|
|
144036
144435
|
medium: '0.000000000125',
|
|
144037
144436
|
high: '0.000000000125'
|
|
144038
144437
|
};
|
|
144039
|
-
_this.
|
|
144040
|
-
_this._units = [
|
|
144438
|
+
_this.units = [
|
|
144041
144439
|
{
|
|
144042
144440
|
unitSymbol: 'DEV',
|
|
144043
144441
|
factor: '1'
|
|
@@ -144067,7 +144465,6 @@ var MoonbaseProtocol = /** @class */ (function (_super) {
|
|
|
144067
144465
|
factor: '0.000000000000000001'
|
|
144068
144466
|
}
|
|
144069
144467
|
];
|
|
144070
|
-
_this.units = Promise.resolve(_this._units);
|
|
144071
144468
|
return _this;
|
|
144072
144469
|
}
|
|
144073
144470
|
return MoonbaseProtocol;
|
|
@@ -144175,31 +144572,23 @@ var MoonbeamProtocol_1 = require("../MoonbeamProtocol");
|
|
|
144175
144572
|
var MoonriverProtocolOptions_1 = require("./MoonriverProtocolOptions");
|
|
144176
144573
|
var MoonriverProtocol = /** @class */ (function (_super) {
|
|
144177
144574
|
__extends(MoonriverProtocol, _super);
|
|
144178
|
-
function MoonriverProtocol(
|
|
144179
|
-
if (
|
|
144180
|
-
var _this = _super.call(this,
|
|
144181
|
-
_this.
|
|
144182
|
-
_this.
|
|
144183
|
-
_this.
|
|
144184
|
-
_this.
|
|
144185
|
-
_this.
|
|
144186
|
-
_this.
|
|
144187
|
-
_this.
|
|
144188
|
-
_this.
|
|
144189
|
-
_this.
|
|
144190
|
-
_this._decimals = 18;
|
|
144191
|
-
_this.decimals = Promise.resolve(_this._decimals);
|
|
144192
|
-
_this._feeDecimals = 18;
|
|
144193
|
-
_this.feeDecimals = Promise.resolve(_this._feeDecimals);
|
|
144194
|
-
_this._identifier = ProtocolSymbols_1.MainProtocolSymbols.MOONRIVER;
|
|
144195
|
-
_this.identifier = Promise.resolve(_this._identifier);
|
|
144196
|
-
_this._feeDefaults = {
|
|
144575
|
+
function MoonriverProtocol(options) {
|
|
144576
|
+
if (options === void 0) { options = new MoonriverProtocolOptions_1.MoonriverProtocolOptions(); }
|
|
144577
|
+
var _this = _super.call(this, options) || this;
|
|
144578
|
+
_this.options = options;
|
|
144579
|
+
_this.symbol = 'MOVR';
|
|
144580
|
+
_this.name = 'Moonriver';
|
|
144581
|
+
_this.marketSymbol = 'MOVR';
|
|
144582
|
+
_this.feeSymbol = 'MOVR';
|
|
144583
|
+
_this.decimals = 18;
|
|
144584
|
+
_this.feeDecimals = 18;
|
|
144585
|
+
_this.identifier = ProtocolSymbols_1.MainProtocolSymbols.MOONRIVER;
|
|
144586
|
+
_this.feeDefaults = {
|
|
144197
144587
|
low: '0.000000000125',
|
|
144198
144588
|
medium: '0.000000000125',
|
|
144199
144589
|
high: '0.000000000125'
|
|
144200
144590
|
};
|
|
144201
|
-
_this.
|
|
144202
|
-
_this._units = [
|
|
144591
|
+
_this.units = [
|
|
144203
144592
|
{
|
|
144204
144593
|
unitSymbol: 'MOVR',
|
|
144205
144594
|
factor: '1'
|
|
@@ -144229,7 +144618,6 @@ var MoonriverProtocol = /** @class */ (function (_super) {
|
|
|
144229
144618
|
factor: '0.000000000000000001'
|
|
144230
144619
|
}
|
|
144231
144620
|
];
|
|
144232
|
-
_this.units = Promise.resolve(_this._units);
|
|
144233
144621
|
return _this;
|
|
144234
144622
|
}
|
|
144235
144623
|
return MoonriverProtocol;
|
|
@@ -144589,31 +144977,23 @@ var SubstrateDelegateProtocol_1 = require("../SubstrateDelegateProtocol");
|
|
|
144589
144977
|
var PolkadotProtocolOptions_1 = require("./PolkadotProtocolOptions");
|
|
144590
144978
|
var PolkadotProtocol = /** @class */ (function (_super) {
|
|
144591
144979
|
__extends(PolkadotProtocol, _super);
|
|
144592
|
-
function PolkadotProtocol(
|
|
144593
|
-
if (
|
|
144594
|
-
var _this = _super.call(this,
|
|
144595
|
-
_this.
|
|
144596
|
-
_this.
|
|
144597
|
-
_this.
|
|
144598
|
-
_this.
|
|
144599
|
-
_this.
|
|
144600
|
-
_this.
|
|
144601
|
-
_this.
|
|
144602
|
-
_this.
|
|
144603
|
-
_this.
|
|
144604
|
-
_this._decimals = 10;
|
|
144605
|
-
_this.decimals = Promise.resolve(_this._decimals);
|
|
144606
|
-
_this._feeDecimals = 10;
|
|
144607
|
-
_this.feeDecimals = Promise.resolve(_this._feeDecimals);
|
|
144608
|
-
_this._identifier = ProtocolSymbols_1.MainProtocolSymbols.POLKADOT;
|
|
144609
|
-
_this.identifier = Promise.resolve(_this._identifier);
|
|
144610
|
-
_this._feeDefaults = {
|
|
144980
|
+
function PolkadotProtocol(options) {
|
|
144981
|
+
if (options === void 0) { options = new PolkadotProtocolOptions_1.PolkadotProtocolOptions(); }
|
|
144982
|
+
var _this = _super.call(this, options) || this;
|
|
144983
|
+
_this.options = options;
|
|
144984
|
+
_this.symbol = 'DOT';
|
|
144985
|
+
_this.name = 'Polkadot';
|
|
144986
|
+
_this.marketSymbol = 'DOT';
|
|
144987
|
+
_this.feeSymbol = 'DOT';
|
|
144988
|
+
_this.decimals = 10;
|
|
144989
|
+
_this.feeDecimals = 10;
|
|
144990
|
+
_this.identifier = ProtocolSymbols_1.MainProtocolSymbols.POLKADOT;
|
|
144991
|
+
_this.feeDefaults = {
|
|
144611
144992
|
low: '0.01',
|
|
144612
144993
|
medium: '0.01',
|
|
144613
144994
|
high: '0.01'
|
|
144614
144995
|
};
|
|
144615
|
-
_this.
|
|
144616
|
-
_this._units = [
|
|
144996
|
+
_this.units = [
|
|
144617
144997
|
{
|
|
144618
144998
|
unitSymbol: 'DOT',
|
|
144619
144999
|
factor: '1'
|
|
@@ -144635,15 +145015,10 @@ var PolkadotProtocol = /** @class */ (function (_super) {
|
|
|
144635
145015
|
factor: '0.0000000001'
|
|
144636
145016
|
}
|
|
144637
145017
|
];
|
|
144638
|
-
_this.
|
|
144639
|
-
_this.
|
|
144640
|
-
_this.
|
|
144641
|
-
_this.
|
|
144642
|
-
_this.addressIsCaseSensitive = Promise.resolve(_this._addressIsCaseSensitive);
|
|
144643
|
-
_this._addressValidationPattern = '^1[a-km-zA-HJ-NP-Z1-9]+$';
|
|
144644
|
-
_this.addressValidationPattern = Promise.resolve(_this._addressValidationPattern);
|
|
144645
|
-
_this._addressPlaceholder = "1ABC...";
|
|
144646
|
-
_this.addressPlaceholder = Promise.resolve(_this._addressPlaceholder);
|
|
145018
|
+
_this.standardDerivationPath = "m/44'/354'/0'/0/0";
|
|
145019
|
+
_this.addressIsCaseSensitive = true;
|
|
145020
|
+
_this.addressValidationPattern = '^1[a-km-zA-HJ-NP-Z1-9]+$';
|
|
145021
|
+
_this.addressPlaceholder = "1ABC...";
|
|
144647
145022
|
_this.defaultValidator = '12C9U6zSSoZ6pgwR2ksFyBLgQH6v7dkqqPCRyHceoP8MJRo2';
|
|
144648
145023
|
return _this;
|
|
144649
145024
|
}
|
|
@@ -145176,49 +145551,34 @@ var TezosNetwork;
|
|
|
145176
145551
|
})(TezosNetwork = exports.TezosNetwork || (exports.TezosNetwork = {}));
|
|
145177
145552
|
var TezosProtocol = /** @class */ (function (_super) {
|
|
145178
145553
|
__extends(TezosProtocol, _super);
|
|
145179
|
-
function TezosProtocol(
|
|
145180
|
-
if (
|
|
145554
|
+
function TezosProtocol(options) {
|
|
145555
|
+
if (options === void 0) { options = new TezosProtocolOptions_1.TezosProtocolOptions(); }
|
|
145181
145556
|
var _this = _super.call(this) || this;
|
|
145182
|
-
_this.
|
|
145183
|
-
_this.
|
|
145184
|
-
_this.
|
|
145185
|
-
_this.
|
|
145186
|
-
_this.
|
|
145187
|
-
_this.
|
|
145188
|
-
_this.
|
|
145189
|
-
_this.
|
|
145190
|
-
_this.feeSymbol = Promise.resolve(_this._feeSymbol);
|
|
145191
|
-
_this._decimals = 6;
|
|
145192
|
-
_this.decimals = Promise.resolve(_this._decimals);
|
|
145193
|
-
_this._feeDecimals = 6; // micro tez is the smallest, 1000000 microtez is 1 tez
|
|
145194
|
-
_this.feeDecimals = Promise.resolve(_this._feeDecimals);
|
|
145195
|
-
_this._identifier = ProtocolSymbols_1.MainProtocolSymbols.XTZ;
|
|
145196
|
-
_this.identifier = Promise.resolve(_this._identifier);
|
|
145557
|
+
_this.options = options;
|
|
145558
|
+
_this.symbol = 'XTZ';
|
|
145559
|
+
_this.name = 'Tezos';
|
|
145560
|
+
_this.marketSymbol = 'xtz';
|
|
145561
|
+
_this.feeSymbol = 'xtz';
|
|
145562
|
+
_this.decimals = 6;
|
|
145563
|
+
_this.feeDecimals = 6; // micro tez is the smallest, 1000000 microtez is 1 tez
|
|
145564
|
+
_this.identifier = ProtocolSymbols_1.MainProtocolSymbols.XTZ;
|
|
145197
145565
|
// tezbox default
|
|
145198
|
-
_this.
|
|
145566
|
+
_this.feeDefaults = {
|
|
145199
145567
|
low: '0.001420',
|
|
145200
145568
|
medium: '0.001520',
|
|
145201
145569
|
high: '0.003000'
|
|
145202
145570
|
};
|
|
145203
|
-
_this.
|
|
145204
|
-
_this._units = [
|
|
145571
|
+
_this.units = [
|
|
145205
145572
|
{
|
|
145206
145573
|
unitSymbol: 'XTZ',
|
|
145207
145574
|
factor: '1'
|
|
145208
145575
|
}
|
|
145209
145576
|
];
|
|
145210
|
-
_this.
|
|
145211
|
-
_this.
|
|
145212
|
-
_this.
|
|
145213
|
-
_this.
|
|
145214
|
-
_this.
|
|
145215
|
-
_this._addressIsCaseSensitive = true;
|
|
145216
|
-
_this.addressIsCaseSensitive = Promise.resolve(_this._addressIsCaseSensitive);
|
|
145217
|
-
_this._addressValidationPattern = '^((tz1|tz2|tz3|KT1)[1-9A-Za-z]{33}|zet1[1-9A-Za-z]{65})$';
|
|
145218
|
-
_this.addressValidationPattern = Promise.resolve(_this._addressValidationPattern);
|
|
145219
|
-
_this._addressPlaceholder = 'tz1...';
|
|
145220
|
-
_this.addressPlaceholder = Promise.resolve(_this._addressPlaceholder);
|
|
145221
|
-
_this.options = Promise.resolve(_this._options);
|
|
145577
|
+
_this.supportsHD = false;
|
|
145578
|
+
_this.standardDerivationPath = "m/44h/1729h/0h/0h";
|
|
145579
|
+
_this.addressIsCaseSensitive = true;
|
|
145580
|
+
_this.addressValidationPattern = '^((tz1|tz2|tz3|KT1)[1-9A-Za-z]{33}|zet1[1-9A-Za-z]{65})$';
|
|
145581
|
+
_this.addressPlaceholder = 'tz1...';
|
|
145222
145582
|
// https://gitlab.com/tezos/tezos/-/blob/master/docs/whitedoc/proof_of_stake.rst
|
|
145223
145583
|
// cycle has 4096 blocks, which are at least one minute apart
|
|
145224
145584
|
_this.minCycleDuration = 4096 * 60 * 1000; // ms
|
|
@@ -145234,22 +145594,127 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
145234
145594
|
Object.defineProperty(TezosProtocol.prototype, "jsonRPCAPI", {
|
|
145235
145595
|
// TODO: Should we remove these getters and replace the calls to `this._options.network...`?
|
|
145236
145596
|
get: function () {
|
|
145237
|
-
return this.
|
|
145597
|
+
return this.options.network.rpcUrl;
|
|
145238
145598
|
},
|
|
145239
145599
|
enumerable: false,
|
|
145240
145600
|
configurable: true
|
|
145241
145601
|
});
|
|
145602
|
+
TezosProtocol.prototype.getSymbol = function () {
|
|
145603
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
145604
|
+
return __generator(this, function (_a) {
|
|
145605
|
+
return [2 /*return*/, this.symbol];
|
|
145606
|
+
});
|
|
145607
|
+
});
|
|
145608
|
+
};
|
|
145609
|
+
TezosProtocol.prototype.getName = function () {
|
|
145610
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
145611
|
+
return __generator(this, function (_a) {
|
|
145612
|
+
return [2 /*return*/, this.name];
|
|
145613
|
+
});
|
|
145614
|
+
});
|
|
145615
|
+
};
|
|
145616
|
+
TezosProtocol.prototype.getMarketSymbol = function () {
|
|
145617
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
145618
|
+
return __generator(this, function (_a) {
|
|
145619
|
+
return [2 /*return*/, this.marketSymbol];
|
|
145620
|
+
});
|
|
145621
|
+
});
|
|
145622
|
+
};
|
|
145623
|
+
TezosProtocol.prototype.getFeeSymbol = function () {
|
|
145624
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
145625
|
+
return __generator(this, function (_a) {
|
|
145626
|
+
return [2 /*return*/, this.feeSymbol];
|
|
145627
|
+
});
|
|
145628
|
+
});
|
|
145629
|
+
};
|
|
145630
|
+
TezosProtocol.prototype.getDecimals = function () {
|
|
145631
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
145632
|
+
return __generator(this, function (_a) {
|
|
145633
|
+
return [2 /*return*/, this.decimals];
|
|
145634
|
+
});
|
|
145635
|
+
});
|
|
145636
|
+
};
|
|
145637
|
+
TezosProtocol.prototype.getFeeDecimals = function () {
|
|
145638
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
145639
|
+
return __generator(this, function (_a) {
|
|
145640
|
+
return [2 /*return*/, this.feeDecimals];
|
|
145641
|
+
});
|
|
145642
|
+
});
|
|
145643
|
+
};
|
|
145644
|
+
TezosProtocol.prototype.getIdentifier = function () {
|
|
145645
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
145646
|
+
return __generator(this, function (_a) {
|
|
145647
|
+
return [2 /*return*/, this.identifier];
|
|
145648
|
+
});
|
|
145649
|
+
});
|
|
145650
|
+
};
|
|
145651
|
+
TezosProtocol.prototype.getFeeDefaults = function () {
|
|
145652
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
145653
|
+
return __generator(this, function (_a) {
|
|
145654
|
+
return [2 /*return*/, this.feeDefaults];
|
|
145655
|
+
});
|
|
145656
|
+
});
|
|
145657
|
+
};
|
|
145658
|
+
TezosProtocol.prototype.getUnits = function () {
|
|
145659
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
145660
|
+
return __generator(this, function (_a) {
|
|
145661
|
+
return [2 /*return*/, this.units];
|
|
145662
|
+
});
|
|
145663
|
+
});
|
|
145664
|
+
};
|
|
145665
|
+
TezosProtocol.prototype.getSupportsHD = function () {
|
|
145666
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
145667
|
+
return __generator(this, function (_a) {
|
|
145668
|
+
return [2 /*return*/, this.supportsHD];
|
|
145669
|
+
});
|
|
145670
|
+
});
|
|
145671
|
+
};
|
|
145672
|
+
TezosProtocol.prototype.getStandardDerivationPath = function () {
|
|
145673
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
145674
|
+
return __generator(this, function (_a) {
|
|
145675
|
+
return [2 /*return*/, this.standardDerivationPath];
|
|
145676
|
+
});
|
|
145677
|
+
});
|
|
145678
|
+
};
|
|
145679
|
+
TezosProtocol.prototype.getAddressIsCaseSensitive = function () {
|
|
145680
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
145681
|
+
return __generator(this, function (_a) {
|
|
145682
|
+
return [2 /*return*/, this.addressIsCaseSensitive];
|
|
145683
|
+
});
|
|
145684
|
+
});
|
|
145685
|
+
};
|
|
145686
|
+
TezosProtocol.prototype.getAddressValidationPattern = function () {
|
|
145687
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
145688
|
+
return __generator(this, function (_a) {
|
|
145689
|
+
return [2 /*return*/, this.addressValidationPattern];
|
|
145690
|
+
});
|
|
145691
|
+
});
|
|
145692
|
+
};
|
|
145693
|
+
TezosProtocol.prototype.getAddressPlaceholder = function () {
|
|
145694
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
145695
|
+
return __generator(this, function (_a) {
|
|
145696
|
+
return [2 /*return*/, this.addressPlaceholder];
|
|
145697
|
+
});
|
|
145698
|
+
});
|
|
145699
|
+
};
|
|
145700
|
+
TezosProtocol.prototype.getOptions = function () {
|
|
145701
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
145702
|
+
return __generator(this, function (_a) {
|
|
145703
|
+
return [2 /*return*/, this.options];
|
|
145704
|
+
});
|
|
145705
|
+
});
|
|
145706
|
+
};
|
|
145242
145707
|
TezosProtocol.prototype.getBlockExplorerLinkForAddress = function (address) {
|
|
145243
145708
|
return __awaiter(this, void 0, void 0, function () {
|
|
145244
145709
|
return __generator(this, function (_a) {
|
|
145245
|
-
return [2 /*return*/, this.
|
|
145710
|
+
return [2 /*return*/, this.options.network.blockExplorer.getAddressLink(address)];
|
|
145246
145711
|
});
|
|
145247
145712
|
});
|
|
145248
145713
|
};
|
|
145249
145714
|
TezosProtocol.prototype.getBlockExplorerLinkForTxId = function (txId) {
|
|
145250
145715
|
return __awaiter(this, void 0, void 0, function () {
|
|
145251
145716
|
return __generator(this, function (_a) {
|
|
145252
|
-
return [2 /*return*/, this.
|
|
145717
|
+
return [2 /*return*/, this.options.network.blockExplorer.getTransactionLink(txId)];
|
|
145253
145718
|
});
|
|
145254
145719
|
});
|
|
145255
145720
|
};
|
|
@@ -145354,11 +145819,11 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
145354
145819
|
switch (_b.label) {
|
|
145355
145820
|
case 0:
|
|
145356
145821
|
address = addresses[0];
|
|
145357
|
-
return [4 /*yield*/, this.
|
|
145822
|
+
return [4 /*yield*/, this.options.network.extras.indexerClient.getTransactions(address, limit, cursor === null || cursor === void 0 ? void 0 : cursor.offset)];
|
|
145358
145823
|
case 1:
|
|
145359
145824
|
results = _b.sent();
|
|
145360
145825
|
return [2 /*return*/, {
|
|
145361
|
-
transactions: results.map(function (transaction) { return (__assign(__assign({}, transaction), { protocolIdentifier: _this.
|
|
145826
|
+
transactions: results.map(function (transaction) { return (__assign(__assign({}, transaction), { protocolIdentifier: _this.identifier, network: _this.options.network })); }),
|
|
145362
145827
|
cursor: { offset: ((_a = cursor === null || cursor === void 0 ? void 0 : cursor.offset) !== null && _a !== void 0 ? _a : 0) + results.length }
|
|
145363
145828
|
}];
|
|
145364
145829
|
}
|
|
@@ -145485,7 +145950,7 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
145485
145950
|
assertNever(tezosOperation.kind);
|
|
145486
145951
|
throw new index_4.NotFoundError(coinlib_error_1.Domain.TEZOS, 'no operation to unforge found');
|
|
145487
145952
|
case 8: return [2 /*return*/, partialTxs.map(function (partialTx) {
|
|
145488
|
-
return __assign({ amount: '0', fee: operation !== undefined ? new bignumber_1.default(operation.fee).toString(10) : '0', from: [], isInbound: false, protocolIdentifier: _this.
|
|
145953
|
+
return __assign({ amount: '0', fee: operation !== undefined ? new bignumber_1.default(operation.fee).toString(10) : '0', from: [], isInbound: false, protocolIdentifier: _this.identifier, network: _this.options.network, to: [], transactionDetails: tezosOperation }, partialTx);
|
|
145489
145954
|
})];
|
|
145490
145955
|
}
|
|
145491
145956
|
});
|
|
@@ -145510,7 +145975,7 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
145510
145975
|
_a.label = 2;
|
|
145511
145976
|
case 2:
|
|
145512
145977
|
_a.trys.push([2, 4, , 5]);
|
|
145513
|
-
return [4 /*yield*/, index_1.default.get(this.
|
|
145978
|
+
return [4 /*yield*/, index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address + "/balance")];
|
|
145514
145979
|
case 3:
|
|
145515
145980
|
data = (_a.sent()).data;
|
|
145516
145981
|
balance = balance.plus(new bignumber_1.default(data));
|
|
@@ -145587,7 +146052,7 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
145587
146052
|
return [4 /*yield*/, this.estimateFeeDefaultsFromPublicKey(publicKey, recipients, [balance.toFixed()])];
|
|
145588
146053
|
case 2:
|
|
145589
146054
|
estimatedFeeDefaults = _a.sent();
|
|
145590
|
-
maxFee = new bignumber_1.default(estimatedFeeDefaults.medium).shiftedBy(this.
|
|
146055
|
+
maxFee = new bignumber_1.default(estimatedFeeDefaults.medium).shiftedBy(this.decimals);
|
|
145591
146056
|
if (maxFee.gte(balance)) {
|
|
145592
146057
|
maxFee = new bignumber_1.default(0);
|
|
145593
146058
|
}
|
|
@@ -145664,9 +146129,9 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
145664
146129
|
mediumFee = lowFee.plus(lowFee.times(feeStepFactor).integerValue(bignumber_1.default.ROUND_FLOOR));
|
|
145665
146130
|
highFee = mediumFee.plus(mediumFee.times(feeStepFactor).integerValue(bignumber_1.default.ROUND_FLOOR));
|
|
145666
146131
|
return [2 /*return*/, {
|
|
145667
|
-
low: lowFee.shiftedBy(-this.
|
|
145668
|
-
medium: mediumFee.shiftedBy(-this.
|
|
145669
|
-
high: highFee.shiftedBy(-this.
|
|
146132
|
+
low: lowFee.shiftedBy(-this.feeDecimals).toFixed(),
|
|
146133
|
+
medium: mediumFee.shiftedBy(-this.feeDecimals).toFixed(),
|
|
146134
|
+
high: highFee.shiftedBy(-this.feeDecimals).toFixed()
|
|
145670
146135
|
}];
|
|
145671
146136
|
}
|
|
145672
146137
|
});
|
|
@@ -145722,9 +146187,9 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
145722
146187
|
}
|
|
145723
146188
|
address = addresses[addressIndex];
|
|
145724
146189
|
return [4 /*yield*/, Promise.all([
|
|
145725
|
-
index_1.default.get(this.
|
|
145726
|
-
index_1.default.get(this.
|
|
145727
|
-
index_1.default.get(this.
|
|
146190
|
+
index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address + "/counter"),
|
|
146191
|
+
index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head~2/hash"),
|
|
146192
|
+
index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address + "/manager_key")
|
|
145728
146193
|
]).catch(function (error) {
|
|
145729
146194
|
throw new index_4.NetworkError(coinlib_error_1.Domain.TEZOS, error);
|
|
145730
146195
|
})];
|
|
@@ -145878,7 +146343,7 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
145878
146343
|
var activeBakers;
|
|
145879
146344
|
return __generator(this, function (_a) {
|
|
145880
146345
|
switch (_a.label) {
|
|
145881
|
-
case 0: return [4 /*yield*/, index_1.default.get(this.
|
|
146346
|
+
case 0: return [4 /*yield*/, index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/delegates?active")];
|
|
145882
146347
|
case 1:
|
|
145883
146348
|
activeBakers = (_a.sent()).data;
|
|
145884
146349
|
return [2 /*return*/, activeBakers[0] || ''];
|
|
@@ -145904,7 +146369,7 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
145904
146369
|
var data;
|
|
145905
146370
|
return __generator(this, function (_a) {
|
|
145906
146371
|
switch (_a.label) {
|
|
145907
|
-
case 0: return [4 /*yield*/, index_1.default.get(this.
|
|
146372
|
+
case 0: return [4 /*yield*/, index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address)];
|
|
145908
146373
|
case 1:
|
|
145909
146374
|
data = (_a.sent()).data;
|
|
145910
146375
|
return [2 /*return*/, data.delegate ? [data.delegate] : []];
|
|
@@ -145917,7 +146382,7 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
145917
146382
|
var response, isBakingActive;
|
|
145918
146383
|
return __generator(this, function (_a) {
|
|
145919
146384
|
switch (_a.label) {
|
|
145920
|
-
case 0: return [4 /*yield*/, index_1.default.get(this.
|
|
146385
|
+
case 0: return [4 /*yield*/, index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/delegates/" + address + "/deactivated")];
|
|
145921
146386
|
case 1:
|
|
145922
146387
|
response = _a.sent();
|
|
145923
146388
|
isBakingActive = !response.data;
|
|
@@ -145947,7 +146412,7 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
145947
146412
|
var data;
|
|
145948
146413
|
return __generator(this, function (_a) {
|
|
145949
146414
|
switch (_a.label) {
|
|
145950
|
-
case 0: return [4 /*yield*/, index_1.default.get(this.
|
|
146415
|
+
case 0: return [4 /*yield*/, index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address)];
|
|
145951
146416
|
case 1:
|
|
145952
146417
|
data = (_a.sent()).data;
|
|
145953
146418
|
return [2 /*return*/, !!data.delegate];
|
|
@@ -146017,7 +146482,7 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
146017
146482
|
return __generator(this, function (_a) {
|
|
146018
146483
|
switch (_a.label) {
|
|
146019
146484
|
case 0: return [4 /*yield*/, Promise.all([
|
|
146020
|
-
index_1.default.get(this.
|
|
146485
|
+
index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address)
|
|
146021
146486
|
// this.getDelegationRewardsForAddress(address).catch(() => [] as DelegationRewardInfo[])
|
|
146022
146487
|
])];
|
|
146023
146488
|
case 1:
|
|
@@ -146102,9 +146567,9 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
146102
146567
|
case 1:
|
|
146103
146568
|
address = _f.sent();
|
|
146104
146569
|
return [4 /*yield*/, Promise.all([
|
|
146105
|
-
index_1.default.get(this.
|
|
146106
|
-
index_1.default.get(this.
|
|
146107
|
-
index_1.default.get(this.
|
|
146570
|
+
index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address + "/counter"),
|
|
146571
|
+
index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head~2/hash"),
|
|
146572
|
+
index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + address + "/manager_key")
|
|
146108
146573
|
]).catch(function (error) {
|
|
146109
146574
|
throw new index_4.NetworkError(coinlib_error_1.Domain.TEZOS, error);
|
|
146110
146575
|
})];
|
|
@@ -146252,7 +146717,7 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
146252
146717
|
var counter = startingCounter ? startingCounter.plus(i).toString() : op.counter;
|
|
146253
146718
|
return __assign(__assign({}, operation), { gas_limit: gas_limit, counter: counter });
|
|
146254
146719
|
});
|
|
146255
|
-
return [4 /*yield*/, index_1.default.get(this.
|
|
146720
|
+
return [4 /*yield*/, index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head")];
|
|
146256
146721
|
case 1:
|
|
146257
146722
|
block = (_a.sent()).data;
|
|
146258
146723
|
body = {
|
|
@@ -146268,7 +146733,7 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
146268
146733
|
forgedOperation = _a.sent();
|
|
146269
146734
|
gasLimitTotal = 0;
|
|
146270
146735
|
return [4 /*yield*/, index_1.default
|
|
146271
|
-
.post(this.
|
|
146736
|
+
.post(this.options.network.rpcUrl + "/chains/main/blocks/head/helpers/scripts/run_operation", body, {
|
|
146272
146737
|
headers: { 'Content-Type': 'application/json' }
|
|
146273
146738
|
})
|
|
146274
146739
|
.catch(function (runOperationError) {
|
|
@@ -146358,11 +146823,11 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
146358
146823
|
var data, delegatedOpLevel, delegatedDate, recentTransactionData;
|
|
146359
146824
|
return __generator(this, function (_a) {
|
|
146360
146825
|
switch (_a.label) {
|
|
146361
|
-
case 0: return [4 /*yield*/, index_1.default.get(this.
|
|
146826
|
+
case 0: return [4 /*yield*/, index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + delegatedAddress)];
|
|
146362
146827
|
case 1:
|
|
146363
146828
|
data = (_a.sent()).data;
|
|
146364
146829
|
if (!(data.delegate && fetchExtraInfo)) return [3 /*break*/, 3];
|
|
146365
|
-
return [4 /*yield*/, this.
|
|
146830
|
+
return [4 /*yield*/, this.options.network.extras.indexerClient.getDelegationInfo(delegatedAddress)];
|
|
146366
146831
|
case 2:
|
|
146367
146832
|
recentTransactionData = _a.sent();
|
|
146368
146833
|
if (recentTransactionData) {
|
|
@@ -146393,13 +146858,13 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
146393
146858
|
}
|
|
146394
146859
|
return [4 /*yield*/, Promise.all([
|
|
146395
146860
|
index_1.default
|
|
146396
|
-
.get(this.
|
|
146861
|
+
.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/delegates/" + tzAddress + "/balance")
|
|
146397
146862
|
.catch(function (_error) { return undefined; }),
|
|
146398
146863
|
index_1.default
|
|
146399
|
-
.get(this.
|
|
146864
|
+
.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/delegates/" + tzAddress + "/full_balance")
|
|
146400
146865
|
.catch(function (_error) { return undefined; }),
|
|
146401
|
-
index_1.default.get(this.
|
|
146402
|
-
index_1.default.get(this.
|
|
146866
|
+
index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/delegates/" + tzAddress + "/delegated_balance"),
|
|
146867
|
+
index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/delegates/" + tzAddress + "/staking_balance")
|
|
146403
146868
|
]).catch(function (error) {
|
|
146404
146869
|
throw new index_4.NetworkError(coinlib_error_1.Domain.TEZOS, error);
|
|
146405
146870
|
})];
|
|
@@ -146501,9 +146966,9 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
146501
146966
|
case 1:
|
|
146502
146967
|
tzAddress = _d.sent();
|
|
146503
146968
|
return [4 /*yield*/, Promise.all([
|
|
146504
|
-
index_1.default.get(this.
|
|
146505
|
-
index_1.default.get(this.
|
|
146506
|
-
index_1.default.get(this.
|
|
146969
|
+
index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + tzAddress + "/counter"),
|
|
146970
|
+
index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head~2/hash"),
|
|
146971
|
+
index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/head/context/contracts/" + tzAddress + "/manager_key")
|
|
146507
146972
|
]).catch(function (error) {
|
|
146508
146973
|
throw new index_4.NetworkError(coinlib_error_1.Domain.TEZOS, error);
|
|
146509
146974
|
})];
|
|
@@ -146603,7 +147068,7 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
146603
147068
|
case 0:
|
|
146604
147069
|
payload = rawTransaction;
|
|
146605
147070
|
return [4 /*yield*/, index_1.default
|
|
146606
|
-
.post(this.
|
|
147071
|
+
.post(this.options.network.rpcUrl + "/injection/operation?chain=main", JSON.stringify(payload), {
|
|
146607
147072
|
headers: { 'content-type': 'application/json' }
|
|
146608
147073
|
})
|
|
146609
147074
|
.catch(function (error) {
|
|
@@ -146676,7 +147141,7 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
146676
147141
|
var response;
|
|
146677
147142
|
return __generator(this, function (_a) {
|
|
146678
147143
|
switch (_a.label) {
|
|
146679
|
-
case 0: return [4 /*yield*/, index_1.default.get(this.
|
|
147144
|
+
case 0: return [4 /*yield*/, index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/" + blockHash + "/votes/listings")];
|
|
146680
147145
|
case 1:
|
|
146681
147146
|
response = _a.sent();
|
|
146682
147147
|
return [2 /*return*/, response.data];
|
|
@@ -146701,9 +147166,9 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
146701
147166
|
TezosProtocol.prototype.timeIntervalBetweenCycles = function (fromCycle, toCycle) {
|
|
146702
147167
|
var cycle1 = Math.min(fromCycle, toCycle);
|
|
146703
147168
|
var cycle2 = Math.max(fromCycle, toCycle);
|
|
146704
|
-
var timeBetweenBlocks = TezosProtocol.TIME_BETWEEN_BLOCKS[this.
|
|
146705
|
-
var blocksPerCycle = TezosProtocol.BLOCKS_PER_CYCLE[this.
|
|
146706
|
-
if (this.
|
|
147169
|
+
var timeBetweenBlocks = TezosProtocol.TIME_BETWEEN_BLOCKS[this.options.network.extras.network];
|
|
147170
|
+
var blocksPerCycle = TezosProtocol.BLOCKS_PER_CYCLE[this.options.network.extras.network];
|
|
147171
|
+
if (this.options.network.extras.network === TezosNetwork.MAINNET && cycle2 > TezosProtocol.FIRST_010_CYCLE) {
|
|
146707
147172
|
if (cycle1 < TezosProtocol.FIRST_010_CYCLE) {
|
|
146708
147173
|
return (((TezosProtocol.FIRST_010_CYCLE - cycle1) * blocksPerCycle[0] * timeBetweenBlocks[0] +
|
|
146709
147174
|
(cycle2 - TezosProtocol.FIRST_010_CYCLE) * blocksPerCycle[1] * timeBetweenBlocks[1]) *
|
|
@@ -146714,15 +147179,15 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
146714
147179
|
return (cycle2 - cycle1) * blocksPerCycle[0] * timeBetweenBlocks[0] * 1000;
|
|
146715
147180
|
};
|
|
146716
147181
|
TezosProtocol.prototype.cycleToBlockLevel = function (cycle) {
|
|
146717
|
-
var blocksPerCycle = TezosProtocol.BLOCKS_PER_CYCLE[this.
|
|
146718
|
-
if (this.
|
|
147182
|
+
var blocksPerCycle = TezosProtocol.BLOCKS_PER_CYCLE[this.options.network.extras.network];
|
|
147183
|
+
if (this.options.network.extras.network === TezosNetwork.MAINNET && cycle > TezosProtocol.FIRST_010_CYCLE) {
|
|
146719
147184
|
return TezosProtocol.FIRST_010_CYCLE * blocksPerCycle[0] + (cycle - TezosProtocol.FIRST_010_CYCLE) * blocksPerCycle[1] + 1;
|
|
146720
147185
|
}
|
|
146721
147186
|
return cycle * blocksPerCycle[0] + 1;
|
|
146722
147187
|
};
|
|
146723
147188
|
TezosProtocol.prototype.blockLevelToCycle = function (blockLevel) {
|
|
146724
|
-
var blocksPerCycle = TezosProtocol.BLOCKS_PER_CYCLE[this.
|
|
146725
|
-
if (this.
|
|
147189
|
+
var blocksPerCycle = TezosProtocol.BLOCKS_PER_CYCLE[this.options.network.extras.network];
|
|
147190
|
+
if (this.options.network.extras.network === TezosNetwork.MAINNET) {
|
|
146726
147191
|
var last009BlockLevel = TezosProtocol.FIRST_010_CYCLE * blocksPerCycle[0];
|
|
146727
147192
|
if (blockLevel > last009BlockLevel) {
|
|
146728
147193
|
var deltaLevels = blockLevel - last009BlockLevel;
|
|
@@ -146744,7 +147209,7 @@ var TezosProtocol = /** @class */ (function (_super) {
|
|
|
146744
147209
|
var result;
|
|
146745
147210
|
return __generator(this, function (_a) {
|
|
146746
147211
|
switch (_a.label) {
|
|
146747
|
-
case 0: return [4 /*yield*/, index_1.default.get(this.
|
|
147212
|
+
case 0: return [4 /*yield*/, index_1.default.get(this.options.network.rpcUrl + "/chains/main/blocks/" + block + "/metadata")];
|
|
146748
147213
|
case 1:
|
|
146749
147214
|
result = _a.sent();
|
|
146750
147215
|
return [2 /*return*/, result.data];
|
|
@@ -148769,7 +149234,7 @@ var TezosFA1Protocol = /** @class */ (function (_super) {
|
|
|
148769
149234
|
if (recipients.length !== values.length) {
|
|
148770
149235
|
throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.TEZOSFA, 'length of recipients and values does not match!');
|
|
148771
149236
|
}
|
|
148772
|
-
return [4 /*yield*/, this.createTransferCalls(publicKey, recipients, values, this.
|
|
149237
|
+
return [4 /*yield*/, this.createTransferCalls(publicKey, recipients, values, this.feeDefaults.medium, data)];
|
|
148773
149238
|
case 1:
|
|
148774
149239
|
transferCalls = _a.sent();
|
|
148775
149240
|
operations = transferCalls.map(function (transferCall) {
|
|
@@ -148943,7 +149408,7 @@ var TezosFA1Protocol = /** @class */ (function (_super) {
|
|
|
148943
149408
|
};
|
|
148944
149409
|
TezosFA1Protocol.prototype.callbackContract = function () {
|
|
148945
149410
|
var _a;
|
|
148946
|
-
return (_a = this.defaultCallbackContractMap[this.
|
|
149411
|
+
return (_a = this.defaultCallbackContractMap[this.options.network.extras.network]) !== null && _a !== void 0 ? _a : '';
|
|
148947
149412
|
};
|
|
148948
149413
|
TezosFA1Protocol.prototype.isTransferRequest = function (obj) {
|
|
148949
149414
|
var anyObj = obj;
|
|
@@ -149160,12 +149625,11 @@ var TezosFA2ContractEntrypoint;
|
|
|
149160
149625
|
})(TezosFA2ContractEntrypoint || (TezosFA2ContractEntrypoint = {}));
|
|
149161
149626
|
var TezosFA2Protocol = /** @class */ (function (_super) {
|
|
149162
149627
|
__extends(TezosFA2Protocol, _super);
|
|
149163
|
-
function TezosFA2Protocol(
|
|
149628
|
+
function TezosFA2Protocol(options) {
|
|
149164
149629
|
var _a, _b, _c;
|
|
149165
|
-
var _this = _super.call(this,
|
|
149166
|
-
_this.
|
|
149167
|
-
_this.
|
|
149168
|
-
_this.tokenID = _options.config.defaultTokenID;
|
|
149630
|
+
var _this = _super.call(this, options) || this;
|
|
149631
|
+
_this.options = options;
|
|
149632
|
+
_this.tokenID = options.config.defaultTokenID;
|
|
149169
149633
|
_this.defaultCallbackContract = (_a = {},
|
|
149170
149634
|
_a[TezosProtocol_1.TezosNetwork.MAINNET] = (_b = {},
|
|
149171
149635
|
_b[TezosFA2ContractEntrypoint.BALANCE] = 'KT1LyHDYnML5eCuTEVCTynUpivwG6ns6khiG',
|
|
@@ -149176,6 +149640,13 @@ var TezosFA2Protocol = /** @class */ (function (_super) {
|
|
|
149176
149640
|
_a);
|
|
149177
149641
|
return _this;
|
|
149178
149642
|
}
|
|
149643
|
+
TezosFA2Protocol.prototype.getOptions = function () {
|
|
149644
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
149645
|
+
return __generator(this, function (_a) {
|
|
149646
|
+
return [2 /*return*/, this.options];
|
|
149647
|
+
});
|
|
149648
|
+
});
|
|
149649
|
+
};
|
|
149179
149650
|
TezosFA2Protocol.prototype.getBalanceOfPublicKey = function (publicKey, data) {
|
|
149180
149651
|
return __awaiter(this, void 0, void 0, function () {
|
|
149181
149652
|
var address;
|
|
@@ -149226,7 +149697,7 @@ var TezosFA2Protocol = /** @class */ (function (_super) {
|
|
|
149226
149697
|
if (recipients.length !== values.length) {
|
|
149227
149698
|
throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.TEZOS, 'length of recipients and values does not match!');
|
|
149228
149699
|
}
|
|
149229
|
-
return [4 /*yield*/, this.createTransferCall(publicKey, recipients, values, this.
|
|
149700
|
+
return [4 /*yield*/, this.createTransferCall(publicKey, recipients, values, this.feeDefaults.medium, data)];
|
|
149230
149701
|
case 1:
|
|
149231
149702
|
transferCall = _a.sent();
|
|
149232
149703
|
operation = {
|
|
@@ -149431,7 +149902,7 @@ var TezosFA2Protocol = /** @class */ (function (_super) {
|
|
|
149431
149902
|
case 0: return [4 /*yield*/, this.contract.getBigMaps()];
|
|
149432
149903
|
case 1:
|
|
149433
149904
|
bigMaps = _b.sent();
|
|
149434
|
-
bigMapIndex = this.
|
|
149905
|
+
bigMapIndex = this.options.config.totalSupplyBigMapID;
|
|
149435
149906
|
bigMap = undefined;
|
|
149436
149907
|
if (bigMapIndex !== undefined) {
|
|
149437
149908
|
bigMap = bigMaps.find(function (bigMap) { return bigMap.id === bigMapIndex; });
|
|
@@ -149498,7 +149969,7 @@ var TezosFA2Protocol = /** @class */ (function (_super) {
|
|
|
149498
149969
|
});
|
|
149499
149970
|
};
|
|
149500
149971
|
TezosFA2Protocol.prototype.callbackContract = function (entrypoint) {
|
|
149501
|
-
var networkCallbacks = this.defaultCallbackContract[this.
|
|
149972
|
+
var networkCallbacks = this.defaultCallbackContract[this.options.network.extras.network];
|
|
149502
149973
|
var callback = networkCallbacks ? networkCallbacks[entrypoint] : undefined;
|
|
149503
149974
|
return callback !== null && callback !== void 0 ? callback : '';
|
|
149504
149975
|
};
|
|
@@ -149600,31 +150071,55 @@ var MARKET_SYMBOL_GENERIC_FA = 'xtz';
|
|
|
149600
150071
|
var DECIMALS_GENERIC_FA = NaN;
|
|
149601
150072
|
var TezosFAProtocol = /** @class */ (function (_super) {
|
|
149602
150073
|
__extends(TezosFAProtocol, _super);
|
|
149603
|
-
function TezosFAProtocol(
|
|
150074
|
+
function TezosFAProtocol(options) {
|
|
149604
150075
|
var _a, _b, _c, _d;
|
|
149605
|
-
var _this = _super.call(this,
|
|
149606
|
-
_this.
|
|
149607
|
-
_this.
|
|
149608
|
-
_this.
|
|
149609
|
-
_this._subProtocolType = ICoinSubProtocol_1.SubProtocolType.TOKEN;
|
|
149610
|
-
_this.subProtocolType = Promise.resolve(_this._subProtocolType);
|
|
150076
|
+
var _this = _super.call(this, options) || this;
|
|
150077
|
+
_this.options = options;
|
|
150078
|
+
_this.isSubProtocol = true;
|
|
150079
|
+
_this.subProtocolType = ICoinSubProtocol_1.SubProtocolType.TOKEN;
|
|
149611
150080
|
_this.defaultSourceAddress = 'tz1Mj7RzPmMAqDUNFBn5t5VbXmWW4cSUAdtT';
|
|
149612
150081
|
_this.remoteDataFactory = new TezosContractRemoteDataFactory_1.TezosContractRemoteDataFactory();
|
|
149613
|
-
_this.
|
|
149614
|
-
_this.
|
|
149615
|
-
_this.
|
|
149616
|
-
_this.
|
|
149617
|
-
_this.
|
|
149618
|
-
_this.
|
|
149619
|
-
|
|
149620
|
-
|
|
149621
|
-
|
|
149622
|
-
|
|
149623
|
-
|
|
149624
|
-
_this.tokenMetadataBigMapID = _options.config.tokenMetadataBigMapID;
|
|
149625
|
-
_this.contract = new TezosContract_1.TezosContract(_this._options.config.contractAddress, _this._options.network);
|
|
150082
|
+
_this.contractAddress = _this.options.config.contractAddress;
|
|
150083
|
+
_this.identifier = _this.options.config.identifier;
|
|
150084
|
+
_this.symbol = (_a = _this.options.config.symbol) !== null && _a !== void 0 ? _a : SYMBOL_GENERIC_FA;
|
|
150085
|
+
_this.name = (_b = _this.options.config.name) !== null && _b !== void 0 ? _b : NAME_GENERIC_FA;
|
|
150086
|
+
_this.marketSymbol = (_c = _this.options.config.marketSymbol) !== null && _c !== void 0 ? _c : MARKET_SYMBOL_GENERIC_FA;
|
|
150087
|
+
_this.decimals = (_d = _this.options.config.decimals) !== null && _d !== void 0 ? _d : DECIMALS_GENERIC_FA;
|
|
150088
|
+
if (_this.options.config.feeDefaults) {
|
|
150089
|
+
_this.feeDefaults = _this.options.config.feeDefaults;
|
|
150090
|
+
}
|
|
150091
|
+
_this.tokenMetadataBigMapID = options.config.tokenMetadataBigMapID;
|
|
150092
|
+
_this.contract = new TezosContract_1.TezosContract(_this.options.config.contractAddress, _this.options.network);
|
|
149626
150093
|
return _this;
|
|
149627
150094
|
}
|
|
150095
|
+
TezosFAProtocol.prototype.getIsSubProtocol = function () {
|
|
150096
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
150097
|
+
return __generator(this, function (_a) {
|
|
150098
|
+
return [2 /*return*/, this.isSubProtocol];
|
|
150099
|
+
});
|
|
150100
|
+
});
|
|
150101
|
+
};
|
|
150102
|
+
TezosFAProtocol.prototype.getSubProtocolType = function () {
|
|
150103
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
150104
|
+
return __generator(this, function (_a) {
|
|
150105
|
+
return [2 /*return*/, this.subProtocolType];
|
|
150106
|
+
});
|
|
150107
|
+
});
|
|
150108
|
+
};
|
|
150109
|
+
TezosFAProtocol.prototype.getContractAddress = function () {
|
|
150110
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
150111
|
+
return __generator(this, function (_a) {
|
|
150112
|
+
return [2 /*return*/, this.contractAddress];
|
|
150113
|
+
});
|
|
150114
|
+
});
|
|
150115
|
+
};
|
|
150116
|
+
TezosFAProtocol.prototype.getOptions = function () {
|
|
150117
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
150118
|
+
return __generator(this, function (_a) {
|
|
150119
|
+
return [2 /*return*/, this.options];
|
|
150120
|
+
});
|
|
150121
|
+
});
|
|
150122
|
+
};
|
|
149628
150123
|
TezosFAProtocol.prototype.bigMapValue = function (key, isKeyHash, bigMapID) {
|
|
149629
150124
|
if (isKeyHash === void 0) { isKeyHash = false; }
|
|
149630
150125
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -149687,7 +150182,7 @@ var TezosFAProtocol = /** @class */ (function (_super) {
|
|
|
149687
150182
|
case 1:
|
|
149688
150183
|
transactions = _b.sent();
|
|
149689
150184
|
return [2 /*return*/, {
|
|
149690
|
-
transactions: transactions.map(function (transaction) { return (__assign(__assign({}, transaction), { protocolIdentifier: _this.
|
|
150185
|
+
transactions: transactions.map(function (transaction) { return (__assign(__assign({}, transaction), { protocolIdentifier: _this.identifier, network: _this.options.network })); }),
|
|
149691
150186
|
cursor: {
|
|
149692
150187
|
offset: ((_a = cursor === null || cursor === void 0 ? void 0 : cursor.offset) !== null && _a !== void 0 ? _a : 0) + transactions.length
|
|
149693
150188
|
}
|
|
@@ -149707,7 +150202,7 @@ var TezosFAProtocol = /** @class */ (function (_super) {
|
|
|
149707
150202
|
case 1:
|
|
149708
150203
|
transactions = _b.sent();
|
|
149709
150204
|
return [2 /*return*/, {
|
|
149710
|
-
transactions: transactions.map(function (transaction) { return (__assign(__assign({}, transaction), { protocolIdentifier: _this.
|
|
150205
|
+
transactions: transactions.map(function (transaction) { return (__assign(__assign({}, transaction), { protocolIdentifier: _this.identifier, network: _this.options.network })); }),
|
|
149711
150206
|
cursor: {
|
|
149712
150207
|
offset: ((_a = cursor === null || cursor === void 0 ? void 0 : cursor.offset) !== null && _a !== void 0 ? _a : 0) + transactions.length
|
|
149713
150208
|
}
|
|
@@ -149896,7 +150391,7 @@ var TezosFAProtocol = /** @class */ (function (_super) {
|
|
|
149896
150391
|
counter = new bignumber_1.default(results[0].data).plus(1);
|
|
149897
150392
|
branch = results[1].data.hash;
|
|
149898
150393
|
chainID = results[1].data.chain_id;
|
|
149899
|
-
body = this.prepareMockContractCall(contractCall, chainID, branch, counter, source, this.
|
|
150394
|
+
body = this.prepareMockContractCall(contractCall, chainID, branch, counter, source, this.contractAddress);
|
|
149900
150395
|
_a.label = 2;
|
|
149901
150396
|
case 2:
|
|
149902
150397
|
_a.trys.push([2, 4, , 5]);
|
|
@@ -149928,20 +150423,14 @@ var TezosFAProtocol = /** @class */ (function (_super) {
|
|
|
149928
150423
|
return __generator(this, function (_a) {
|
|
149929
150424
|
switch (_a.label) {
|
|
149930
150425
|
case 0: return [4 /*yield*/, Promise.all(contractCalls.map(function (contractCall) { return __awaiter(_this, void 0, void 0, function () {
|
|
149931
|
-
|
|
149932
|
-
|
|
149933
|
-
|
|
149934
|
-
|
|
149935
|
-
|
|
149936
|
-
|
|
149937
|
-
|
|
149938
|
-
|
|
149939
|
-
};
|
|
149940
|
-
return [4 /*yield*/, this.contractAddress];
|
|
149941
|
-
case 1: return [2 /*return*/, (_a.destination = _b.sent(),
|
|
149942
|
-
_a.parameters = contractCall.toJSON(),
|
|
149943
|
-
_a)];
|
|
149944
|
-
}
|
|
150426
|
+
return __generator(this, function (_a) {
|
|
150427
|
+
return [2 /*return*/, {
|
|
150428
|
+
kind: TezosOperationType_1.TezosOperationType.TRANSACTION,
|
|
150429
|
+
fee: fee,
|
|
150430
|
+
amount: '0',
|
|
150431
|
+
destination: this.contractAddress,
|
|
150432
|
+
parameters: contractCall.toJSON()
|
|
150433
|
+
}];
|
|
149945
150434
|
});
|
|
149946
150435
|
}); }))];
|
|
149947
150436
|
case 1:
|
|
@@ -151350,15 +151839,34 @@ var TezosKtProtocol = /** @class */ (function (_super) {
|
|
|
151350
151839
|
__extends(TezosKtProtocol, _super);
|
|
151351
151840
|
function TezosKtProtocol() {
|
|
151352
151841
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
151353
|
-
_this.
|
|
151354
|
-
_this.
|
|
151355
|
-
_this.
|
|
151356
|
-
_this.
|
|
151357
|
-
_this._subProtocolType = ICoinSubProtocol_1.SubProtocolType.ACCOUNT;
|
|
151358
|
-
_this.subProtocolType = Promise.resolve(_this._subProtocolType);
|
|
151842
|
+
_this.identifier = ProtocolSymbols_1.SubProtocolSymbols.XTZ_KT;
|
|
151843
|
+
_this.isSubProtocol = true;
|
|
151844
|
+
_this.subProtocolType = ICoinSubProtocol_1.SubProtocolType.ACCOUNT;
|
|
151845
|
+
_this.addressValidationPattern = '^(tz1|KT1)[1-9A-Za-z]{33}$';
|
|
151359
151846
|
_this.migrationFee = new bignumber_1.default(5000);
|
|
151360
151847
|
return _this;
|
|
151361
151848
|
}
|
|
151849
|
+
TezosKtProtocol.prototype.getIsSubProtocol = function () {
|
|
151850
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
151851
|
+
return __generator(this, function (_a) {
|
|
151852
|
+
return [2 /*return*/, this.isSubProtocol];
|
|
151853
|
+
});
|
|
151854
|
+
});
|
|
151855
|
+
};
|
|
151856
|
+
TezosKtProtocol.prototype.getSubProtocolType = function () {
|
|
151857
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
151858
|
+
return __generator(this, function (_a) {
|
|
151859
|
+
return [2 /*return*/, this.subProtocolType];
|
|
151860
|
+
});
|
|
151861
|
+
});
|
|
151862
|
+
};
|
|
151863
|
+
TezosKtProtocol.prototype.getContractAddress = function () {
|
|
151864
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
151865
|
+
return __generator(this, function (_a) {
|
|
151866
|
+
return [2 /*return*/, undefined];
|
|
151867
|
+
});
|
|
151868
|
+
});
|
|
151869
|
+
};
|
|
151362
151870
|
TezosKtProtocol.prototype.getAddressFromPublicKey = function (publicKey, cursor) {
|
|
151363
151871
|
var _a;
|
|
151364
151872
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -151388,7 +151896,7 @@ var TezosKtProtocol = /** @class */ (function (_super) {
|
|
|
151388
151896
|
case 1:
|
|
151389
151897
|
tz1address = (_b.sent()).address;
|
|
151390
151898
|
startIndex = (_a = cursor === null || cursor === void 0 ? void 0 : cursor.index) !== null && _a !== void 0 ? _a : 0;
|
|
151391
|
-
return [4 /*yield*/, this.
|
|
151899
|
+
return [4 /*yield*/, this.options.network.extras.indexerClient.getDelegatorContracts(tz1address, INDEX_LIMIT)];
|
|
151392
151900
|
case 2:
|
|
151393
151901
|
ktAddresses = _b.sent();
|
|
151394
151902
|
return [4 /*yield*/, Promise.all(ktAddresses.reverse().map(function (ktAddress, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -151436,7 +151944,7 @@ var TezosKtProtocol = /** @class */ (function (_super) {
|
|
|
151436
151944
|
return __awaiter(this, void 0, void 0, function () {
|
|
151437
151945
|
var fee;
|
|
151438
151946
|
return __generator(this, function (_a) {
|
|
151439
|
-
fee = this.migrationFee.shiftedBy(-this.
|
|
151947
|
+
fee = this.migrationFee.shiftedBy(-this.getFeeDecimals).toFixed();
|
|
151440
151948
|
return [2 /*return*/, {
|
|
151441
151949
|
low: fee,
|
|
151442
151950
|
medium: fee,
|
|
@@ -152077,49 +152585,139 @@ var TezosSaplingForger_1 = require("./utils/TezosSaplingForger");
|
|
|
152077
152585
|
var TezosSaplingState_1 = require("./utils/TezosSaplingState");
|
|
152078
152586
|
var TezosSaplingProtocol = /** @class */ (function (_super) {
|
|
152079
152587
|
__extends(TezosSaplingProtocol, _super);
|
|
152080
|
-
function TezosSaplingProtocol(
|
|
152588
|
+
function TezosSaplingProtocol(options) {
|
|
152081
152589
|
var _a, _b, _c, _d, _e, _f;
|
|
152082
152590
|
var _this = _super.call(this) || this;
|
|
152083
|
-
_this.
|
|
152084
|
-
_this.
|
|
152085
|
-
_this.
|
|
152086
|
-
_this.
|
|
152087
|
-
_this.
|
|
152088
|
-
_this.
|
|
152089
|
-
_this.
|
|
152090
|
-
_this.
|
|
152091
|
-
_this.
|
|
152092
|
-
_this.
|
|
152093
|
-
_this.
|
|
152094
|
-
_this.
|
|
152095
|
-
_this.
|
|
152096
|
-
_this.
|
|
152097
|
-
_this.
|
|
152098
|
-
_this.
|
|
152099
|
-
_this.marketSymbol = Promise.resolve(_this._marketSymbol);
|
|
152100
|
-
_this._feeSymbol = _this.tezosProtocol._feeSymbol;
|
|
152101
|
-
_this.feeSymbol = Promise.resolve(_this._feeSymbol);
|
|
152102
|
-
_this._feeDefaults = (_c = _options.config.feeDefaults) !== null && _c !== void 0 ? _c : _this.tezosProtocol._feeDefaults;
|
|
152103
|
-
_this.feeDefaults = Promise.resolve(_this._feeDefaults);
|
|
152104
|
-
_this._decimals = (_d = _options.config.decimals) !== null && _d !== void 0 ? _d : _this.tezosProtocol._decimals;
|
|
152105
|
-
_this.decimals = Promise.resolve(_this._decimals);
|
|
152106
|
-
_this._feeDecimals = _this.tezosProtocol._feeDecimals;
|
|
152107
|
-
_this.feeDecimals = Promise.resolve(_this._feeDecimals);
|
|
152108
|
-
_this._identifier = (_e = _options.config.identifier) !== null && _e !== void 0 ? _e : _this.tezosProtocol._identifier;
|
|
152109
|
-
_this.identifier = Promise.resolve(_this._identifier);
|
|
152110
|
-
_this._units = (_f = _this._options.config.units) !== null && _f !== void 0 ? _f : _this.tezosProtocol._units;
|
|
152111
|
-
_this.units = Promise.resolve(_this._units);
|
|
152112
|
-
_this._standardDerivationPath = _this.tezosProtocol._standardDerivationPath;
|
|
152113
|
-
_this.standardDerivationPath = Promise.resolve(_this._standardDerivationPath);
|
|
152591
|
+
_this.options = options;
|
|
152592
|
+
_this.supportsHD = false;
|
|
152593
|
+
_this.addressIsCaseSensitive = true;
|
|
152594
|
+
_this.addressValidationPattern = '^(zet1[1-9A-Za-z]{65}|tz1[1-9A-Za-z]{33})$';
|
|
152595
|
+
_this.addressPlaceholder = 'zet1...';
|
|
152596
|
+
_this.tezosProtocol = new TezosProtocol_1.TezosProtocol(new TezosProtocolOptions_1.TezosProtocolOptions(_this.options.network, new TezosProtocolOptions_1.TezosProtocolConfig()));
|
|
152597
|
+
_this.name = options.config.name;
|
|
152598
|
+
_this.symbol = (_a = options.config.symbol) !== null && _a !== void 0 ? _a : _this.tezosProtocol.symbol;
|
|
152599
|
+
_this.marketSymbol = (_b = options.config.marketSymbol) !== null && _b !== void 0 ? _b : _this.tezosProtocol.marketSymbol;
|
|
152600
|
+
_this.feeSymbol = _this.tezosProtocol.feeSymbol;
|
|
152601
|
+
_this.feeDefaults = (_c = options.config.feeDefaults) !== null && _c !== void 0 ? _c : _this.tezosProtocol.feeDefaults;
|
|
152602
|
+
_this.decimals = (_d = options.config.decimals) !== null && _d !== void 0 ? _d : _this.tezosProtocol.decimals;
|
|
152603
|
+
_this.feeDecimals = _this.tezosProtocol.feeDecimals;
|
|
152604
|
+
_this.identifier = (_e = options.config.identifier) !== null && _e !== void 0 ? _e : _this.tezosProtocol.identifier;
|
|
152605
|
+
_this.units = (_f = _this.options.config.units) !== null && _f !== void 0 ? _f : _this.tezosProtocol.units;
|
|
152606
|
+
_this.standardDerivationPath = _this.tezosProtocol.standardDerivationPath;
|
|
152114
152607
|
_this.cryptoClient = new TezosSaplingCryptoClient_1.TezosSaplingCryptoClient(_this.tezosProtocol.cryptoClient);
|
|
152115
|
-
_this.nodeClient = new TezosSaplingNodeClient_1.TezosSaplingNodeClient(_this.
|
|
152116
|
-
_this.contract = new TezosContract_1.TezosContract(_this.
|
|
152117
|
-
_this.state = new TezosSaplingState_1.TezosSaplingState(_this.
|
|
152608
|
+
_this.nodeClient = new TezosSaplingNodeClient_1.TezosSaplingNodeClient(_this.options.network.rpcUrl, _this.options.config.contractAddress);
|
|
152609
|
+
_this.contract = new TezosContract_1.TezosContract(_this.options.config.contractAddress, _this.options.network);
|
|
152610
|
+
_this.state = new TezosSaplingState_1.TezosSaplingState(_this.options.config.merkleTreeHeight);
|
|
152118
152611
|
_this.encoder = new TezosSaplingEncoder_1.TezosSaplingEncoder();
|
|
152119
|
-
_this.forger = new TezosSaplingForger_1.TezosSaplingForger(_this.cryptoClient, _this.state, _this.encoder, _this.
|
|
152120
|
-
_this.bookkeeper = new TezosSaplingBookkeeper_1.TezosSaplingBookkeeper(_this.
|
|
152612
|
+
_this.forger = new TezosSaplingForger_1.TezosSaplingForger(_this.cryptoClient, _this.state, _this.encoder, _this.options.config.externalProvider);
|
|
152613
|
+
_this.bookkeeper = new TezosSaplingBookkeeper_1.TezosSaplingBookkeeper(_this.identifier, _this.options.network, _this.cryptoClient, _this.encoder);
|
|
152121
152614
|
return _this;
|
|
152122
152615
|
}
|
|
152616
|
+
TezosSaplingProtocol.prototype.getSymbol = function () {
|
|
152617
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
152618
|
+
return __generator(this, function (_a) {
|
|
152619
|
+
return [2 /*return*/, this.symbol];
|
|
152620
|
+
});
|
|
152621
|
+
});
|
|
152622
|
+
};
|
|
152623
|
+
TezosSaplingProtocol.prototype.getName = function () {
|
|
152624
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
152625
|
+
return __generator(this, function (_a) {
|
|
152626
|
+
return [2 /*return*/, this.name];
|
|
152627
|
+
});
|
|
152628
|
+
});
|
|
152629
|
+
};
|
|
152630
|
+
TezosSaplingProtocol.prototype.getMarketSymbol = function () {
|
|
152631
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
152632
|
+
return __generator(this, function (_a) {
|
|
152633
|
+
return [2 /*return*/, this.marketSymbol];
|
|
152634
|
+
});
|
|
152635
|
+
});
|
|
152636
|
+
};
|
|
152637
|
+
TezosSaplingProtocol.prototype.getFeeSymbol = function () {
|
|
152638
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
152639
|
+
return __generator(this, function (_a) {
|
|
152640
|
+
return [2 /*return*/, this.feeSymbol];
|
|
152641
|
+
});
|
|
152642
|
+
});
|
|
152643
|
+
};
|
|
152644
|
+
TezosSaplingProtocol.prototype.getDecimals = function () {
|
|
152645
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
152646
|
+
return __generator(this, function (_a) {
|
|
152647
|
+
return [2 /*return*/, this.decimals];
|
|
152648
|
+
});
|
|
152649
|
+
});
|
|
152650
|
+
};
|
|
152651
|
+
TezosSaplingProtocol.prototype.getFeeDecimals = function () {
|
|
152652
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
152653
|
+
return __generator(this, function (_a) {
|
|
152654
|
+
return [2 /*return*/, this.feeDecimals];
|
|
152655
|
+
});
|
|
152656
|
+
});
|
|
152657
|
+
};
|
|
152658
|
+
TezosSaplingProtocol.prototype.getIdentifier = function () {
|
|
152659
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
152660
|
+
return __generator(this, function (_a) {
|
|
152661
|
+
return [2 /*return*/, this.identifier];
|
|
152662
|
+
});
|
|
152663
|
+
});
|
|
152664
|
+
};
|
|
152665
|
+
TezosSaplingProtocol.prototype.getFeeDefaults = function () {
|
|
152666
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
152667
|
+
return __generator(this, function (_a) {
|
|
152668
|
+
return [2 /*return*/, this.feeDefaults];
|
|
152669
|
+
});
|
|
152670
|
+
});
|
|
152671
|
+
};
|
|
152672
|
+
TezosSaplingProtocol.prototype.getUnits = function () {
|
|
152673
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
152674
|
+
return __generator(this, function (_a) {
|
|
152675
|
+
return [2 /*return*/, this.units];
|
|
152676
|
+
});
|
|
152677
|
+
});
|
|
152678
|
+
};
|
|
152679
|
+
TezosSaplingProtocol.prototype.getSupportsHD = function () {
|
|
152680
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
152681
|
+
return __generator(this, function (_a) {
|
|
152682
|
+
return [2 /*return*/, this.supportsHD];
|
|
152683
|
+
});
|
|
152684
|
+
});
|
|
152685
|
+
};
|
|
152686
|
+
TezosSaplingProtocol.prototype.getStandardDerivationPath = function () {
|
|
152687
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
152688
|
+
return __generator(this, function (_a) {
|
|
152689
|
+
return [2 /*return*/, this.standardDerivationPath];
|
|
152690
|
+
});
|
|
152691
|
+
});
|
|
152692
|
+
};
|
|
152693
|
+
TezosSaplingProtocol.prototype.getAddressIsCaseSensitive = function () {
|
|
152694
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
152695
|
+
return __generator(this, function (_a) {
|
|
152696
|
+
return [2 /*return*/, this.addressIsCaseSensitive];
|
|
152697
|
+
});
|
|
152698
|
+
});
|
|
152699
|
+
};
|
|
152700
|
+
TezosSaplingProtocol.prototype.getAddressValidationPattern = function () {
|
|
152701
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
152702
|
+
return __generator(this, function (_a) {
|
|
152703
|
+
return [2 /*return*/, this.addressValidationPattern];
|
|
152704
|
+
});
|
|
152705
|
+
});
|
|
152706
|
+
};
|
|
152707
|
+
TezosSaplingProtocol.prototype.getAddressPlaceholder = function () {
|
|
152708
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
152709
|
+
return __generator(this, function (_a) {
|
|
152710
|
+
return [2 /*return*/, this.addressPlaceholder];
|
|
152711
|
+
});
|
|
152712
|
+
});
|
|
152713
|
+
};
|
|
152714
|
+
TezosSaplingProtocol.prototype.getOptions = function () {
|
|
152715
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
152716
|
+
return __generator(this, function (_a) {
|
|
152717
|
+
return [2 /*return*/, this.options];
|
|
152718
|
+
});
|
|
152719
|
+
});
|
|
152720
|
+
};
|
|
152123
152721
|
TezosSaplingProtocol.prototype.initParameters = function (spendParams, outputParams) {
|
|
152124
152722
|
var _a;
|
|
152125
152723
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -152127,7 +152725,7 @@ var TezosSaplingProtocol = /** @class */ (function (_super) {
|
|
|
152127
152725
|
return __generator(this, function (_b) {
|
|
152128
152726
|
switch (_b.label) {
|
|
152129
152727
|
case 0:
|
|
152130
|
-
externalInitParameters = (_a = this.
|
|
152728
|
+
externalInitParameters = (_a = this.options.config.externalProvider) === null || _a === void 0 ? void 0 : _a.initParameters;
|
|
152131
152729
|
if (!(externalInitParameters !== undefined)) return [3 /*break*/, 2];
|
|
152132
152730
|
return [4 /*yield*/, externalInitParameters(spendParams, outputParams)];
|
|
152133
152731
|
case 1:
|
|
@@ -152312,8 +152910,8 @@ var TezosSaplingProtocol = /** @class */ (function (_super) {
|
|
|
152312
152910
|
isInbound: true,
|
|
152313
152911
|
amount: input.value,
|
|
152314
152912
|
fee: '0',
|
|
152315
|
-
protocolIdentifier: this.
|
|
152316
|
-
network: this.
|
|
152913
|
+
protocolIdentifier: this.identifier,
|
|
152914
|
+
network: this.options.network
|
|
152317
152915
|
})];
|
|
152318
152916
|
});
|
|
152319
152917
|
}); }))];
|
|
@@ -152331,8 +152929,8 @@ var TezosSaplingProtocol = /** @class */ (function (_super) {
|
|
|
152331
152929
|
_a.isInbound = false,
|
|
152332
152930
|
_a.amount = input.value,
|
|
152333
152931
|
_a.fee = '0',
|
|
152334
|
-
_a.protocolIdentifier = this.
|
|
152335
|
-
_a.network = this.
|
|
152932
|
+
_a.protocolIdentifier = this.identifier,
|
|
152933
|
+
_a.network = this.options.network,
|
|
152336
152934
|
_a)];
|
|
152337
152935
|
}
|
|
152338
152936
|
});
|
|
@@ -152412,8 +153010,8 @@ var TezosSaplingProtocol = /** @class */ (function (_super) {
|
|
|
152412
153010
|
isInbound: false,
|
|
152413
153011
|
amount: '0',
|
|
152414
153012
|
fee: '0',
|
|
152415
|
-
protocolIdentifier: this.
|
|
152416
|
-
network: this.
|
|
153013
|
+
protocolIdentifier: this.identifier,
|
|
153014
|
+
network: this.options.network
|
|
152417
153015
|
};
|
|
152418
153016
|
if (!this.contract.areValidParameters(tx)) return [3 /*break*/, 2];
|
|
152419
153017
|
return [4 /*yield*/, this.getPartialDetailsFromContractParameters(tx, data === null || data === void 0 ? void 0 : data.knownViewingKeys)];
|
|
@@ -152463,7 +153061,7 @@ var TezosSaplingProtocol = /** @class */ (function (_super) {
|
|
|
152463
153061
|
case 0: return [4 /*yield*/, this.getPartialDetailsFromContractParameters(operation.parameters, knownViewingKeys)];
|
|
152464
153062
|
case 1:
|
|
152465
153063
|
saplingDetails = _a.sent();
|
|
152466
|
-
return [2 /*return*/, saplingDetails.map(function (partials) { return (__assign(__assign({ from: [operation.source], to: ['Shielded Pool'], isInbound: false, amount: operation.amount, fee: operation.fee, protocolIdentifier: _this.
|
|
153064
|
+
return [2 /*return*/, saplingDetails.map(function (partials) { return (__assign(__assign({ from: [operation.source], to: ['Shielded Pool'], isInbound: false, amount: operation.amount, fee: operation.fee, protocolIdentifier: _this.identifier, network: _this.options.network }, partials), { transactionDetails: operation })); })];
|
|
152467
153065
|
}
|
|
152468
153066
|
});
|
|
152469
153067
|
}); }))];
|
|
@@ -152608,7 +153206,7 @@ var TezosSaplingProtocol = /** @class */ (function (_super) {
|
|
|
152608
153206
|
kind: TezosOperationType_1.TezosOperationType.TRANSACTION,
|
|
152609
153207
|
fee: fee,
|
|
152610
153208
|
amount: amount,
|
|
152611
|
-
destination: this.
|
|
153209
|
+
destination: this.options.config.contractAddress,
|
|
152612
153210
|
parameters: parameters
|
|
152613
153211
|
};
|
|
152614
153212
|
};
|
|
@@ -152683,7 +153281,7 @@ var TezosSaplingProtocol = /** @class */ (function (_super) {
|
|
|
152683
153281
|
return [2 /*return*/, {
|
|
152684
153282
|
ins: inputs.concat(dummyInputs),
|
|
152685
153283
|
outs: __spreadArrays([paymentOutput, paybackOutput], dummyOutputs).filter(function (output) { return output !== undefined; }),
|
|
152686
|
-
contractAddress: this.
|
|
153284
|
+
contractAddress: this.options.config.contractAddress,
|
|
152687
153285
|
chainId: chainId,
|
|
152688
153286
|
stateDiff: stateDiff,
|
|
152689
153287
|
unshieldTarget: ''
|
|
@@ -152713,7 +153311,7 @@ var TezosSaplingProtocol = /** @class */ (function (_super) {
|
|
|
152713
153311
|
case 2:
|
|
152714
153312
|
output = (_b.address = (_c.sent()).asString(),
|
|
152715
153313
|
_b.value = value,
|
|
152716
|
-
_b.memo = Buffer.alloc(this.
|
|
153314
|
+
_b.memo = Buffer.alloc(this.options.config.memoSize).toString('hex'),
|
|
152717
153315
|
_b.browsable = true,
|
|
152718
153316
|
_b);
|
|
152719
153317
|
return [4 /*yield*/, this.state.getStateTreeFromStateDiff(saplingStateDiff, true)];
|
|
@@ -152747,13 +153345,13 @@ var TezosSaplingProtocol = /** @class */ (function (_super) {
|
|
|
152747
153345
|
case 3:
|
|
152748
153346
|
paybackOutput = (_c.address = (_d.sent()).address,
|
|
152749
153347
|
_c.value = toSpend.minus(value).toString(),
|
|
152750
|
-
_c.memo = Buffer.alloc(this.
|
|
153348
|
+
_c.memo = Buffer.alloc(this.options.config.memoSize).toString('hex'),
|
|
152751
153349
|
_c.browsable = true,
|
|
152752
153350
|
_c);
|
|
152753
153351
|
return [2 /*return*/, {
|
|
152754
153352
|
ins: inputs,
|
|
152755
153353
|
outs: [paybackOutput],
|
|
152756
|
-
contractAddress: this.
|
|
153354
|
+
contractAddress: this.options.config.contractAddress,
|
|
152757
153355
|
chainId: chainId,
|
|
152758
153356
|
stateDiff: stateDiff,
|
|
152759
153357
|
unshieldTarget: ''
|
|
@@ -152790,7 +153388,7 @@ var TezosSaplingProtocol = /** @class */ (function (_super) {
|
|
|
152790
153388
|
});
|
|
152791
153389
|
};
|
|
152792
153390
|
TezosSaplingProtocol.prototype.createPaymentOutput = function (address, value, memo) {
|
|
152793
|
-
if (memo === void 0) { memo = Buffer.alloc(this.
|
|
153391
|
+
if (memo === void 0) { memo = Buffer.alloc(this.options.config.memoSize); }
|
|
152794
153392
|
return {
|
|
152795
153393
|
address: address.asString(),
|
|
152796
153394
|
value: new bignumber_1.default(value).toString(),
|
|
@@ -152799,7 +153397,7 @@ var TezosSaplingProtocol = /** @class */ (function (_super) {
|
|
|
152799
153397
|
};
|
|
152800
153398
|
};
|
|
152801
153399
|
TezosSaplingProtocol.prototype.createPaybackOutput = function (address, toSpend, value, memo) {
|
|
152802
|
-
if (memo === void 0) { memo = Buffer.alloc(this.
|
|
153400
|
+
if (memo === void 0) { memo = Buffer.alloc(this.options.config.memoSize); }
|
|
152803
153401
|
var paybackValue = toSpend.minus(value);
|
|
152804
153402
|
return paybackValue.gt(0)
|
|
152805
153403
|
? {
|
|
@@ -152839,7 +153437,7 @@ var TezosSaplingProtocol = /** @class */ (function (_super) {
|
|
|
152839
153437
|
return [4 /*yield*/, this.getDummyAddress()];
|
|
152840
153438
|
case 2:
|
|
152841
153439
|
address = _a.sent();
|
|
152842
|
-
memo = sodium.randombytes_buf(this.
|
|
153440
|
+
memo = sodium.randombytes_buf(this.options.config.memoSize);
|
|
152843
153441
|
return [2 /*return*/, {
|
|
152844
153442
|
address: address.address,
|
|
152845
153443
|
value: '0',
|
|
@@ -152859,7 +153457,7 @@ var TezosSaplingProtocol = /** @class */ (function (_super) {
|
|
|
152859
153457
|
case 1:
|
|
152860
153458
|
_a.sent();
|
|
152861
153459
|
seed = sodium.randombytes_buf(32);
|
|
152862
|
-
return [4 /*yield*/, this.getPublicKeyFromHexSecret(Buffer.from(seed).toString('hex'), this.
|
|
153460
|
+
return [4 /*yield*/, this.getPublicKeyFromHexSecret(Buffer.from(seed).toString('hex'), this.standardDerivationPath)];
|
|
152863
153461
|
case 2:
|
|
152864
153462
|
viewingKey = _a.sent();
|
|
152865
153463
|
return [2 /*return*/, this.getAddressFromPublicKey(viewingKey)];
|
|
@@ -152872,7 +153470,7 @@ var TezosSaplingProtocol = /** @class */ (function (_super) {
|
|
|
152872
153470
|
return TezosUtils_1.TezosUtils.packMichelsonType(michelson);
|
|
152873
153471
|
};
|
|
152874
153472
|
TezosSaplingProtocol.prototype.getAntiReplay = function (chainId, contractAddress) {
|
|
152875
|
-
return (contractAddress !== null && contractAddress !== void 0 ? contractAddress : this.
|
|
153473
|
+
return (contractAddress !== null && contractAddress !== void 0 ? contractAddress : this.options.config.contractAddress) + chainId;
|
|
152876
153474
|
};
|
|
152877
153475
|
TezosSaplingProtocol.prototype.broadcastTransaction = function (rawTransaction) {
|
|
152878
153476
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -158052,7 +158650,7 @@ var TezosBTCTransactionValidator = /** @class */ (function (_super) {
|
|
|
158052
158650
|
var options;
|
|
158053
158651
|
return __generator(this, function (_a) {
|
|
158054
158652
|
switch (_a.label) {
|
|
158055
|
-
case 0: return [4 /*yield*/, protocol.
|
|
158653
|
+
case 0: return [4 /*yield*/, protocol.getOptions()];
|
|
158056
158654
|
case 1:
|
|
158057
158655
|
options = _a.sent();
|
|
158058
158656
|
if (transaction.destination !== options.config.contractAddress) {
|
|
@@ -158548,7 +159146,7 @@ validate_1.validators.isValidBitcoinInput = function (ins) {
|
|
|
158548
159146
|
return [2 /*return*/];
|
|
158549
159147
|
case 2:
|
|
158550
159148
|
_a = RegExp;
|
|
158551
|
-
return [4 /*yield*/, new BitcoinProtocol_1.BitcoinProtocol().
|
|
159149
|
+
return [4 /*yield*/, new BitcoinProtocol_1.BitcoinProtocol().getAddressValidationPattern()];
|
|
158552
159150
|
case 3:
|
|
158553
159151
|
pattern = _a.apply(void 0, [_b.sent()]);
|
|
158554
159152
|
if (!pattern.test(value.address)) {
|
|
@@ -158608,7 +159206,7 @@ validate_1.validators.isValidBitcoinOutput = function (outs) {
|
|
|
158608
159206
|
return [2 /*return*/];
|
|
158609
159207
|
case 2:
|
|
158610
159208
|
_a = RegExp;
|
|
158611
|
-
return [4 /*yield*/, new BitcoinProtocol_1.BitcoinProtocol().
|
|
159209
|
+
return [4 /*yield*/, new BitcoinProtocol_1.BitcoinProtocol().getAddressValidationPattern()];
|
|
158612
159210
|
case 3:
|
|
158613
159211
|
pattern = _a.apply(void 0, [_b.sent()]);
|
|
158614
159212
|
if (!pattern.test(value.recipient)) {
|
|
@@ -158649,7 +159247,7 @@ validate_1.validators.isValidBitcoinOutput = function (outs) {
|
|
|
158649
159247
|
}); });
|
|
158650
159248
|
};
|
|
158651
159249
|
validate_1.validators.isValidBitcoinFromArray = function (array) {
|
|
158652
|
-
new Promise(function (resolve, reject) { return __awaiter(void 0, void 0, void 0, function () {
|
|
159250
|
+
return new Promise(function (resolve, reject) { return __awaiter(void 0, void 0, void 0, function () {
|
|
158653
159251
|
var i, address, pattern, _a;
|
|
158654
159252
|
return __generator(this, function (_b) {
|
|
158655
159253
|
switch (_b.label) {
|
|
@@ -158664,7 +159262,7 @@ validate_1.validators.isValidBitcoinFromArray = function (array) {
|
|
|
158664
159262
|
if (!(i < array.length)) return [3 /*break*/, 4];
|
|
158665
159263
|
address = array[i];
|
|
158666
159264
|
_a = RegExp;
|
|
158667
|
-
return [4 /*yield*/, new BitcoinProtocol_1.BitcoinProtocol().
|
|
159265
|
+
return [4 /*yield*/, new BitcoinProtocol_1.BitcoinProtocol().getAddressValidationPattern()];
|
|
158668
159266
|
case 2:
|
|
158669
159267
|
pattern = _a.apply(void 0, [_b.sent()]) // TODO maybe don't use the testnetprotocol
|
|
158670
159268
|
;
|
|
@@ -158723,7 +159321,7 @@ validate_1.validators.isValidBitcoinTxString = function (transaction) {
|
|
|
158723
159321
|
case 1:
|
|
158724
159322
|
_a.trys.push([1, 3, , 4]);
|
|
158725
159323
|
protocol = new BitcoinProtocol_1.BitcoinProtocol();
|
|
158726
|
-
return [4 /*yield*/, protocol.
|
|
159324
|
+
return [4 /*yield*/, protocol.getOptions()];
|
|
158727
159325
|
case 2:
|
|
158728
159326
|
bitcoinJSLib = (_a.sent()).config.bitcoinJSLib;
|
|
158729
159327
|
bitcoinJSLib.Transaction.fromHex(transaction);
|
|
@@ -160597,7 +161195,7 @@ var TezosBTCTransactionValidator = /** @class */ (function (_super) {
|
|
|
160597
161195
|
var options;
|
|
160598
161196
|
return __generator(this, function (_a) {
|
|
160599
161197
|
switch (_a.label) {
|
|
160600
|
-
case 0: return [4 /*yield*/, protocol.
|
|
161198
|
+
case 0: return [4 /*yield*/, protocol.getOptions()];
|
|
160601
161199
|
case 1:
|
|
160602
161200
|
options = _a.sent();
|
|
160603
161201
|
if (transaction.destination !== options.config.contractAddress) {
|
|
@@ -161024,7 +161622,7 @@ validate_1.validators.isValidBitcoinInput = function (ins) {
|
|
|
161024
161622
|
return [2 /*return*/];
|
|
161025
161623
|
case 2:
|
|
161026
161624
|
_a = RegExp;
|
|
161027
|
-
return [4 /*yield*/, new BitcoinProtocol_1.BitcoinProtocol().
|
|
161625
|
+
return [4 /*yield*/, new BitcoinProtocol_1.BitcoinProtocol().getAddressValidationPattern()];
|
|
161028
161626
|
case 3:
|
|
161029
161627
|
pattern = _a.apply(void 0, [_b.sent()]);
|
|
161030
161628
|
if (!pattern.test(value.address)) {
|
|
@@ -161084,7 +161682,7 @@ validate_1.validators.isValidBitcoinOutput = function (outs) {
|
|
|
161084
161682
|
return [2 /*return*/];
|
|
161085
161683
|
case 2:
|
|
161086
161684
|
_a = RegExp;
|
|
161087
|
-
return [4 /*yield*/, new BitcoinProtocol_1.BitcoinProtocol().
|
|
161685
|
+
return [4 /*yield*/, new BitcoinProtocol_1.BitcoinProtocol().getAddressValidationPattern()];
|
|
161088
161686
|
case 3:
|
|
161089
161687
|
pattern = _a.apply(void 0, [_b.sent()]);
|
|
161090
161688
|
if (!pattern.test(value.recipient)) {
|
|
@@ -161125,7 +161723,7 @@ validate_1.validators.isValidBitcoinOutput = function (outs) {
|
|
|
161125
161723
|
}); });
|
|
161126
161724
|
};
|
|
161127
161725
|
validate_1.validators.isValidBitcoinFromArray = function (array) {
|
|
161128
|
-
new Promise(function (resolve, reject) { return __awaiter(void 0, void 0, void 0, function () {
|
|
161726
|
+
return new Promise(function (resolve, reject) { return __awaiter(void 0, void 0, void 0, function () {
|
|
161129
161727
|
var i, address, pattern, _a;
|
|
161130
161728
|
return __generator(this, function (_b) {
|
|
161131
161729
|
switch (_b.label) {
|
|
@@ -161140,7 +161738,7 @@ validate_1.validators.isValidBitcoinFromArray = function (array) {
|
|
|
161140
161738
|
if (!(i < array.length)) return [3 /*break*/, 4];
|
|
161141
161739
|
address = array[i];
|
|
161142
161740
|
_a = RegExp;
|
|
161143
|
-
return [4 /*yield*/, new BitcoinProtocol_1.BitcoinProtocol().
|
|
161741
|
+
return [4 /*yield*/, new BitcoinProtocol_1.BitcoinProtocol().getAddressValidationPattern()];
|
|
161144
161742
|
case 2:
|
|
161145
161743
|
pattern = _a.apply(void 0, [_b.sent()]) // TODO maybe don't use the testnetprotocol
|
|
161146
161744
|
;
|
|
@@ -161199,7 +161797,7 @@ validate_1.validators.isValidBitcoinTxString = function (transaction) {
|
|
|
161199
161797
|
case 1:
|
|
161200
161798
|
_a.trys.push([1, 3, , 4]);
|
|
161201
161799
|
protocol = new BitcoinProtocol_1.BitcoinProtocol();
|
|
161202
|
-
return [4 /*yield*/, protocol.
|
|
161800
|
+
return [4 /*yield*/, protocol.getOptions()];
|
|
161203
161801
|
case 2:
|
|
161204
161802
|
bitcoinJSLib = (_a.sent()).config.bitcoinJSLib;
|
|
161205
161803
|
bitcoinJSLib.Transaction.fromHex(transaction);
|
|
@@ -162344,12 +162942,12 @@ var getProtocolByIdentifier = function (identifier, network) {
|
|
|
162344
162942
|
switch (_d.label) {
|
|
162345
162943
|
case 0:
|
|
162346
162944
|
_b = identifier;
|
|
162347
|
-
return [4 /*yield*/, protocol.
|
|
162945
|
+
return [4 /*yield*/, protocol.getIdentifier()];
|
|
162348
162946
|
case 1:
|
|
162349
162947
|
_a = _b === (_d.sent());
|
|
162350
162948
|
if (!_a) return [3 /*break*/, 3];
|
|
162351
162949
|
_c = Network_1.isNetworkEqual;
|
|
162352
|
-
return [4 /*yield*/, protocol.
|
|
162950
|
+
return [4 /*yield*/, protocol.getOptions()];
|
|
162353
162951
|
case 2:
|
|
162354
162952
|
_a = _c.apply(void 0, [(_d.sent()).network, targetNetwork_1]);
|
|
162355
162953
|
_d.label = 3;
|
|
@@ -162379,10 +162977,10 @@ var getProtocolByIdentifier = function (identifier, network) {
|
|
|
162379
162977
|
candidate = filteredCandidates_1[_i];
|
|
162380
162978
|
_a = found === undefined;
|
|
162381
162979
|
if (_a) return [3 /*break*/, 5];
|
|
162382
|
-
return [4 /*yield*/, candidate.
|
|
162980
|
+
return [4 /*yield*/, candidate.getIdentifier()];
|
|
162383
162981
|
case 3:
|
|
162384
162982
|
_b = (_c.sent()).length;
|
|
162385
|
-
return [4 /*yield*/, found.
|
|
162983
|
+
return [4 /*yield*/, found.getIdentifier()];
|
|
162386
162984
|
case 4:
|
|
162387
162985
|
_a = _b < (_c.sent()).length;
|
|
162388
162986
|
_c.label = 5;
|
|
@@ -163060,20 +163658,20 @@ var addSupportedProtocol = function (newProtocol) {
|
|
|
163060
163658
|
switch (_a.label) {
|
|
163061
163659
|
case 0:
|
|
163062
163660
|
_a.trys.push([0, 4, , 5]);
|
|
163063
|
-
return [4 /*yield*/, newProtocol.
|
|
163661
|
+
return [4 /*yield*/, newProtocol.getIdentifier()];
|
|
163064
163662
|
case 1:
|
|
163065
163663
|
newProtocolIdentifier_1 = _a.sent();
|
|
163066
|
-
return [4 /*yield*/, newProtocol.
|
|
163664
|
+
return [4 /*yield*/, newProtocol.getOptions()];
|
|
163067
163665
|
case 2:
|
|
163068
163666
|
newProtocolOptions_1 = _a.sent();
|
|
163069
163667
|
return [4 /*yield*/, Promise.all(supportedProtocols().map(function (protocol) { return __awaiter(void 0, void 0, void 0, function () {
|
|
163070
163668
|
var protocolIdentifier, protocolOptions;
|
|
163071
163669
|
return __generator(this, function (_a) {
|
|
163072
163670
|
switch (_a.label) {
|
|
163073
|
-
case 0: return [4 /*yield*/, protocol.
|
|
163671
|
+
case 0: return [4 /*yield*/, protocol.getIdentifier()];
|
|
163074
163672
|
case 1:
|
|
163075
163673
|
protocolIdentifier = _a.sent();
|
|
163076
|
-
return [4 /*yield*/, protocol.
|
|
163674
|
+
return [4 /*yield*/, protocol.getOptions()];
|
|
163077
163675
|
case 2:
|
|
163078
163676
|
protocolOptions = _a.sent();
|
|
163079
163677
|
return [2 /*return*/, protocolIdentifier === newProtocolIdentifier_1 && Network_1.isNetworkEqual(protocolOptions.network, newProtocolOptions_1.network)];
|
|
@@ -163085,7 +163683,7 @@ var addSupportedProtocol = function (newProtocol) {
|
|
|
163085
163683
|
case 3:
|
|
163086
163684
|
alreadyExists = _a.sent();
|
|
163087
163685
|
if (alreadyExists) {
|
|
163088
|
-
throw new errors_1.InvalidValueError(coinlib_error_1.Domain.UTILS, "protocol " + newProtocol.
|
|
163686
|
+
throw new errors_1.InvalidValueError(coinlib_error_1.Domain.UTILS, "protocol " + newProtocol.getName + " on network " + newProtocolOptions_1.network.type + "(" + newProtocolOptions_1.network.rpcUrl + ") already exists");
|
|
163089
163687
|
}
|
|
163090
163688
|
protocols.push(newProtocol);
|
|
163091
163689
|
resolve();
|
|
@@ -163105,20 +163703,20 @@ var removeSupportedProtocol = function (protocolToRemove) {
|
|
|
163105
163703
|
var protocolToRemoveIdentifier, protocolToRemoveOptions, index, candidateIdentifier, candidateOptions;
|
|
163106
163704
|
return __generator(this, function (_a) {
|
|
163107
163705
|
switch (_a.label) {
|
|
163108
|
-
case 0: return [4 /*yield*/, protocolToRemove.
|
|
163706
|
+
case 0: return [4 /*yield*/, protocolToRemove.getIdentifier()];
|
|
163109
163707
|
case 1:
|
|
163110
163708
|
protocolToRemoveIdentifier = _a.sent();
|
|
163111
|
-
return [4 /*yield*/, protocolToRemove.
|
|
163709
|
+
return [4 /*yield*/, protocolToRemove.getOptions()];
|
|
163112
163710
|
case 2:
|
|
163113
163711
|
protocolToRemoveOptions = _a.sent();
|
|
163114
163712
|
index = 0;
|
|
163115
163713
|
_a.label = 3;
|
|
163116
163714
|
case 3:
|
|
163117
163715
|
if (!(index < protocols.length)) return [3 /*break*/, 7];
|
|
163118
|
-
return [4 /*yield*/, protocols[index].
|
|
163716
|
+
return [4 /*yield*/, protocols[index].getIdentifier()];
|
|
163119
163717
|
case 4:
|
|
163120
163718
|
candidateIdentifier = _a.sent();
|
|
163121
|
-
return [4 /*yield*/, protocols[index].
|
|
163719
|
+
return [4 /*yield*/, protocols[index].getOptions()];
|
|
163122
163720
|
case 5:
|
|
163123
163721
|
candidateOptions = _a.sent();
|
|
163124
163722
|
if (candidateIdentifier === protocolToRemoveIdentifier && Network_1.isNetworkEqual(candidateOptions.network, protocolToRemoveOptions.network)) {
|
|
@@ -163265,7 +163863,7 @@ var AirGapCoinWallet = /** @class */ (function (_super) {
|
|
|
163265
163863
|
switch (_b.label) {
|
|
163266
163864
|
case 0:
|
|
163267
163865
|
_a = this;
|
|
163268
|
-
return [4 /*yield*/, this.protocol.
|
|
163866
|
+
return [4 /*yield*/, this.protocol.getOptions()];
|
|
163269
163867
|
case 1:
|
|
163270
163868
|
_a.currentMarketPrice = (_b.sent()).network.type === ProtocolNetwork_1.NetworkType.MAINNET ? marketPrice : new bignumber_1.default(0);
|
|
163271
163869
|
return [2 /*return*/];
|
|
@@ -163316,7 +163914,7 @@ var AirGapCoinWallet = /** @class */ (function (_super) {
|
|
|
163316
163914
|
var protocolIdentifier, result, _a, _b, _c, _d, _e;
|
|
163317
163915
|
return __generator(this, function (_f) {
|
|
163318
163916
|
switch (_f.label) {
|
|
163319
|
-
case 0: return [4 /*yield*/, this.protocol.
|
|
163917
|
+
case 0: return [4 /*yield*/, this.protocol.getIdentifier()];
|
|
163320
163918
|
case 1:
|
|
163321
163919
|
protocolIdentifier = _f.sent();
|
|
163322
163920
|
if (!((protocolIdentifier === ProtocolSymbols_1.MainProtocolSymbols.BTC ||
|
|
@@ -163492,7 +164090,7 @@ var AirGapMarketWallet = /** @class */ (function (_super) {
|
|
|
163492
164090
|
var protocolIdentifier, transactionResult;
|
|
163493
164091
|
return __generator(this, function (_a) {
|
|
163494
164092
|
switch (_a.label) {
|
|
163495
|
-
case 0: return [4 /*yield*/, this.protocol.
|
|
164093
|
+
case 0: return [4 /*yield*/, this.protocol.getIdentifier()
|
|
163496
164094
|
// let transactions: IAirGapTransaction[] = []
|
|
163497
164095
|
];
|
|
163498
164096
|
case 1:
|
|
@@ -163678,7 +164276,7 @@ var AirGapNFTWallet = /** @class */ (function (_super) {
|
|
|
163678
164276
|
case 0:
|
|
163679
164277
|
_a = this.getCurrentMarketPrice;
|
|
163680
164278
|
_b = assetID;
|
|
163681
|
-
return [4 /*yield*/, this.protocol.
|
|
164279
|
+
return [4 /*yield*/, this.protocol.getOptions()];
|
|
163682
164280
|
case 1:
|
|
163683
164281
|
_a[_b] =
|
|
163684
164282
|
(_c.sent()).network.type === ProtocolNetwork_1.NetworkType.MAINNET ? marketPrice : new bignumber_1.default(0);
|
|
@@ -163842,7 +164440,7 @@ var AirGapWallet = /** @class */ (function () {
|
|
|
163842
164440
|
AirGapWallet.prototype.setProtocol = function (protocol) {
|
|
163843
164441
|
return __awaiter(this, void 0, void 0, function () {
|
|
163844
164442
|
return __generator(this, function (_a) {
|
|
163845
|
-
if (this.protocol.
|
|
164443
|
+
if (this.protocol.getIdentifier !== protocol.getIdentifier) {
|
|
163846
164444
|
throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.WALLET, 'Can only set same protocol with a different network');
|
|
163847
164445
|
}
|
|
163848
164446
|
this.protocol = protocol;
|
|
@@ -163886,10 +164484,10 @@ var AirGapWallet = /** @class */ (function () {
|
|
|
163886
164484
|
switch (_b.label) {
|
|
163887
164485
|
case 0:
|
|
163888
164486
|
_a = {};
|
|
163889
|
-
return [4 /*yield*/, this.protocol.
|
|
164487
|
+
return [4 /*yield*/, this.protocol.getIdentifier()];
|
|
163890
164488
|
case 1:
|
|
163891
164489
|
_a.protocolIdentifier = _b.sent();
|
|
163892
|
-
return [4 /*yield*/, this.protocol.
|
|
164490
|
+
return [4 /*yield*/, this.protocol.getOptions()];
|
|
163893
164491
|
case 2: return [2 /*return*/, (_a.networkIdentifier = (_b.sent()).network.identifier,
|
|
163894
164492
|
_a.publicKey = this.publicKey,
|
|
163895
164493
|
_a.isExtendedPublicKey = this.isExtendedPublicKey,
|