@airgap/tezos 0.13.15-beta.1 → 0.13.15-beta.2
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/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +5 -5
- package/v0/protocol/TezosProtocol.js +1 -4
- package/v0/protocol/TezosProtocol.js.map +1 -1
- package/v1/block-explorer/factory.d.ts +2 -2
- package/v1/block-explorer/factory.js +4 -4
- package/v1/block-explorer/factory.js.map +1 -1
- package/v1/contract/TezosContract.js +1 -1
- package/v1/contract/TezosContract.js.map +1 -1
- package/v1/index.d.ts +4 -23
- package/v1/index.js +1 -23
- package/v1/index.js.map +1 -1
- package/v1/indexer/factory.d.ts +2 -2
- package/v1/indexer/factory.js +4 -4
- package/v1/indexer/factory.js.map +1 -1
- package/v1/module/TezosModule.d.ts +3 -6
- package/v1/module/TezosModule.js +6 -10
- package/v1/module/TezosModule.js.map +1 -1
- package/v1/protocol/TezosProtocol.d.ts +7 -32
- package/v1/protocol/TezosProtocol.js +19 -350
- package/v1/protocol/TezosProtocol.js.map +1 -1
- package/v1/protocol/fa/TezosFA1Protocol.d.ts +3 -16
- package/v1/protocol/fa/TezosFA1Protocol.js +6 -17
- package/v1/protocol/fa/TezosFA1Protocol.js.map +1 -1
- package/v1/protocol/fa/TezosFA1p2Protocol.d.ts +2 -15
- package/v1/protocol/fa/TezosFA1p2Protocol.js +5 -11
- package/v1/protocol/fa/TezosFA1p2Protocol.js.map +1 -1
- package/v1/protocol/fa/TezosFA2Protocol.d.ts +6 -21
- package/v1/protocol/fa/TezosFA2Protocol.js +6 -34
- package/v1/protocol/fa/TezosFA2Protocol.js.map +1 -1
- package/v1/protocol/fa/TezosFAProtocol.d.ts +7 -10
- package/v1/protocol/fa/TezosFAProtocol.js +7 -21
- package/v1/protocol/fa/TezosFAProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/BTCTezProtocol.js +1 -1
- package/v1/protocol/fa/tokens/BTCTezProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/CTezProtocol.js +1 -1
- package/v1/protocol/fa/tokens/CTezProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/DogamiProtocol.js +1 -1
- package/v1/protocol/fa/tokens/DogamiProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/ETHTezProtocol.js +1 -1
- package/v1/protocol/fa/tokens/ETHTezProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/KolibriUSDProtocol.js +1 -1
- package/v1/protocol/fa/tokens/KolibriUSDProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/PlentyProtocol.js +1 -1
- package/v1/protocol/fa/tokens/PlentyProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/QuipuswapProtocol.js +1 -1
- package/v1/protocol/fa/tokens/QuipuswapProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/SiriusProtocol.js +1 -1
- package/v1/protocol/fa/tokens/SiriusProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/StakerProtocol.js +1 -1
- package/v1/protocol/fa/tokens/StakerProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/TetherUSDProtocol.js +1 -1
- package/v1/protocol/fa/tokens/TetherUSDProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/TzBTCProtocol.js +1 -1
- package/v1/protocol/fa/tokens/TzBTCProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/UBTCProtocol.js +1 -1
- package/v1/protocol/fa/tokens/UBTCProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/UDEFIProtocol.js +1 -1
- package/v1/protocol/fa/tokens/UDEFIProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/USDTezProtocol.js +1 -1
- package/v1/protocol/fa/tokens/USDTezProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/UUSDProtocol.js +1 -1
- package/v1/protocol/fa/tokens/UUSDProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/WrapProtocol.js +1 -1
- package/v1/protocol/fa/tokens/WrapProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/WrappedTezosProtocol.js +1 -1
- package/v1/protocol/fa/tokens/WrappedTezosProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/YouProtocol.js +1 -1
- package/v1/protocol/fa/tokens/YouProtocol.js.map +1 -1
- package/v1/protocol/kt/TezosKtProtocol.js +14 -27
- package/v1/protocol/kt/TezosKtProtocol.js.map +1 -1
- package/v1/protocol/sapling/TezosSaplingProtocol.d.ts +13 -16
- package/v1/protocol/sapling/TezosSaplingProtocol.js +1 -12
- package/v1/protocol/sapling/TezosSaplingProtocol.js.map +1 -1
- package/v1/protocol/sapling/TezosShieldedTezProtocol.js +2 -2
- package/v1/protocol/sapling/TezosShieldedTezProtocol.js.map +1 -1
- package/v1/serializer/v3/serializer-companion.js +146 -42
- package/v1/serializer/v3/serializer-companion.js.map +1 -1
- package/v1/types/block-explorer.d.ts +6 -1
- package/v1/types/indexer.d.ts +6 -1
- package/v1/types/protocol.d.ts +5 -11
- package/v1/utils/pack.js +4 -3
- package/v1/utils/pack.js.map +1 -1
- package/v1/utils/protocol/tezos/TezosAccountant.d.ts +1 -2
- package/v1/utils/protocol/tezos/TezosAccountant.js.map +1 -1
- package/v1/domains/TezosDomains.d.ts +0 -20
- package/v1/domains/TezosDomains.js +0 -309
- package/v1/domains/TezosDomains.js.map +0 -1
- package/v1/types/domains/TezosDomainsRecord.d.ts +0 -8
- package/v1/types/domains/TezosDomainsRecord.js +0 -3
- package/v1/types/domains/TezosDomainsRecord.js.map +0 -1
- package/v1/types/domains/TezosDomainsReverseRecord.d.ts +0 -5
- package/v1/types/domains/TezosDomainsReverseRecord.js +0 -3
- package/v1/types/domains/TezosDomainsReverseRecord.js.map +0 -1
- package/v1/types/staking/BakerDetails.d.ts +0 -10
- package/v1/types/staking/BakerDetails.js +0 -3
- package/v1/types/staking/BakerDetails.js.map +0 -1
- package/v1/types/staking/TezosDelegatorAction.d.ts +0 -5
- package/v1/types/staking/TezosDelegatorAction.js +0 -10
- package/v1/types/staking/TezosDelegatorAction.js.map +0 -1
- package/v1/utils/protocol/instance.d.ts +0 -19
- package/v1/utils/protocol/instance.js +0 -49
- package/v1/utils/protocol/instance.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TezosModule.js","sourceRoot":"","sources":["../../../src/v1/module/TezosModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuG;AACvG,sDAAqE;AACrE,iDAW2B;AAE3B,qDAAoE;AACpE,
|
|
1
|
+
{"version":3,"file":"TezosModule.js","sourceRoot":"","sources":["../../../src/v1/module/TezosModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuG;AACvG,sDAAqE;AACrE,iDAW2B;AAE3B,qDAAoE;AACpE,uEAA2E;AAC3E,mEAAuE;AACvE,uEAA2E;AAC3E,uEAA2E;AAC3E,+EAAmF;AACnF,uEAA2E;AAC3E,6EAAiF;AACjF,uEAA2E;AAC3E,uEAA2E;AAC3E,qEAAyE;AACzE,mEAAuE;AACvE,qEAAyE;AACzE,uEAA2E;AAC3E,mEAAuE;AACvE,mFAAuF;AACvF,mEAAuE;AACvE,iEAAqE;AACrE,kEAAsE;AACtE,yFAA6F;AAC7F,2DAAgI;AAChI,8EAAkF;AAGlF;IAIE;;QACE,IAAM,oBAAoB,GAAsB;YAC9C,iCAAkB,CAAC,OAAO;YAC1B,iCAAkB,CAAC,OAAO;YAC1B,iCAAkB,CAAC,QAAQ;YAC3B,iCAAkB,CAAC,QAAQ;YAC3B,iCAAkB,CAAC,SAAS;YAC5B,iCAAkB,CAAC,QAAQ;YAC3B,iCAAkB,CAAC,OAAO;YAC1B,iCAAkB,CAAC,KAAK;YACxB,iCAAkB,CAAC,SAAS;YAC5B,iCAAkB,CAAC,QAAQ;YAC3B,iCAAkB,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,CAAA;YAC1C,KAAK,iCAAkB,CAAC,WAAW;gBACjC,OAAO,IAAA,qCAAoB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;YAC1C,KAAK,iCAAkB,CAAC,QAAQ;gBAC9B,OAAO,IAAA,qCAAoB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;YAC1C,KAAK,iCAAkB,CAAC,QAAQ;gBAC9B,OAAO,IAAA,qCAAoB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;YAC1C;gBACE,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,KAAK,EAAE,mBAAY,UAAU,oBAAiB,CAAC,CAAA;SAC3F;IACH,CAAC;IACH,kBAAC;AAAD,CAAC,AAxHD,IAwHC;AAxHY,kCAAW"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Address, AirGapProtocol, AirGapTransaction, AirGapTransactionsWithCursor, Amount, Balance, CryptoDerivative, FeeDefaults, KeyPair, ProtocolAccountMetadata, ProtocolMetadata, ProtocolUnitsMetadata, PublicKey, RecursivePartial, SecretKey, Signature, TransactionFullConfiguration, TransactionDetails, TransactionSimpleConfiguration } from '@airgap/module-kit';
|
|
3
|
-
import { AirGapDelegateProtocol } from '@airgap/module-kit/internal';
|
|
1
|
+
import { Address, AirGapProtocol, AirGapTransaction, AirGapTransactionsWithCursor, Amount, Balance, CryptoDerivative, FeeDefaults, KeyPair, ProtocolAccountMetadata, ProtocolMetadata, ProtocolUnitsMetadata, PublicKey, RecursivePartial, SecretKey, Signature, TransactionConfiguration, TransactionDetails } from '@airgap/module-kit';
|
|
4
2
|
import { TezosCryptoConfiguration } from '../types/crypto';
|
|
5
3
|
import { TezosOperation } from '../types/operations/kinds/TezosOperation';
|
|
6
4
|
import { TezosWrappedOperation } from '../types/operations/TezosWrappedOperation';
|
|
7
5
|
import { TezosProtocolNetwork, TezosProtocolOptions, TezosUnits } from '../types/protocol';
|
|
8
|
-
import { BakerDetails } from '../types/staking/BakerDetails';
|
|
9
6
|
import { TezosSignedTransaction, TezosTransactionCursor, TezosUnsignedTransaction } from '../types/transaction';
|
|
10
7
|
export interface TezosProtocol extends AirGapProtocol<{
|
|
11
8
|
AddressResult: Address;
|
|
@@ -16,24 +13,19 @@ export interface TezosProtocol extends AirGapProtocol<{
|
|
|
16
13
|
UnsignedTransaction: TezosUnsignedTransaction;
|
|
17
14
|
SignedTransaction: TezosSignedTransaction;
|
|
18
15
|
TransactionCursor: TezosTransactionCursor;
|
|
19
|
-
}, 'Crypto', 'FetchDataForAddress'
|
|
20
|
-
isTezosProtocol: true;
|
|
21
|
-
getMinCycleDuration(): Promise<number>;
|
|
22
|
-
getDetailsFromWrappedOperation(wrappedOperation: TezosWrappedOperation): Promise<AirGapTransaction<TezosUnits, TezosUnits>[]>;
|
|
16
|
+
}, 'Crypto', 'FetchDataForAddress'> {
|
|
23
17
|
forgeOperation(wrappedOperation: TezosWrappedOperation): Promise<string>;
|
|
24
18
|
unforgeOperation(forged: string, type?: (TezosSignedTransaction | TezosUnsignedTransaction)['type']): Promise<TezosWrappedOperation>;
|
|
25
19
|
getOperationFeeDefaults(publicKey: PublicKey, operations: TezosOperation[]): Promise<FeeDefaults<TezosUnits>>;
|
|
26
20
|
prepareOperations(publicKey: PublicKey, operationRequests: TezosOperation[], overrideParameters?: boolean): Promise<TezosWrappedOperation>;
|
|
27
|
-
prepareTransactionsWithPublicKey(publicKey: PublicKey, details: TransactionDetails<TezosUnits>[], configuration?:
|
|
21
|
+
prepareTransactionsWithPublicKey(publicKey: PublicKey, details: TransactionDetails<TezosUnits>[], configuration?: TransactionConfiguration<TezosUnits> & {
|
|
28
22
|
operationsPerGroup?: number;
|
|
29
23
|
}): Promise<TezosUnsignedTransaction[]>;
|
|
30
|
-
bakerDetails(address: string | undefined): Promise<BakerDetails>;
|
|
31
24
|
}
|
|
32
25
|
export declare const TEZOS_UNITS: ProtocolUnitsMetadata<TezosUnits>;
|
|
33
26
|
export declare const TEZOS_DERIVATION_PATH: string;
|
|
34
27
|
export declare const TEZOS_ACCOUNT_METADATA: ProtocolAccountMetadata;
|
|
35
28
|
export declare class TezosProtocolImpl implements TezosProtocol {
|
|
36
|
-
readonly isTezosProtocol: true;
|
|
37
29
|
private readonly options;
|
|
38
30
|
private readonly forger;
|
|
39
31
|
private readonly accountant;
|
|
@@ -61,37 +53,20 @@ export declare class TezosProtocolImpl implements TezosProtocol {
|
|
|
61
53
|
getTransactionsForAddress(address: string, limit: number, cursor?: TezosTransactionCursor): Promise<AirGapTransactionsWithCursor<TezosTransactionCursor, TezosUnits, TezosUnits>>;
|
|
62
54
|
getBalanceOfPublicKey(publicKey: PublicKey): Promise<Balance<TezosUnits>>;
|
|
63
55
|
getBalanceOfAddress(address: string): Promise<Balance<TezosUnits>>;
|
|
64
|
-
getTransactionMaxAmountWithPublicKey(publicKey: PublicKey, to: string[], configuration?:
|
|
56
|
+
getTransactionMaxAmountWithPublicKey(publicKey: PublicKey, to: string[], configuration?: TransactionConfiguration<TezosUnits>): Promise<Amount<TezosUnits>>;
|
|
65
57
|
private getTansactionMaxAmountWithBalance;
|
|
66
|
-
getTransactionFeeWithPublicKey(publicKey: PublicKey, details: TransactionDetails<TezosUnits>[]
|
|
58
|
+
getTransactionFeeWithPublicKey(publicKey: PublicKey, details: TransactionDetails<TezosUnits>[]): Promise<FeeDefaults<TezosUnits>>;
|
|
67
59
|
getOperationFeeDefaults(publicKey: PublicKey, operations: TezosOperation[]): Promise<FeeDefaults<TezosUnits>>;
|
|
68
|
-
prepareTransactionWithPublicKey(publicKey: PublicKey, details: TransactionDetails<TezosUnits>[], configuration?:
|
|
60
|
+
prepareTransactionWithPublicKey(publicKey: PublicKey, details: TransactionDetails<TezosUnits>[], configuration?: TransactionConfiguration<TezosUnits>): Promise<TezosUnsignedTransaction>;
|
|
69
61
|
broadcastTransaction(transaction: TezosSignedTransaction): Promise<string>;
|
|
70
|
-
getDefaultDelegatee(): Promise<string>;
|
|
71
|
-
getCurrentDelegateesForPublicKey(publicKey: PublicKey): Promise<string[]>;
|
|
72
|
-
getCurrentDelegateesForAddress(address: string): Promise<string[]>;
|
|
73
|
-
getDelegateeDetails(address: string): Promise<DelegateeDetails>;
|
|
74
|
-
isPublicKeyDelegating(publicKey: PublicKey): Promise<boolean>;
|
|
75
|
-
isAddressDelegating(address: string): Promise<boolean>;
|
|
76
|
-
getDelegatorDetailsFromPublicKey(publicKey: PublicKey): Promise<DelegatorDetails>;
|
|
77
|
-
getDelegatorDetailsFromAddress(address: string): Promise<DelegatorDetails>;
|
|
78
|
-
getDelegationDetailsFromPublicKey(publicKey: PublicKey, delegatees: string[]): Promise<DelegationDetails>;
|
|
79
|
-
getDelegationDetailsFromAddress(address: string, delegatees: string[]): Promise<DelegationDetails>;
|
|
80
|
-
private getDelegatorDetails;
|
|
81
|
-
prepareDelegatorActionFromPublicKey(publicKey: PublicKey, type: any, data?: any): Promise<any[]>;
|
|
82
|
-
undelegate(publicKey: PublicKey): Promise<TezosUnsignedTransaction>;
|
|
83
|
-
delegate(publicKey: PublicKey, delegate?: string | string[]): Promise<TezosUnsignedTransaction>;
|
|
84
|
-
getMinCycleDuration(): Promise<number>;
|
|
85
|
-
getDetailsFromWrappedOperation(wrappedOperation: TezosWrappedOperation): Promise<AirGapTransaction<TezosUnits, TezosUnits>[]>;
|
|
86
62
|
forgeOperation(wrappedOperation: TezosWrappedOperation): Promise<string>;
|
|
87
63
|
unforgeOperation(forged: string, type?: (TezosSignedTransaction | TezosUnsignedTransaction)['type']): Promise<TezosWrappedOperation>;
|
|
88
|
-
prepareTransactionsWithPublicKey(publicKey: PublicKey, details: TransactionDetails<TezosUnits>[], configuration?:
|
|
64
|
+
prepareTransactionsWithPublicKey(publicKey: PublicKey, details: TransactionDetails<TezosUnits>[], configuration?: TransactionConfiguration<TezosUnits> & {
|
|
89
65
|
operationsPerGroup?: number;
|
|
90
66
|
}): Promise<TezosUnsignedTransaction[]>;
|
|
91
67
|
prepareOperations(publicKey: PublicKey, operationRequests: TezosOperation[], overrideParameters?: boolean): Promise<TezosWrappedOperation>;
|
|
92
68
|
private estimateAndReplaceLimitsAndFee;
|
|
93
69
|
private createTransactionOperations;
|
|
94
|
-
bakerDetails(address: string | undefined): Promise<BakerDetails>;
|
|
95
70
|
}
|
|
96
71
|
export declare function createTezosProtocol(options?: RecursivePartial<TezosProtocolOptions>): TezosProtocol;
|
|
97
72
|
export declare const TEZOS_MAINNET_PROTOCOL_NETWORK: TezosProtocolNetwork;
|
|
@@ -61,7 +61,6 @@ var TezosAddress_1 = require("../data/TezosAddress");
|
|
|
61
61
|
var factory_1 = require("../indexer/factory");
|
|
62
62
|
var network_1 = require("../types/network");
|
|
63
63
|
var TezosOperationType_1 = require("../types/operations/TezosOperationType");
|
|
64
|
-
var TezosDelegatorAction_1 = require("../types/staking/TezosDelegatorAction");
|
|
65
64
|
var key_1 = require("../utils/key");
|
|
66
65
|
var operations_1 = require("../utils/operations");
|
|
67
66
|
var TezosAccountant_1 = require("../utils/protocol/tezos/TezosAccountant");
|
|
@@ -70,14 +69,12 @@ var signature_1 = require("../utils/signature");
|
|
|
70
69
|
// Implementation
|
|
71
70
|
var MAX_OPERATIONS_PER_GROUP = 200;
|
|
72
71
|
var MAX_GAS_PER_BLOCK = 5200000;
|
|
73
|
-
var MIN_CYCLE_DURATION = 4096 * 60 * 1000; // ms
|
|
74
72
|
var GAS_LIMIT_PLACEHOLDER = '1040000';
|
|
75
73
|
var STORAGE_LIMIT_PLACEHOLDER = '60000';
|
|
76
74
|
var FEE_PLACEHOLDER = '0';
|
|
77
75
|
var MINIMAL_FEE = 100;
|
|
78
76
|
var MINIMAL_FEE_PER_GAS_UNIT = 0.1;
|
|
79
77
|
var MINIMAL_FEE_PER_BYTE = 1;
|
|
80
|
-
var SELF_BOND_REQUIREMENT = 0.0825; // 8.25%
|
|
81
78
|
exports.TEZOS_UNITS = {
|
|
82
79
|
tez: {
|
|
83
80
|
symbol: { value: 'XTZ', market: 'xtz' },
|
|
@@ -103,7 +100,6 @@ exports.TEZOS_ACCOUNT_METADATA = {
|
|
|
103
100
|
};
|
|
104
101
|
var TezosProtocolImpl = /** @class */ (function () {
|
|
105
102
|
function TezosProtocolImpl(options) {
|
|
106
|
-
this.isTezosProtocol = true;
|
|
107
103
|
// Common
|
|
108
104
|
this.units = exports.TEZOS_UNITS;
|
|
109
105
|
this.feeDefaults = {
|
|
@@ -128,7 +124,7 @@ var TezosProtocolImpl = /** @class */ (function () {
|
|
|
128
124
|
this.options = createTezosProtocolOptions(options.network);
|
|
129
125
|
this.forger = new TezosForger_1.TezosForger();
|
|
130
126
|
this.accountant = new TezosAccountant_1.TezosAccountant(this.forger, this.options.network);
|
|
131
|
-
this.indexerClient = (0, factory_1.createTezosIndexerClient)(this.options.network.
|
|
127
|
+
this.indexerClient = (0, factory_1.createTezosIndexerClient)(this.options.network.indexer);
|
|
132
128
|
this.cryptoClient = new TezosCryptoClient_1.TezosCryptoClient();
|
|
133
129
|
}
|
|
134
130
|
TezosProtocolImpl.prototype.getMetadata = function () {
|
|
@@ -388,7 +384,7 @@ var TezosProtocolImpl = /** @class */ (function () {
|
|
|
388
384
|
});
|
|
389
385
|
});
|
|
390
386
|
};
|
|
391
|
-
TezosProtocolImpl.prototype.getTransactionFeeWithPublicKey = function (publicKey, details
|
|
387
|
+
TezosProtocolImpl.prototype.getTransactionFeeWithPublicKey = function (publicKey, details) {
|
|
392
388
|
return __awaiter(this, void 0, void 0, function () {
|
|
393
389
|
var operations, i, recipient, transaction;
|
|
394
390
|
return __generator(this, function (_a) {
|
|
@@ -486,298 +482,7 @@ var TezosProtocolImpl = /** @class */ (function () {
|
|
|
486
482
|
});
|
|
487
483
|
});
|
|
488
484
|
};
|
|
489
|
-
// Staking
|
|
490
|
-
TezosProtocolImpl.prototype.getDefaultDelegatee = function () {
|
|
491
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
492
|
-
var activeBakers;
|
|
493
|
-
return __generator(this, function (_a) {
|
|
494
|
-
switch (_a.label) {
|
|
495
|
-
case 0: return [4 /*yield*/, index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/delegates?active"))];
|
|
496
|
-
case 1:
|
|
497
|
-
activeBakers = (_a.sent()).data;
|
|
498
|
-
return [2 /*return*/, activeBakers[0] || ''];
|
|
499
|
-
}
|
|
500
|
-
});
|
|
501
|
-
});
|
|
502
|
-
};
|
|
503
|
-
TezosProtocolImpl.prototype.getCurrentDelegateesForPublicKey = function (publicKey) {
|
|
504
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
505
|
-
var address;
|
|
506
|
-
return __generator(this, function (_a) {
|
|
507
|
-
switch (_a.label) {
|
|
508
|
-
case 0: return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
|
|
509
|
-
case 1:
|
|
510
|
-
address = _a.sent();
|
|
511
|
-
return [2 /*return*/, this.getCurrentDelegateesForAddress(address)];
|
|
512
|
-
}
|
|
513
|
-
});
|
|
514
|
-
});
|
|
515
|
-
};
|
|
516
|
-
TezosProtocolImpl.prototype.getCurrentDelegateesForAddress = function (address) {
|
|
517
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
518
|
-
var data;
|
|
519
|
-
return __generator(this, function (_a) {
|
|
520
|
-
switch (_a.label) {
|
|
521
|
-
case 0: return [4 /*yield*/, index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/contracts/").concat(address))];
|
|
522
|
-
case 1:
|
|
523
|
-
data = (_a.sent()).data;
|
|
524
|
-
return [2 /*return*/, data.delegate ? [data.delegate] : []];
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
});
|
|
528
|
-
};
|
|
529
|
-
TezosProtocolImpl.prototype.getDelegateeDetails = function (address) {
|
|
530
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
531
|
-
var response, isBakingActive;
|
|
532
|
-
return __generator(this, function (_a) {
|
|
533
|
-
switch (_a.label) {
|
|
534
|
-
case 0: return [4 /*yield*/, index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/delegates/").concat(address, "/deactivated"))];
|
|
535
|
-
case 1:
|
|
536
|
-
response = _a.sent();
|
|
537
|
-
isBakingActive = !response.data;
|
|
538
|
-
return [2 /*return*/, {
|
|
539
|
-
status: isBakingActive ? 'Active' : 'Inactive',
|
|
540
|
-
address: address
|
|
541
|
-
}];
|
|
542
|
-
}
|
|
543
|
-
});
|
|
544
|
-
});
|
|
545
|
-
};
|
|
546
|
-
TezosProtocolImpl.prototype.isPublicKeyDelegating = function (publicKey) {
|
|
547
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
548
|
-
var address;
|
|
549
|
-
return __generator(this, function (_a) {
|
|
550
|
-
switch (_a.label) {
|
|
551
|
-
case 0: return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
|
|
552
|
-
case 1:
|
|
553
|
-
address = _a.sent();
|
|
554
|
-
return [2 /*return*/, this.isAddressDelegating(address)];
|
|
555
|
-
}
|
|
556
|
-
});
|
|
557
|
-
});
|
|
558
|
-
};
|
|
559
|
-
TezosProtocolImpl.prototype.isAddressDelegating = function (address) {
|
|
560
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
561
|
-
var data;
|
|
562
|
-
return __generator(this, function (_a) {
|
|
563
|
-
switch (_a.label) {
|
|
564
|
-
case 0: return [4 /*yield*/, index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/contracts/").concat(address))];
|
|
565
|
-
case 1:
|
|
566
|
-
data = (_a.sent()).data;
|
|
567
|
-
return [2 /*return*/, !!data.delegate];
|
|
568
|
-
}
|
|
569
|
-
});
|
|
570
|
-
});
|
|
571
|
-
};
|
|
572
|
-
TezosProtocolImpl.prototype.getDelegatorDetailsFromPublicKey = function (publicKey) {
|
|
573
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
574
|
-
var address;
|
|
575
|
-
return __generator(this, function (_a) {
|
|
576
|
-
switch (_a.label) {
|
|
577
|
-
case 0: return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
|
|
578
|
-
case 1:
|
|
579
|
-
address = _a.sent();
|
|
580
|
-
return [2 /*return*/, this.getDelegatorDetailsFromAddress(address)];
|
|
581
|
-
}
|
|
582
|
-
});
|
|
583
|
-
});
|
|
584
|
-
};
|
|
585
|
-
TezosProtocolImpl.prototype.getDelegatorDetailsFromAddress = function (address) {
|
|
586
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
587
|
-
return __generator(this, function (_a) {
|
|
588
|
-
return [2 /*return*/, this.getDelegatorDetails(address)];
|
|
589
|
-
});
|
|
590
|
-
});
|
|
591
|
-
};
|
|
592
|
-
TezosProtocolImpl.prototype.getDelegationDetailsFromPublicKey = function (publicKey, delegatees) {
|
|
593
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
594
|
-
var address;
|
|
595
|
-
return __generator(this, function (_a) {
|
|
596
|
-
switch (_a.label) {
|
|
597
|
-
case 0: return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
|
|
598
|
-
case 1:
|
|
599
|
-
address = _a.sent();
|
|
600
|
-
return [2 /*return*/, this.getDelegationDetailsFromAddress(address, delegatees)];
|
|
601
|
-
}
|
|
602
|
-
});
|
|
603
|
-
});
|
|
604
|
-
};
|
|
605
|
-
TezosProtocolImpl.prototype.getDelegationDetailsFromAddress = function (address, delegatees) {
|
|
606
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
607
|
-
var bakerAddress, results, delegatorDetails, bakerDetails;
|
|
608
|
-
return __generator(this, function (_a) {
|
|
609
|
-
switch (_a.label) {
|
|
610
|
-
case 0:
|
|
611
|
-
if (delegatees.length > 1) {
|
|
612
|
-
return [2 /*return*/, Promise.reject('Multiple delegation is not supported.')];
|
|
613
|
-
}
|
|
614
|
-
bakerAddress = delegatees[0];
|
|
615
|
-
return [4 /*yield*/, Promise.all([this.getDelegatorDetails(address, bakerAddress), this.getDelegateeDetails(bakerAddress)])];
|
|
616
|
-
case 1:
|
|
617
|
-
results = _a.sent();
|
|
618
|
-
delegatorDetails = results[0];
|
|
619
|
-
bakerDetails = results[1];
|
|
620
|
-
return [2 /*return*/, {
|
|
621
|
-
delegator: delegatorDetails,
|
|
622
|
-
delegatees: [bakerDetails]
|
|
623
|
-
}];
|
|
624
|
-
}
|
|
625
|
-
});
|
|
626
|
-
});
|
|
627
|
-
};
|
|
628
|
-
TezosProtocolImpl.prototype.getDelegatorDetails = function (address, bakerAddress) {
|
|
629
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
630
|
-
var results, accountDetails, balance, isDelegating, availableActions;
|
|
631
|
-
return __generator(this, function (_a) {
|
|
632
|
-
switch (_a.label) {
|
|
633
|
-
case 0: return [4 /*yield*/, Promise.all([index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/contracts/").concat(address))])];
|
|
634
|
-
case 1:
|
|
635
|
-
results = _a.sent();
|
|
636
|
-
accountDetails = results[0].data;
|
|
637
|
-
balance = accountDetails.balance;
|
|
638
|
-
isDelegating = !!accountDetails.delegate;
|
|
639
|
-
availableActions = [];
|
|
640
|
-
if (!isDelegating) {
|
|
641
|
-
availableActions.push({
|
|
642
|
-
type: TezosDelegatorAction_1.TezosDelegatorAction.DELEGATE,
|
|
643
|
-
args: ['delegate']
|
|
644
|
-
});
|
|
645
|
-
}
|
|
646
|
-
else if (!bakerAddress || accountDetails.delegate === bakerAddress) {
|
|
647
|
-
availableActions.push({
|
|
648
|
-
type: TezosDelegatorAction_1.TezosDelegatorAction.UNDELEGATE
|
|
649
|
-
});
|
|
650
|
-
}
|
|
651
|
-
else {
|
|
652
|
-
availableActions.push({
|
|
653
|
-
type: TezosDelegatorAction_1.TezosDelegatorAction.CHANGE_BAKER,
|
|
654
|
-
args: ['delegate']
|
|
655
|
-
});
|
|
656
|
-
}
|
|
657
|
-
return [2 /*return*/, {
|
|
658
|
-
address: address,
|
|
659
|
-
balance: balance,
|
|
660
|
-
delegatees: [accountDetails.delegate],
|
|
661
|
-
availableActions: availableActions
|
|
662
|
-
}];
|
|
663
|
-
}
|
|
664
|
-
});
|
|
665
|
-
});
|
|
666
|
-
};
|
|
667
|
-
TezosProtocolImpl.prototype.prepareDelegatorActionFromPublicKey = function (publicKey, type, data) {
|
|
668
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
669
|
-
var _a;
|
|
670
|
-
return __generator(this, function (_b) {
|
|
671
|
-
switch (_b.label) {
|
|
672
|
-
case 0:
|
|
673
|
-
_a = type;
|
|
674
|
-
switch (_a) {
|
|
675
|
-
case TezosDelegatorAction_1.TezosDelegatorAction.DELEGATE: return [3 /*break*/, 1];
|
|
676
|
-
case TezosDelegatorAction_1.TezosDelegatorAction.CHANGE_BAKER: return [3 /*break*/, 1];
|
|
677
|
-
case TezosDelegatorAction_1.TezosDelegatorAction.UNDELEGATE: return [3 /*break*/, 3];
|
|
678
|
-
}
|
|
679
|
-
return [3 /*break*/, 5];
|
|
680
|
-
case 1:
|
|
681
|
-
if (!data || !data.delegate) {
|
|
682
|
-
return [2 /*return*/, Promise.reject("Invalid arguments passed for ".concat(type, " action, delegate is missing."))];
|
|
683
|
-
}
|
|
684
|
-
return [4 /*yield*/, this.delegate(publicKey, data.delegate)];
|
|
685
|
-
case 2: return [2 /*return*/, [_b.sent()]];
|
|
686
|
-
case 3: return [4 /*yield*/, this.undelegate(publicKey)];
|
|
687
|
-
case 4: return [2 /*return*/, [_b.sent()]];
|
|
688
|
-
case 5: return [2 /*return*/, Promise.reject('Unsupported delegator action.')];
|
|
689
|
-
}
|
|
690
|
-
});
|
|
691
|
-
});
|
|
692
|
-
};
|
|
693
|
-
TezosProtocolImpl.prototype.undelegate = function (publicKey) {
|
|
694
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
695
|
-
return __generator(this, function (_a) {
|
|
696
|
-
return [2 /*return*/, this.delegate(publicKey)];
|
|
697
|
-
});
|
|
698
|
-
});
|
|
699
|
-
};
|
|
700
|
-
TezosProtocolImpl.prototype.delegate = function (publicKey, delegate) {
|
|
701
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
702
|
-
var counter, branch, operations, tzAddress, results, accountManager, balance, totalBalance, fee, delegationOperation, tezosWrappedOperation, binary, error_3;
|
|
703
|
-
return __generator(this, function (_a) {
|
|
704
|
-
switch (_a.label) {
|
|
705
|
-
case 0:
|
|
706
|
-
counter = new bignumber_1.default(1);
|
|
707
|
-
branch = '';
|
|
708
|
-
operations = [];
|
|
709
|
-
return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
|
|
710
|
-
case 1:
|
|
711
|
-
tzAddress = _a.sent();
|
|
712
|
-
return [4 /*yield*/, Promise.all([
|
|
713
|
-
index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/contracts/").concat(tzAddress, "/counter")),
|
|
714
|
-
index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head~2/hash")),
|
|
715
|
-
index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/contracts/").concat(tzAddress, "/manager_key"))
|
|
716
|
-
]).catch(function (error) {
|
|
717
|
-
throw new errors_1.NetworkError(coinlib_core_1.Domain.TEZOS, error);
|
|
718
|
-
})];
|
|
719
|
-
case 2:
|
|
720
|
-
results = _a.sent();
|
|
721
|
-
counter = new bignumber_1.default(results[0].data).plus(1);
|
|
722
|
-
branch = results[1].data;
|
|
723
|
-
accountManager = results[2].data;
|
|
724
|
-
// check if we have revealed the address already
|
|
725
|
-
if (!accountManager) {
|
|
726
|
-
operations.push((0, operations_1.createRevealOperation)(counter, publicKey, tzAddress));
|
|
727
|
-
counter = counter.plus(1);
|
|
728
|
-
}
|
|
729
|
-
return [4 /*yield*/, this.getBalanceOfAddress(tzAddress)];
|
|
730
|
-
case 3:
|
|
731
|
-
balance = _a.sent();
|
|
732
|
-
totalBalance = new bignumber_1.default((0, module_kit_1.newAmount)(balance.total).blockchain(this.units).value);
|
|
733
|
-
fee = new bignumber_1.default(1420);
|
|
734
|
-
if (totalBalance.isLessThan(fee)) {
|
|
735
|
-
throw new errors_1.BalanceError(coinlib_core_1.Domain.TEZOS, 'not enough balance');
|
|
736
|
-
}
|
|
737
|
-
delegationOperation = {
|
|
738
|
-
kind: TezosOperationType_1.TezosOperationType.DELEGATION,
|
|
739
|
-
source: tzAddress,
|
|
740
|
-
fee: fee.toFixed(),
|
|
741
|
-
counter: counter.toFixed(),
|
|
742
|
-
gas_limit: '10000',
|
|
743
|
-
storage_limit: '0',
|
|
744
|
-
delegate: Array.isArray(delegate) ? delegate[0] : delegate
|
|
745
|
-
};
|
|
746
|
-
operations.push(delegationOperation);
|
|
747
|
-
_a.label = 4;
|
|
748
|
-
case 4:
|
|
749
|
-
_a.trys.push([4, 6, , 7]);
|
|
750
|
-
tezosWrappedOperation = {
|
|
751
|
-
branch: branch,
|
|
752
|
-
contents: operations
|
|
753
|
-
};
|
|
754
|
-
return [4 /*yield*/, this.forgeOperation(tezosWrappedOperation)];
|
|
755
|
-
case 5:
|
|
756
|
-
binary = _a.sent();
|
|
757
|
-
return [2 /*return*/, (0, module_kit_1.newUnsignedTransaction)({ binary: binary })];
|
|
758
|
-
case 6:
|
|
759
|
-
error_3 = _a.sent();
|
|
760
|
-
throw new errors_1.OperationFailedError(coinlib_core_1.Domain.TEZOS, "Forging Tezos TX failed with ".concat(JSON.stringify(error_3.message)));
|
|
761
|
-
case 7: return [2 /*return*/];
|
|
762
|
-
}
|
|
763
|
-
});
|
|
764
|
-
});
|
|
765
|
-
};
|
|
766
485
|
// Custom
|
|
767
|
-
TezosProtocolImpl.prototype.getMinCycleDuration = function () {
|
|
768
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
769
|
-
return __generator(this, function (_a) {
|
|
770
|
-
return [2 /*return*/, MIN_CYCLE_DURATION];
|
|
771
|
-
});
|
|
772
|
-
});
|
|
773
|
-
};
|
|
774
|
-
TezosProtocolImpl.prototype.getDetailsFromWrappedOperation = function (wrappedOperation) {
|
|
775
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
776
|
-
return __generator(this, function (_a) {
|
|
777
|
-
return [2 /*return*/, this.accountant.getDetailsFromWrappedOperation(wrappedOperation)];
|
|
778
|
-
});
|
|
779
|
-
});
|
|
780
|
-
};
|
|
781
486
|
TezosProtocolImpl.prototype.forgeOperation = function (wrappedOperation) {
|
|
782
487
|
return __awaiter(this, void 0, void 0, function () {
|
|
783
488
|
return __generator(this, function (_a) {
|
|
@@ -1195,50 +900,6 @@ var TezosProtocolImpl = /** @class */ (function () {
|
|
|
1195
900
|
});
|
|
1196
901
|
});
|
|
1197
902
|
};
|
|
1198
|
-
TezosProtocolImpl.prototype.bakerDetails = function (address) {
|
|
1199
|
-
var _a, _b, _c, _d;
|
|
1200
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1201
|
-
var results, tzBalance, delegatedBalance, stakingBalance, selfBond, stakingCapacity, bakerDetails;
|
|
1202
|
-
return __generator(this, function (_e) {
|
|
1203
|
-
switch (_e.label) {
|
|
1204
|
-
case 0:
|
|
1205
|
-
if (!address ||
|
|
1206
|
-
!(address.toLowerCase().startsWith('tz1') ||
|
|
1207
|
-
address.toLowerCase().startsWith('tz2') ||
|
|
1208
|
-
address.toLowerCase().startsWith('tz3') ||
|
|
1209
|
-
address.toLowerCase().startsWith('tz4'))) {
|
|
1210
|
-
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.TEZOS, 'non tz-address supplied');
|
|
1211
|
-
}
|
|
1212
|
-
return [4 /*yield*/, Promise.all([
|
|
1213
|
-
index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/delegates/").concat(address, "/balance")).catch(function (_error) { return undefined; }),
|
|
1214
|
-
index_1.default
|
|
1215
|
-
.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/delegates/").concat(address, "/full_balance"))
|
|
1216
|
-
.catch(function (_error) { return undefined; }),
|
|
1217
|
-
index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/delegates/").concat(address, "/delegated_balance")),
|
|
1218
|
-
index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/delegates/").concat(address, "/staking_balance"))
|
|
1219
|
-
]).catch(function (error) {
|
|
1220
|
-
throw new errors_1.NetworkError(coinlib_core_1.Domain.TEZOS, error);
|
|
1221
|
-
})];
|
|
1222
|
-
case 1:
|
|
1223
|
-
results = _e.sent();
|
|
1224
|
-
tzBalance = new bignumber_1.default((_b = ((_a = results[0]) !== null && _a !== void 0 ? _a : results[1])) === null || _b === void 0 ? void 0 : _b.data);
|
|
1225
|
-
delegatedBalance = new bignumber_1.default((_c = results[2]) === null || _c === void 0 ? void 0 : _c.data);
|
|
1226
|
-
stakingBalance = new bignumber_1.default((_d = results[3]) === null || _d === void 0 ? void 0 : _d.data);
|
|
1227
|
-
selfBond = stakingBalance.minus(delegatedBalance);
|
|
1228
|
-
stakingCapacity = stakingBalance.div(selfBond.div(SELF_BOND_REQUIREMENT));
|
|
1229
|
-
bakerDetails = {
|
|
1230
|
-
balance: (0, module_kit_1.newAmount)(tzBalance, 'blockchain'),
|
|
1231
|
-
delegatedBalance: (0, module_kit_1.newAmount)(delegatedBalance, 'blockchain'),
|
|
1232
|
-
stakingBalance: (0, module_kit_1.newAmount)(stakingBalance, 'blockchain'),
|
|
1233
|
-
selfBond: (0, module_kit_1.newAmount)(selfBond, 'blockchain'),
|
|
1234
|
-
bakerCapacity: stakingBalance.div(stakingCapacity).toString(),
|
|
1235
|
-
bakerUsage: stakingCapacity.toString()
|
|
1236
|
-
};
|
|
1237
|
-
return [2 /*return*/, bakerDetails];
|
|
1238
|
-
}
|
|
1239
|
-
});
|
|
1240
|
-
});
|
|
1241
|
-
};
|
|
1242
903
|
return TezosProtocolImpl;
|
|
1243
904
|
}());
|
|
1244
905
|
exports.TezosProtocolImpl = TezosProtocolImpl;
|
|
@@ -1253,26 +914,34 @@ exports.TEZOS_MAINNET_PROTOCOL_NETWORK = {
|
|
|
1253
914
|
type: 'mainnet',
|
|
1254
915
|
rpcUrl: 'https://tezos-node.prod.gke.papers.tech',
|
|
1255
916
|
network: network_1.TezosNetwork.MAINNET,
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
917
|
+
blockExplorer: {
|
|
918
|
+
type: 'tzkt',
|
|
919
|
+
url: 'https://tzkt.io'
|
|
920
|
+
},
|
|
921
|
+
indexer: {
|
|
922
|
+
type: 'tzkt',
|
|
923
|
+
apiUrl: 'https://tezos-mainnet-indexer.prod.gke.papers.tech'
|
|
924
|
+
}
|
|
1260
925
|
};
|
|
1261
926
|
exports.TEZOS_GHOSTNET_PROTOCOL_NETWORK = {
|
|
1262
927
|
name: 'Ghostnet',
|
|
1263
928
|
type: 'testnet',
|
|
1264
929
|
rpcUrl: 'https://tezos-ghostnet-node.prod.gke.papers.tech',
|
|
1265
930
|
network: network_1.TezosNetwork.GHOSTNET,
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
931
|
+
blockExplorer: {
|
|
932
|
+
type: 'tzkt',
|
|
933
|
+
url: 'https://ghostnet.tzkt.io'
|
|
934
|
+
},
|
|
935
|
+
indexer: {
|
|
936
|
+
type: 'tzkt',
|
|
937
|
+
apiUrl: 'https://tezos-ghostnet-indexer.prod.gke.papers.tech'
|
|
938
|
+
}
|
|
1270
939
|
};
|
|
1271
940
|
var DEFAULT_TEZOS_PROTOCOL_NETWORK = exports.TEZOS_MAINNET_PROTOCOL_NETWORK;
|
|
1272
941
|
function createTezosProtocolOptions(network) {
|
|
1273
942
|
if (network === void 0) { network = {}; }
|
|
1274
943
|
return {
|
|
1275
|
-
network: __assign(__assign({}, DEFAULT_TEZOS_PROTOCOL_NETWORK), network)
|
|
944
|
+
network: __assign(__assign(__assign({}, DEFAULT_TEZOS_PROTOCOL_NETWORK), network), { blockExplorer: __assign(__assign({}, DEFAULT_TEZOS_PROTOCOL_NETWORK.blockExplorer), network.blockExplorer), indexer: __assign(__assign({}, DEFAULT_TEZOS_PROTOCOL_NETWORK.indexer), network.indexer) })
|
|
1276
945
|
};
|
|
1277
946
|
}
|
|
1278
947
|
exports.createTezosProtocolOptions = createTezosProtocolOptions;
|