@taquito/taquito 24.2.0 → 24.3.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/lib/batch/rpc-batch-provider.js +91 -83
- package/dist/lib/context.js +22 -26
- package/dist/lib/contract/big-map.js +16 -29
- package/dist/lib/contract/contract-methods/contract-method-object-param.js +7 -7
- package/dist/lib/contract/contract-methods/contract-on-chain-view.js +31 -44
- package/dist/lib/contract/contract.js +21 -32
- package/dist/lib/contract/errors.js +9 -9
- package/dist/lib/contract/prepare.js +36 -45
- package/dist/lib/contract/rpc-contract-provider.js +426 -475
- package/dist/lib/contract/sapling-state-abstraction.js +3 -14
- package/dist/lib/contract/semantic.js +2 -2
- package/dist/lib/errors.js +3 -3
- package/dist/lib/estimate/errors.js +1 -1
- package/dist/lib/estimate/estimate.js +66 -20
- package/dist/lib/estimate/rpc-estimate-provider.js +427 -460
- package/dist/lib/forger/composite-forger.js +16 -27
- package/dist/lib/forger/errors.js +2 -2
- package/dist/lib/forger/taquito-local-forger.js +9 -22
- package/dist/lib/global-constants/default-global-constants-provider.js +8 -19
- package/dist/lib/global-constants/errors.js +2 -2
- package/dist/lib/global-constants/noop-global-constants-provider.js +2 -13
- package/dist/lib/import-key.js +23 -34
- package/dist/lib/injector/rpc-injector.js +13 -24
- package/dist/lib/operations/ballot-operation.js +2 -3
- package/dist/lib/operations/delegate-operation.js +5 -8
- package/dist/lib/operations/drain-delegate-operation.js +1 -1
- package/dist/lib/operations/errors.js +9 -6
- package/dist/lib/operations/increase-paid-storage-operation.js +4 -7
- package/dist/lib/operations/operations.js +100 -30
- package/dist/lib/operations/origination-operation.js +16 -27
- package/dist/lib/operations/proposals-operation.js +2 -3
- package/dist/lib/operations/register-global-constant-operation.js +4 -7
- package/dist/lib/operations/reveal-operation.js +1 -1
- package/dist/lib/operations/smart-rollup-add-messages-operation.js +4 -7
- package/dist/lib/operations/smart-rollup-execute-outbox-message-operation.js +4 -7
- package/dist/lib/operations/smart-rollup-originate-operation.js +4 -7
- package/dist/lib/operations/transaction-operation.js +2 -2
- package/dist/lib/operations/transfer-ticket-operation.js +4 -6
- package/dist/lib/operations/types.js +17 -19
- package/dist/lib/operations/update-companion-key-operation.js +4 -7
- package/dist/lib/operations/update-consensus-key-operation.js +4 -7
- package/dist/lib/packer/michel-codec-packer.js +3 -14
- package/dist/lib/packer/rpc-packer.js +2 -13
- package/dist/lib/parser/michel-codec-parser.js +82 -107
- package/dist/lib/parser/noop-parser.js +2 -13
- package/dist/lib/prepare/prepare-provider.js +780 -744
- package/dist/lib/provider.js +322 -128
- package/dist/lib/read-provider/rpc-read-adapter.js +76 -121
- package/dist/lib/signer/errors.js +1 -1
- package/dist/lib/signer/noop.js +9 -26
- package/dist/lib/subscribe/errors.js +2 -2
- package/dist/lib/subscribe/polling-subcribe-provider.js +35 -38
- package/dist/lib/taquito.js +33 -33
- package/dist/lib/tz/rpc-tz-provider.js +27 -44
- package/dist/lib/version.js +2 -2
- package/dist/lib/wallet/batch-operation.js +32 -45
- package/dist/lib/wallet/delegation-operation.js +25 -40
- package/dist/lib/wallet/errors.js +15 -3
- package/dist/lib/wallet/increase-paid-storage-operation.js +25 -40
- package/dist/lib/wallet/legacy.js +28 -63
- package/dist/lib/wallet/operation-factory.js +27 -56
- package/dist/lib/wallet/operation.js +123 -59
- package/dist/lib/wallet/origination-operation.js +34 -46
- package/dist/lib/wallet/register-global-constant-operation.js +26 -43
- package/dist/lib/wallet/transaction-operation.js +21 -36
- package/dist/lib/wallet/transfer-ticket-operation.js +21 -36
- package/dist/lib/wallet/wallet.js +187 -184
- package/dist/taquito.es6.js +3424 -3197
- package/dist/taquito.es6.js.map +1 -1
- package/dist/taquito.min.js +1 -1
- package/dist/taquito.umd.js +7930 -7701
- package/dist/taquito.umd.js.map +1 -1
- package/dist/types/batch/rpc-batch-provider.d.ts +18 -18
- package/dist/types/context.d.ts +4 -4
- package/dist/types/contract/big-map.d.ts +3 -3
- package/dist/types/contract/contract-methods/contract-method-interface.d.ts +4 -4
- package/dist/types/contract/contract-methods/contract-method-object-param.d.ts +6 -6
- package/dist/types/contract/contract-methods/contract-on-chain-view.d.ts +3 -3
- package/dist/types/contract/contract.d.ts +6 -6
- package/dist/types/contract/errors.d.ts +11 -11
- package/dist/types/contract/interface.d.ts +42 -42
- package/dist/types/contract/rpc-contract-provider.d.ts +44 -43
- package/dist/types/contract/sapling-state-abstraction.d.ts +1 -1
- package/dist/types/contract/semantic.d.ts +2 -2
- package/dist/types/errors.d.ts +5 -5
- package/dist/types/estimate/errors.d.ts +1 -1
- package/dist/types/estimate/estimate-provider-interface.d.ts +81 -84
- package/dist/types/estimate/estimate.d.ts +28 -11
- package/dist/types/estimate/rpc-estimate-provider.d.ts +34 -30
- package/dist/types/forger/errors.d.ts +2 -2
- package/dist/types/global-constants/default-global-constants-provider.d.ts +2 -2
- package/dist/types/global-constants/errors.d.ts +2 -2
- package/dist/types/global-constants/interface-global-constants-provider.d.ts +1 -1
- package/dist/types/import-key.d.ts +2 -2
- package/dist/types/operations/ballot-operation.d.ts +1 -1
- package/dist/types/operations/delegate-operation.d.ts +2 -2
- package/dist/types/operations/drain-delegate-operation.d.ts +1 -1
- package/dist/types/operations/errors.d.ts +5 -5
- package/dist/types/operations/failing-noop-operation.d.ts +1 -1
- package/dist/types/operations/increase-paid-storage-operation.d.ts +1 -1
- package/dist/types/operations/operations.d.ts +2 -2
- package/dist/types/operations/origination-operation.d.ts +5 -5
- package/dist/types/operations/proposals-operation.d.ts +1 -1
- package/dist/types/operations/register-global-constant-operation.d.ts +2 -2
- package/dist/types/operations/reveal-operation.d.ts +1 -1
- package/dist/types/operations/smart-rollup-add-messages-operation.d.ts +1 -1
- package/dist/types/operations/smart-rollup-execute-outbox-message-operation.d.ts +1 -1
- package/dist/types/operations/smart-rollup-originate-operation.d.ts +1 -1
- package/dist/types/operations/transaction-operation.d.ts +2 -2
- package/dist/types/operations/transfer-ticket-operation.d.ts +2 -2
- package/dist/types/operations/types.d.ts +387 -25
- package/dist/types/operations/update-companion-key-operation.d.ts +1 -1
- package/dist/types/operations/update-consensus-key-operation.d.ts +1 -1
- package/dist/types/prepare/interface.d.ts +32 -33
- package/dist/types/prepare/prepare-provider.d.ts +34 -60
- package/dist/types/provider.d.ts +7 -1
- package/dist/types/read-provider/interface.d.ts +21 -21
- package/dist/types/read-provider/rpc-read-adapter.d.ts +22 -22
- package/dist/types/signer/errors.d.ts +1 -1
- package/dist/types/signer/noop.d.ts +1 -1
- package/dist/types/subscribe/errors.d.ts +2 -2
- package/dist/types/taquito.d.ts +33 -33
- package/dist/types/wallet/errors.d.ts +10 -2
- package/dist/types/wallet/interface.d.ts +13 -13
- package/dist/types/wallet/operation.d.ts +4 -3
- package/dist/types/wallet/wallet.d.ts +36 -35
- package/package.json +27 -15
- package/LICENSE +0 -202
|
@@ -1,224 +1,179 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.RpcReadAdapter = void 0;
|
|
13
4
|
/**
|
|
14
|
-
*
|
|
5
|
+
* Converts calls from TzReadProvider into calls to the wrapped RpcClient in a format it can understand.
|
|
15
6
|
*/
|
|
16
7
|
class RpcReadAdapter {
|
|
17
8
|
constructor(rpc) {
|
|
18
9
|
this.rpc = rpc;
|
|
19
10
|
}
|
|
20
11
|
/**
|
|
21
|
-
*
|
|
12
|
+
* The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'spendable' RPC.
|
|
22
13
|
* @param address address from which we want to retrieve the spendable balance
|
|
23
14
|
* @param block from which we want to retrieve the balance
|
|
24
15
|
* @returns the balance in mutez
|
|
25
16
|
*/
|
|
26
|
-
getBalance(address, block) {
|
|
27
|
-
return
|
|
28
|
-
return this.rpc.getBalance(address, { block: String(block) });
|
|
29
|
-
});
|
|
17
|
+
async getBalance(address, block) {
|
|
18
|
+
return this.rpc.getBalance(address, { block: String(block) });
|
|
30
19
|
}
|
|
31
20
|
/**
|
|
32
|
-
*
|
|
21
|
+
* The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'balance' RPC.
|
|
33
22
|
* @param address address from which we want to retrieve the spendable balance
|
|
34
23
|
* @param block from which we want to retrieve the balance
|
|
35
24
|
* @returns the balance in mutez
|
|
36
25
|
*/
|
|
37
|
-
getSpendable(address, block) {
|
|
38
|
-
return
|
|
39
|
-
return this.rpc.getSpendable(address, { block: String(block) });
|
|
40
|
-
});
|
|
26
|
+
async getSpendable(address, block) {
|
|
27
|
+
return this.rpc.getSpendable(address, { block: String(block) });
|
|
41
28
|
}
|
|
42
29
|
/**
|
|
43
|
-
*
|
|
30
|
+
* Access the delegate of a contract, if any.
|
|
44
31
|
* @param address contract address from which we want to retrieve the delegate (baker)
|
|
45
32
|
* @param block from which we want to retrieve the delegate
|
|
46
33
|
* @returns the public key hash of the delegate or null if no delegate
|
|
47
34
|
*/
|
|
48
|
-
getDelegate(address, block) {
|
|
49
|
-
return
|
|
50
|
-
return this.rpc.getDelegate(address, { block: String(block) });
|
|
51
|
-
});
|
|
35
|
+
async getDelegate(address, block) {
|
|
36
|
+
return this.rpc.getDelegate(address, { block: String(block) });
|
|
52
37
|
}
|
|
53
38
|
/**
|
|
54
|
-
*
|
|
39
|
+
* Access the next protocol hash
|
|
55
40
|
* @param block from which we want to retrieve the next protocol hash
|
|
56
41
|
*/
|
|
57
|
-
getNextProtocol(block) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return protocols.next_protocol;
|
|
61
|
-
});
|
|
42
|
+
async getNextProtocol(block) {
|
|
43
|
+
const protocols = await this.rpc.getProtocols({ block: String(block) });
|
|
44
|
+
return protocols.next_protocol;
|
|
62
45
|
}
|
|
63
46
|
/**
|
|
64
|
-
*
|
|
47
|
+
* Access protocol constants used in Taquito
|
|
65
48
|
* @param block from which we want to retrieve the constants
|
|
66
49
|
*/
|
|
67
|
-
getProtocolConstants(block) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
};
|
|
79
|
-
});
|
|
50
|
+
async getProtocolConstants(block) {
|
|
51
|
+
const { time_between_blocks, minimal_block_delay, hard_gas_limit_per_operation, hard_gas_limit_per_block, hard_storage_limit_per_operation, cost_per_byte, smart_rollup_origination_size, } = await this.rpc.getConstants({ block: String(block) });
|
|
52
|
+
return {
|
|
53
|
+
time_between_blocks,
|
|
54
|
+
minimal_block_delay,
|
|
55
|
+
hard_gas_limit_per_operation,
|
|
56
|
+
hard_gas_limit_per_block,
|
|
57
|
+
hard_storage_limit_per_operation,
|
|
58
|
+
cost_per_byte,
|
|
59
|
+
smart_rollup_origination_size,
|
|
60
|
+
};
|
|
80
61
|
}
|
|
81
62
|
/**
|
|
82
|
-
*
|
|
63
|
+
* Access the script (code and storage) of a smart contract
|
|
83
64
|
* @param contract contract address from which we want to retrieve the script
|
|
84
65
|
* @param block from which we want to retrieve the storage value
|
|
85
66
|
* @returns Note: The code must be in the JSON format and not contain global constant
|
|
86
67
|
*/
|
|
87
|
-
getScript(contract, block) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return script;
|
|
91
|
-
});
|
|
68
|
+
async getScript(contract, block) {
|
|
69
|
+
const { script } = await this.rpc.getContract(contract, { block: String(block) });
|
|
70
|
+
return script;
|
|
92
71
|
}
|
|
93
72
|
/**
|
|
94
|
-
*
|
|
73
|
+
* Access the storage value of a contract
|
|
95
74
|
* @param contract contract address from which we want to retrieve the storage
|
|
96
75
|
* @param block from which we want to retrieve the storage value
|
|
97
76
|
*/
|
|
98
|
-
getStorage(contract, block) {
|
|
99
|
-
return
|
|
100
|
-
return this.rpc.getStorage(contract, { block: String(block) });
|
|
101
|
-
});
|
|
77
|
+
async getStorage(contract, block) {
|
|
78
|
+
return this.rpc.getStorage(contract, { block: String(block) });
|
|
102
79
|
}
|
|
103
80
|
/**
|
|
104
|
-
*
|
|
81
|
+
* Access the block hash
|
|
105
82
|
*/
|
|
106
|
-
getBlockHash(block) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return hash;
|
|
110
|
-
});
|
|
83
|
+
async getBlockHash(block) {
|
|
84
|
+
const { hash } = await this.rpc.getBlockHeader({ block: String(block) });
|
|
85
|
+
return hash;
|
|
111
86
|
}
|
|
112
87
|
/**
|
|
113
|
-
*
|
|
88
|
+
* Access the block level
|
|
114
89
|
*/
|
|
115
|
-
getBlockLevel(block) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return level;
|
|
119
|
-
});
|
|
90
|
+
async getBlockLevel(block) {
|
|
91
|
+
const { level } = await this.rpc.getBlockHeader({ block: String(block) });
|
|
92
|
+
return level;
|
|
120
93
|
}
|
|
121
94
|
/**
|
|
122
|
-
*
|
|
95
|
+
* Access the counter of an address
|
|
123
96
|
* @param pkh from which we want to retrieve the counter
|
|
124
97
|
* @param block from which we want to retrieve the counter
|
|
125
98
|
*/
|
|
126
|
-
getCounter(pkh, block) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return counter || '0';
|
|
130
|
-
});
|
|
99
|
+
async getCounter(pkh, block) {
|
|
100
|
+
const { counter } = await this.rpc.getContract(pkh, { block: String(block) });
|
|
101
|
+
return counter || '0';
|
|
131
102
|
}
|
|
132
103
|
/**
|
|
133
|
-
*
|
|
104
|
+
* Access the timestamp of a block
|
|
134
105
|
* @param block from which we want to retrieve the timestamp
|
|
135
106
|
* @returns date ISO format zero UTC offset ("2022-01-19T22:37:07Z")
|
|
136
107
|
*/
|
|
137
|
-
getBlockTimestamp(block) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return timestamp;
|
|
141
|
-
});
|
|
108
|
+
async getBlockTimestamp(block) {
|
|
109
|
+
const { timestamp } = await this.rpc.getBlockHeader({ block: String(block) });
|
|
110
|
+
return timestamp;
|
|
142
111
|
}
|
|
143
112
|
/**
|
|
144
|
-
*
|
|
113
|
+
* Access the value associated with a key in a big map.
|
|
145
114
|
* @param bigMapQuery Big Map ID and Expression hash to query (A b58check encoded Blake2b hash of the expression)
|
|
146
115
|
* @param block from which we want to retrieve the big map value
|
|
147
116
|
*/
|
|
148
|
-
getBigMapValue(bigMapQuery, block) {
|
|
149
|
-
return
|
|
150
|
-
|
|
151
|
-
block: String(block),
|
|
152
|
-
});
|
|
117
|
+
async getBigMapValue(bigMapQuery, block) {
|
|
118
|
+
return this.rpc.getBigMapExpr(bigMapQuery.id, bigMapQuery.expr, {
|
|
119
|
+
block: String(block),
|
|
153
120
|
});
|
|
154
121
|
}
|
|
155
122
|
/**
|
|
156
|
-
*
|
|
157
|
-
* @param
|
|
123
|
+
* Access the value associated with a sapling state ID.
|
|
124
|
+
* @param saplingStateQuery Sapling state ID query
|
|
158
125
|
* @param block from which we want to retrieve the sapling state
|
|
159
126
|
*/
|
|
160
|
-
getSaplingDiffById(saplingStateQuery, block) {
|
|
161
|
-
return
|
|
162
|
-
return this.rpc.getSaplingDiffById(saplingStateQuery.id, { block: String(block) });
|
|
163
|
-
});
|
|
127
|
+
async getSaplingDiffById(saplingStateQuery, block) {
|
|
128
|
+
return this.rpc.getSaplingDiffById(saplingStateQuery.id, { block: String(block) });
|
|
164
129
|
}
|
|
165
130
|
/**
|
|
166
|
-
*
|
|
131
|
+
* Access the sapling state of a smart contract.
|
|
167
132
|
* @param contractAddress The address of the smart contract
|
|
168
133
|
* @param block The block you want to retrieve the sapling state from
|
|
169
134
|
*/
|
|
170
|
-
getSaplingDiffByContract(contractAddress, block) {
|
|
171
|
-
return
|
|
172
|
-
return this.rpc.getSaplingDiffByContract(contractAddress, { block: String(block) });
|
|
173
|
-
});
|
|
135
|
+
async getSaplingDiffByContract(contractAddress, block) {
|
|
136
|
+
return this.rpc.getSaplingDiffByContract(contractAddress, { block: String(block) });
|
|
174
137
|
}
|
|
175
138
|
/**
|
|
176
|
-
*
|
|
139
|
+
* Return the list of entrypoints of the contract
|
|
177
140
|
* @param contract address of the contract we want to get the entrypoints of
|
|
178
141
|
*/
|
|
179
|
-
getEntrypoints(contract) {
|
|
180
|
-
return
|
|
181
|
-
return this.rpc.getEntrypoints(contract);
|
|
182
|
-
});
|
|
142
|
+
async getEntrypoints(contract) {
|
|
143
|
+
return this.rpc.getEntrypoints(contract);
|
|
183
144
|
}
|
|
184
145
|
/**
|
|
185
|
-
*
|
|
146
|
+
* Access the chain id
|
|
186
147
|
*/
|
|
187
|
-
getChainId() {
|
|
188
|
-
return
|
|
189
|
-
return this.rpc.getChainId();
|
|
190
|
-
});
|
|
148
|
+
async getChainId() {
|
|
149
|
+
return this.rpc.getChainId();
|
|
191
150
|
}
|
|
192
151
|
/**
|
|
193
|
-
*
|
|
152
|
+
* Indicate if an account is revealed
|
|
194
153
|
* @param publicKeyHash of the account
|
|
195
154
|
* @param block from which we want to know if the account is revealed
|
|
196
155
|
*/
|
|
197
|
-
isAccountRevealed(publicKeyHash, block) {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
return haveManager;
|
|
202
|
-
});
|
|
156
|
+
async isAccountRevealed(publicKeyHash, block) {
|
|
157
|
+
const manager = await this.rpc.getManagerKey(publicKeyHash, { block: String(block) });
|
|
158
|
+
const haveManager = manager && typeof manager === 'object' ? !!manager.key : !!manager;
|
|
159
|
+
return haveManager;
|
|
203
160
|
}
|
|
204
161
|
/**
|
|
205
|
-
*
|
|
162
|
+
* Return all the information about a block
|
|
206
163
|
* @param block from which we want to retrieve the information
|
|
207
164
|
*/
|
|
208
|
-
getBlock(block) {
|
|
209
|
-
return
|
|
210
|
-
return this.rpc.getBlock({ block: String(block) });
|
|
211
|
-
});
|
|
165
|
+
async getBlock(block) {
|
|
166
|
+
return this.rpc.getBlock({ block: String(block) });
|
|
212
167
|
}
|
|
213
168
|
/**
|
|
214
|
-
*
|
|
169
|
+
* Return a list of the ancestors of the given block which, if referred to as the branch in an operation header, are recent enough for that operation to be included in the current block.
|
|
215
170
|
* @param block from which we want to retrieve the information
|
|
216
171
|
*/
|
|
217
172
|
getLiveBlocks(block) {
|
|
218
173
|
return this.rpc.getLiveBlocks({ block: String(block) });
|
|
219
174
|
}
|
|
220
175
|
/**
|
|
221
|
-
*
|
|
176
|
+
* Returns the cycle at which the launch of the Adaptive Issuance feature is set to happen. A result of null means that the feature is not yet set to launch.
|
|
222
177
|
* @param block from which we want to retrieve the information
|
|
223
178
|
*/
|
|
224
179
|
getAdaptiveIssuanceLaunchCycle(block) {
|
|
@@ -4,7 +4,7 @@ exports.UnconfiguredSignerError = void 0;
|
|
|
4
4
|
const core_1 = require("@taquito/core");
|
|
5
5
|
/**
|
|
6
6
|
* @category Error
|
|
7
|
-
*
|
|
7
|
+
* Error that indicates no signer has been configured in the TezosToolkit instance
|
|
8
8
|
*/
|
|
9
9
|
class UnconfiguredSignerError extends core_1.TezosToolkitConfigError {
|
|
10
10
|
constructor() {
|
package/dist/lib/signer/noop.js
CHANGED
|
@@ -1,40 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.NoopSigner = void 0;
|
|
13
4
|
const errors_1 = require("./errors");
|
|
14
5
|
/**
|
|
15
|
-
*
|
|
6
|
+
* Default signer implementation which does nothing and produce invalid signature
|
|
16
7
|
* @throw {@link UnconfiguredSignerError}
|
|
17
8
|
*/
|
|
18
9
|
class NoopSigner {
|
|
19
|
-
publicKey() {
|
|
20
|
-
|
|
21
|
-
throw new errors_1.UnconfiguredSignerError();
|
|
22
|
-
});
|
|
10
|
+
async publicKey() {
|
|
11
|
+
throw new errors_1.UnconfiguredSignerError();
|
|
23
12
|
}
|
|
24
|
-
publicKeyHash() {
|
|
25
|
-
|
|
26
|
-
throw new errors_1.UnconfiguredSignerError();
|
|
27
|
-
});
|
|
13
|
+
async publicKeyHash() {
|
|
14
|
+
throw new errors_1.UnconfiguredSignerError();
|
|
28
15
|
}
|
|
29
|
-
secretKey() {
|
|
30
|
-
|
|
31
|
-
throw new errors_1.UnconfiguredSignerError();
|
|
32
|
-
});
|
|
16
|
+
async secretKey() {
|
|
17
|
+
throw new errors_1.UnconfiguredSignerError();
|
|
33
18
|
}
|
|
34
|
-
sign(_bytes, _watermark) {
|
|
35
|
-
|
|
36
|
-
throw new errors_1.UnconfiguredSignerError();
|
|
37
|
-
});
|
|
19
|
+
async sign(_bytes, _watermark) {
|
|
20
|
+
throw new errors_1.UnconfiguredSignerError();
|
|
38
21
|
}
|
|
39
22
|
}
|
|
40
23
|
exports.NoopSigner = NoopSigner;
|
|
@@ -4,7 +4,7 @@ exports.InvalidFilterExpressionError = exports.UnsupportedEventError = void 0;
|
|
|
4
4
|
const core_1 = require("@taquito/core");
|
|
5
5
|
/**
|
|
6
6
|
* @category Error
|
|
7
|
-
*
|
|
7
|
+
* Error that indicates an unsupported event being passed or used
|
|
8
8
|
*/
|
|
9
9
|
class UnsupportedEventError extends core_1.ParameterValidationError {
|
|
10
10
|
constructor(type) {
|
|
@@ -17,7 +17,7 @@ class UnsupportedEventError extends core_1.ParameterValidationError {
|
|
|
17
17
|
exports.UnsupportedEventError = UnsupportedEventError;
|
|
18
18
|
/**
|
|
19
19
|
* @category Error
|
|
20
|
-
*
|
|
20
|
+
* Error that indicates an invalid filter expression being passed or used
|
|
21
21
|
*/
|
|
22
22
|
class InvalidFilterExpressionError extends core_1.ParameterValidationError {
|
|
23
23
|
constructor(invalidExpression) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.PollingSubscribeProvider = exports.defaultConfigStreamer = void 0;
|
|
13
4
|
const rxjs_1 = require("rxjs");
|
|
@@ -27,8 +18,8 @@ const applyFilter = (filter) => (0, operators_1.concatMap)((block) => {
|
|
|
27
18
|
for (const ops of block.operations) {
|
|
28
19
|
for (const op of ops) {
|
|
29
20
|
for (const content of op.contents) {
|
|
30
|
-
if ((0, filters_1.evaluateFilter)(
|
|
31
|
-
sub.next(
|
|
21
|
+
if ((0, filters_1.evaluateFilter)({ hash: op.hash, ...content }, filter)) {
|
|
22
|
+
sub.next({ hash: op.hash, ...content });
|
|
32
23
|
}
|
|
33
24
|
}
|
|
34
25
|
}
|
|
@@ -45,8 +36,13 @@ const applyEventFilter = (filter) => (0, operators_1.concatMap)((block) => {
|
|
|
45
36
|
const internalOpResults = tx.metadata.internal_operation_results;
|
|
46
37
|
if (internalOpResults) {
|
|
47
38
|
for (const event of internalOpResults) {
|
|
48
|
-
if ((0, filters_1.eventFilter)(event, filter
|
|
49
|
-
sub.next(
|
|
39
|
+
if ((0, filters_1.eventFilter)(event, filter?.address, filter?.tag, filter?.excludeFailedOperations)) {
|
|
40
|
+
sub.next({
|
|
41
|
+
opHash: op.hash,
|
|
42
|
+
blockHash: block.hash,
|
|
43
|
+
level: block.header.level,
|
|
44
|
+
...event,
|
|
45
|
+
});
|
|
50
46
|
}
|
|
51
47
|
}
|
|
52
48
|
}
|
|
@@ -59,8 +55,11 @@ const applyEventFilter = (filter) => (0, operators_1.concatMap)((block) => {
|
|
|
59
55
|
class PollingSubscribeProvider {
|
|
60
56
|
constructor(context, config = {}) {
|
|
61
57
|
this.context = context;
|
|
62
|
-
this._config$ = new rxjs_1.BehaviorSubject(
|
|
63
|
-
|
|
58
|
+
this._config$ = new rxjs_1.BehaviorSubject({
|
|
59
|
+
...exports.defaultConfigStreamer,
|
|
60
|
+
...config,
|
|
61
|
+
});
|
|
62
|
+
this.timer$ = this._config$.pipe((0, operators_1.map)((x) => x?.pollingIntervalMilliseconds), (0, operators_1.switchMap)((pollingIntervalMilliseconds) => {
|
|
64
63
|
if (!pollingIntervalMilliseconds) {
|
|
65
64
|
return (0, rxjs_1.from)(this.getConfirmationPollingInterval()).pipe((0, operators_1.switchMap)((interval) => {
|
|
66
65
|
return (0, rxjs_1.timer)(0, interval);
|
|
@@ -70,7 +69,7 @@ class PollingSubscribeProvider {
|
|
|
70
69
|
return (0, rxjs_1.timer)(0, pollingIntervalMilliseconds);
|
|
71
70
|
}
|
|
72
71
|
}));
|
|
73
|
-
this.newBlock$ = this.timer$.pipe((0, operators_1.
|
|
72
|
+
this.newBlock$ = this.timer$.pipe((0, operators_1.exhaustMap)(() => getLastBlock(this.context)), (0, operators_1.distinctUntilKeyChanged)('hash'), (0, operators_1.share)({
|
|
74
73
|
resetOnError: false,
|
|
75
74
|
resetOnComplete: false,
|
|
76
75
|
resetOnRefCountZero: true,
|
|
@@ -79,34 +78,32 @@ class PollingSubscribeProvider {
|
|
|
79
78
|
get config() {
|
|
80
79
|
return this._config$.getValue();
|
|
81
80
|
}
|
|
82
|
-
getConfirmationPollingInterval() {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
: Math.max(confirmationPollingInterval.toNumber(), minimumPollingInterval);
|
|
97
|
-
}
|
|
98
|
-
catch (exception) {
|
|
99
|
-
return defaultIntervalTestnetsMainnet;
|
|
100
|
-
}
|
|
81
|
+
async getConfirmationPollingInterval() {
|
|
82
|
+
if (!this.config.pollingIntervalMilliseconds) {
|
|
83
|
+
const defaultIntervalTestnetsMainnet = 5000;
|
|
84
|
+
const minimumPollingInterval = 700;
|
|
85
|
+
try {
|
|
86
|
+
const constants = await this.context.readProvider.getProtocolConstants('head');
|
|
87
|
+
const blockTime = constants.minimal_block_delay
|
|
88
|
+
? constants.minimal_block_delay.multipliedBy(1000)
|
|
89
|
+
: new bignumber_js_1.default(defaultIntervalTestnetsMainnet);
|
|
90
|
+
const confirmationPollingInterval = blockTime.dividedBy(3);
|
|
91
|
+
this.config.pollingIntervalMilliseconds =
|
|
92
|
+
confirmationPollingInterval.toNumber() === 0
|
|
93
|
+
? minimumPollingInterval
|
|
94
|
+
: Math.max(confirmationPollingInterval.toNumber(), minimumPollingInterval);
|
|
101
95
|
}
|
|
102
|
-
|
|
103
|
-
|
|
96
|
+
catch (exception) {
|
|
97
|
+
return defaultIntervalTestnetsMainnet;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return this.config.pollingIntervalMilliseconds;
|
|
104
101
|
}
|
|
105
102
|
subscribeBlock(_filter) {
|
|
106
103
|
return new observable_subscription_1.ObservableSubscription(this.newBlock$, this.config.shouldObservableSubscriptionRetry, this.config.observableSubscriptionRetryFunction);
|
|
107
104
|
}
|
|
108
105
|
subscribe(_filter) {
|
|
109
|
-
return new observable_subscription_1.ObservableSubscription(this.newBlock$.pipe((0, operators_1.map)((x) => x
|
|
106
|
+
return new observable_subscription_1.ObservableSubscription(this.newBlock$.pipe((0, operators_1.map)((x) => x?.hash)), this.config.shouldObservableSubscriptionRetry, this.config.observableSubscriptionRetryFunction);
|
|
110
107
|
}
|
|
111
108
|
subscribeOperation(filter) {
|
|
112
109
|
return new observable_subscription_1.ObservableSubscription(this.newBlock$.pipe(applyFilter(filter)), this.config.shouldObservableSubscriptionRetry, this.config.observableSubscriptionRetryFunction);
|