@d8x/perpetuals-sdk 1.3.4 → 1.3.6

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.
Files changed (41) hide show
  1. package/dist/cjs/config/priceFeedConfig.json +9 -3
  2. package/dist/cjs/nodeSDKTypes.d.ts +9 -8
  3. package/dist/cjs/orderExecutorTool.d.ts +4 -2
  4. package/dist/cjs/orderExecutorTool.js +28 -19
  5. package/dist/cjs/orderExecutorTool.js.map +1 -1
  6. package/dist/cjs/perpetualDataHandler.d.ts +1 -1
  7. package/dist/cjs/perpetualDataHandler.js +2 -2
  8. package/dist/cjs/perpetualDataHandler.js.map +1 -1
  9. package/dist/cjs/priceFeeds.d.ts +18 -13
  10. package/dist/cjs/priceFeeds.js +62 -26
  11. package/dist/cjs/priceFeeds.js.map +1 -1
  12. package/dist/cjs/version.d.ts +1 -1
  13. package/dist/cjs/version.js +1 -1
  14. package/dist/esm/config/priceFeedConfig.json +9 -3
  15. package/dist/esm/nodeSDKTypes.d.ts +9 -8
  16. package/dist/esm/orderExecutorTool.d.ts +4 -2
  17. package/dist/esm/orderExecutorTool.js +28 -19
  18. package/dist/esm/orderExecutorTool.js.map +1 -1
  19. package/dist/esm/perpetualDataHandler.d.ts +1 -1
  20. package/dist/esm/perpetualDataHandler.js +2 -2
  21. package/dist/esm/perpetualDataHandler.js.map +1 -1
  22. package/dist/esm/priceFeeds.d.ts +18 -13
  23. package/dist/esm/priceFeeds.js +62 -26
  24. package/dist/esm/priceFeeds.js.map +1 -1
  25. package/dist/esm/version.d.ts +1 -1
  26. package/dist/esm/version.js +1 -1
  27. package/package.json +1 -1
  28. package/src/config/priceFeedConfig.json +9 -3
  29. package/src/nodeSDKTypes.ts +18 -2
  30. package/src/orderExecutorTool.ts +44 -30
  31. package/src/perpetualDataHandler.ts +2 -2
  32. package/src/priceFeeds.ts +91 -29
  33. package/src/version.ts +1 -1
  34. package/src/contracts/BeaconProxy.ts +0 -108
  35. package/src/contracts/MockToken.ts +0 -581
  36. package/src/contracts/UUPSUpgradeable.ts +0 -228
  37. package/src/contracts/WeETH.ts +0 -1104
  38. package/src/contracts/factories/BeaconProxy__factory.ts +0 -92
  39. package/src/contracts/factories/MockToken__factory.ts +0 -368
  40. package/src/contracts/factories/UUPSUpgradeable__factory.ts +0 -128
  41. package/src/contracts/factories/WeETH__factory.ts +0 -721
@@ -148,8 +148,12 @@
148
148
  }
149
149
  ],
150
150
  "endpoints": [
151
- { "type": "pyth", "endpoints": ["https://hermes.pyth.network"] },
152
- { "type": "onchain", "endpoints": [] }
151
+ {
152
+ "type": "pyth",
153
+ "endpoints": ["https://hermes.pyth.network"],
154
+ "writeEndpoints": ["https://hermes.pyth.network"]
155
+ },
156
+ { "type": "onchain", "endpoints": [], "writeEndpoints": [] }
153
157
  ]
154
158
  },
155
159
  {
@@ -228,6 +232,8 @@
228
232
  "origin": "Crypto.USDT/USD"
229
233
  }
230
234
  ],
231
- "endpoints": [{ "type": "odin", "endpoints": ["https://odin.d8x.xyz"] }]
235
+ "endpoints": [
236
+ { "type": "odin", "endpoints": ["https://hermes.pyth.network"], "writeEndpoints": ["https://odin.d8x.xyz"] }
237
+ ]
232
238
  }
233
239
  ]
@@ -20,7 +20,7 @@ export interface NodeSDKConfig {
20
20
  lobFactoryABI?: ContractInterface | undefined;
21
21
  lobABI?: ContractInterface | undefined;
22
22
  shareTokenABI?: ContractInterface | undefined;
23
- priceFeedEndpoints?: Array<{ type: string; endpoints: string[] }>;
23
+ priceFeedEndpoints?: PriceFeedEndpointsOptionalWrite;
24
24
  multicall?: string;
25
25
  }
26
26
 
@@ -287,9 +287,25 @@ export interface TypeSafeOrder {
287
287
  export interface PriceFeedConfig {
288
288
  network: string;
289
289
  ids: Array<{ symbol: string; id: string; type: string; origin: string }>;
290
- endpoints: Array<{ type: string; endpoints: string[] }>;
290
+ endpoints: PriceFeedEndpoints;
291
291
  }
292
292
 
293
+ export interface PriceFeedEndpointsItem {
294
+ type: string | "odin" | "pyth" | "onchain";
295
+ // Read only endpoints. Used by default.
296
+ endpoints: string[];
297
+ // Price feed endpoints which are used for fetching prices which will be
298
+ // submitted for updates on chain.
299
+ writeEndpoints?: string[];
300
+ }
301
+
302
+ // For price feeds config
303
+ export type PriceFeedEndpoints = Array<Required<PriceFeedEndpointsItem>>;
304
+
305
+ // For SDK configuration writeEndpoints are set as optional for backwards
306
+ // compatibility. See NodeSDKConfig interface.
307
+ export type PriceFeedEndpointsOptionalWrite = Array<PriceFeedEndpointsItem>;
308
+
293
309
  export interface PriceFeedSubmission {
294
310
  symbols: Map<string, string[]>; //id -> symbols
295
311
  ids: string[];
@@ -1,8 +1,8 @@
1
1
  import { Signer } from "@ethersproject/abstract-signer";
2
- import { BigNumber } from "@ethersproject/bignumber";
2
+ import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
3
3
  import { HashZero } from "@ethersproject/constants";
4
4
  import type { CallOverrides, ContractTransaction, PayableOverrides } from "@ethersproject/contracts";
5
- import { BlockTag, StaticJsonRpcProvider } from "@ethersproject/providers";
5
+ import { BlockTag, StaticJsonRpcProvider, TransactionRequest } from "@ethersproject/providers";
6
6
  import { BUY_SIDE, MULTICALL_ADDRESS, OrderStatus, SELL_SIDE, ZERO_ADDRESS, ZERO_ORDER_ID } from "./constants";
7
7
  import { IPyth__factory, LimitOrderBook, LimitOrderBook__factory, Multicall3, Multicall3__factory } from "./contracts";
8
8
  import { ABK64x64ToFloat, floatToABK64x64 } from "./d8XMath";
@@ -88,7 +88,7 @@ export default class OrderExecutorTool extends WriteAccessHandler {
88
88
  executorAddr?: string,
89
89
  submission?: PriceFeedSubmission,
90
90
  overrides?: PayableOverrides
91
- ): Promise<ContractTransaction | undefined> {
91
+ ): Promise<ContractTransaction> {
92
92
  return this.executeOrders(symbol, [orderId], executorAddr, submission, overrides);
93
93
  }
94
94
 
@@ -125,8 +125,8 @@ export default class OrderExecutorTool extends WriteAccessHandler {
125
125
  orderIds: string[],
126
126
  executorAddr?: string,
127
127
  submission?: PriceFeedSubmission,
128
- overrides?: PayableOverrides & { rpcURL?: string; splitTx?: boolean }
129
- ): Promise<ContractTransaction | undefined> {
128
+ overrides?: PayableOverrides & { rpcURL?: string; splitTx?: boolean; maxGasLimit?: BigNumberish }
129
+ ): Promise<ContractTransaction> {
130
130
  if (this.proxyContract == null || this.signer == null) {
131
131
  throw Error("no proxy contract or wallet initialized. Use createProxyInstance().");
132
132
  }
@@ -182,11 +182,23 @@ export default class OrderExecutorTool extends WriteAccessHandler {
182
182
  }
183
183
 
184
184
  if (overrides?.nonce !== undefined) {
185
- const nonce = await overrides!.nonce;
185
+ const nonce = await overrides.nonce;
186
186
  overrides.nonce = BigNumber.from(nonce).add(nonceInc);
187
187
  }
188
188
 
189
- let unsignedTx = {
189
+ if (overrides?.gasLimit !== undefined) {
190
+ overrides.gasLimit = await overrides.gasLimit;
191
+ }
192
+
193
+ if (overrides?.gasPrice !== undefined) {
194
+ overrides.gasPrice = await overrides.gasPrice;
195
+ }
196
+
197
+ if (value !== undefined) {
198
+ value = await value;
199
+ }
200
+
201
+ const unsignedTx: TransactionRequest = {
190
202
  to: this.getOrderBookContract(symbol).address,
191
203
  from: this.traderAddr,
192
204
  nonce: overrides?.nonce,
@@ -199,31 +211,33 @@ export default class OrderExecutorTool extends WriteAccessHandler {
199
211
  };
200
212
  // no gas limit was specified, explicitly estimate
201
213
  if (!overrides?.gasLimit) {
202
- overrides = {
203
- gasLimit: await this.signer
204
- .estimateGas(unsignedTx)
205
- .then((gas) => gas.mul(1100).div(1000))
206
- .catch((_e) => undefined),
207
- ...overrides,
208
- };
209
- if (!overrides.gasLimit) {
210
- // gas estimate failed - txn would probably revert, double check:
211
- overrides = { gasLimit: this.gasLimit, value: unsignedTx.value, ...overrides };
212
- try {
213
- await this.getOrderBookContract(symbol).callStatic.executeOrders(
214
- orderIds,
215
- executorAddr,
216
- submission.priceFeedVaas,
217
- submission.timestamps,
218
- overrides
219
- );
220
- } catch (e) {
221
- console.log("Order cannot be executed:", e);
222
- return undefined;
223
- }
214
+ // given gas price might be conservative, which leads to a lower a gas estimate
215
+ //-> compensate with larger buffer
216
+ let gasLimit = await this.signer
217
+ .estimateGas(unsignedTx)
218
+ .then((gas) => gas.mul(1500).div(1000))
219
+ .catch((_e) => undefined);
220
+
221
+ if (!gasLimit) {
222
+ // gas estimate failed - txn would probably revert, double check (and possibly re-throw):
223
+ overrides = {
224
+ ...overrides,
225
+ gasLimit: overrides?.maxGasLimit ?? this.gasLimit,
226
+ value: unsignedTx.value,
227
+ };
228
+ await this.getOrderBookContract(symbol, provider).callStatic.executeOrders(
229
+ orderIds,
230
+ executorAddr,
231
+ submission.priceFeedVaas,
232
+ submission.timestamps,
233
+ overrides
234
+ );
235
+ // it worked - use fallback
236
+ gasLimit = BigNumber.from(overrides?.maxGasLimit ?? this.gasLimit);
224
237
  }
238
+ unsignedTx.gasLimit = gasLimit;
225
239
  }
226
- return await this.signer.sendTransaction(unsignedTx);
240
+ return await this.signer.connect(provider).sendTransaction(unsignedTx);
227
241
  }
228
242
 
229
243
  /**
@@ -179,12 +179,12 @@ export default class PerpetualDataHandler {
179
179
  * @param symbol symbol of the form ETH-USD-MATIC
180
180
  * @returns order book contract for the perpetual
181
181
  */
182
- public getOrderBookContract(symbol: string): Contract & LimitOrderBook {
182
+ public getOrderBookContract(symbol: string, provider?: Provider): Contract & LimitOrderBook {
183
183
  let orderBookAddr = this.symbolToPerpStaticInfo.get(symbol)?.limitOrderBookAddr;
184
184
  if (orderBookAddr == "" || orderBookAddr == undefined || this.signerOrProvider == null) {
185
185
  throw Error(`no limit order book found for ${symbol} or no signer`);
186
186
  }
187
- let lobContract = LimitOrderBook__factory.connect(orderBookAddr, this.signerOrProvider);
187
+ let lobContract = LimitOrderBook__factory.connect(orderBookAddr, provider ?? this.signerOrProvider);
188
188
  return lobContract;
189
189
  }
190
190
 
package/src/priceFeeds.ts CHANGED
@@ -1,7 +1,14 @@
1
1
  import { BigNumber } from "@ethersproject/bignumber";
2
2
  import { Buffer } from "buffer";
3
3
  import { decNToFloat, floatToDec18 } from "./d8XMath";
4
- import type { PriceFeedConfig, PriceFeedFormat, PriceFeedSubmission, PythV2LatestPriceFeed } from "./nodeSDKTypes";
4
+ import type {
5
+ PriceFeedConfig,
6
+ PriceFeedEndpoints,
7
+ PriceFeedEndpointsOptionalWrite,
8
+ PriceFeedFormat,
9
+ PriceFeedSubmission,
10
+ PythV2LatestPriceFeed,
11
+ } from "./nodeSDKTypes";
5
12
  import PerpetualDataHandler from "./perpetualDataHandler";
6
13
  import Triangulator from "./triangulator";
7
14
  import OnChainPxFeed from "./onChainPxFeed";
@@ -13,7 +20,11 @@ import OnChainPxFactory from "./onChainPxFactory";
13
20
  */
14
21
  export default class PriceFeeds {
15
22
  private config: PriceFeedConfig;
16
- private feedEndpoints: Array<string>; //feedEndpoints[endpointId] = endpointstring
23
+ // Read only price info endpoints. Used by default. feedEndpoints[endpointId]
24
+ // = endpointstring
25
+ public feedEndpoints: Array<string>;
26
+ // Endpoints which are used to fetch prices for submissions
27
+ public writeFeedEndpoints: Array<string> = [];
17
28
  private feedInfo: Map<string, { symbol: string; endpointId: number }[]>; // priceFeedId -> [symbol, endpointId]
18
29
  private dataHandler: PerpetualDataHandler;
19
30
  // store triangulation paths given the price feeds
@@ -27,21 +38,16 @@ export default class PriceFeeds {
27
38
  constructor(dataHandler: PerpetualDataHandler, priceFeedConfigNetwork: string) {
28
39
  let configs = require("./config/priceFeedConfig.json") as PriceFeedConfig[];
29
40
  this.config = PriceFeeds._selectConfig(configs, priceFeedConfigNetwork);
30
- // if SDK config contains custom price feed endpoints, these override the public/default ones
41
+
42
+ // if SDK config contains custom price feed endpoints, these override the
43
+ // public/default ones
31
44
  if (dataHandler.config.priceFeedEndpoints && dataHandler.config.priceFeedEndpoints.length > 0) {
32
- // override price feed endpoints of same type
33
- for (let k = 0; k < dataHandler.config.priceFeedEndpoints.length; k++) {
34
- for (let j = 0; j < this.config.endpoints.length; j++) {
35
- if (this.config.endpoints[j].type == dataHandler.config.priceFeedEndpoints[k].type) {
36
- this.config.endpoints[j] = dataHandler.config.priceFeedEndpoints[k];
37
- for (let i = 0; i < this.config.endpoints[j].endpoints.length; i++) {
38
- this.config.endpoints[j].endpoints[i] = PriceFeeds.trimEndpoint(this.config.endpoints[j].endpoints[i]);
39
- }
40
- break;
41
- }
42
- }
43
- }
45
+ this.config.endpoints = PriceFeeds.overridePriceEndpointsOfSameType(
46
+ this.config.endpoints,
47
+ dataHandler.config.priceFeedEndpoints
48
+ );
44
49
  }
50
+
45
51
  this.onChainPxFeeds = new Map<string, OnChainPxFeed>();
46
52
  for (let k = 0; k < this.config.ids.length; k++) {
47
53
  if (this.config.ids[k].type == "onchain") {
@@ -49,11 +55,56 @@ export default class PriceFeeds {
49
55
  this.onChainPxFeeds[sym] = OnChainPxFactory.createFeed(sym);
50
56
  }
51
57
  }
52
- [this.feedInfo, this.feedEndpoints] = PriceFeeds._constructFeedInfo(this.config, false);
58
+ [this.feedInfo, this.feedEndpoints, this.writeFeedEndpoints] = PriceFeeds._constructFeedInfo(this.config, false);
59
+ // Deny providing no endpoints
60
+ if (this.feedEndpoints.length == 0) {
61
+ throw new Error("PriceFeeds: no endpoints provided in config");
62
+ }
63
+ if (this.writeFeedEndpoints.length == 0) {
64
+ throw new Error("PriceFeeds: no writeEndpoints provided in config");
65
+ }
66
+
53
67
  this.dataHandler = dataHandler;
54
68
  this.triangulations = new Map<string, [string[], boolean[]]>();
55
69
  }
56
70
 
71
+ // overridePriceEndpointsOfSameType overrides endpoints of config with same
72
+ // type endpoints provided by user and returns the updated price feed
73
+ // endpoints list.
74
+ public static overridePriceEndpointsOfSameType(
75
+ configEndpoints: PriceFeedEndpoints,
76
+ userProvidedEndpoints: PriceFeedEndpointsOptionalWrite
77
+ ): PriceFeedEndpoints {
78
+ let result = configEndpoints;
79
+ for (let k = 0; k < userProvidedEndpoints.length; k++) {
80
+ for (let j = 0; j < result.length; j++) {
81
+ if (result[j].type == userProvidedEndpoints[k].type) {
82
+ // read only endpoints
83
+ if (userProvidedEndpoints[k].endpoints.length > 0) {
84
+ result[j].endpoints = userProvidedEndpoints[k].endpoints;
85
+ for (let i = 0; i < result[j].endpoints.length; i++) {
86
+ result[j].endpoints[i] = PriceFeeds.trimEndpoint(result[j].endpoints[i]);
87
+ }
88
+ }
89
+
90
+ // write endpoints
91
+ if (
92
+ userProvidedEndpoints[k].writeEndpoints !== undefined &&
93
+ userProvidedEndpoints[k].writeEndpoints!.length > 0
94
+ ) {
95
+ result[j].writeEndpoints = userProvidedEndpoints[k].writeEndpoints!;
96
+ for (let i = 0; i < result[j].writeEndpoints.length; i++) {
97
+ result[j].writeEndpoints[i] = PriceFeeds.trimEndpoint(result[j].writeEndpoints[i]);
98
+ }
99
+ }
100
+
101
+ break;
102
+ }
103
+ }
104
+ }
105
+ return result;
106
+ }
107
+
57
108
  /**
58
109
  * We cut last / or legacy url format /api/ if any
59
110
  * @param endp endpoint string
@@ -101,8 +152,8 @@ export default class PriceFeeds {
101
152
  }
102
153
 
103
154
  /**
104
- * Get required information to be able to submit a blockchain transaction with price-update
105
- * such as trade execution, liquidation
155
+ * Get required information to be able to submit a blockchain transaction with
156
+ * price-update such as trade execution, liquidation. Uses write price feed endpoints.
106
157
  * @param symbol symbol of perpetual, e.g., BTC-USD-MATIC
107
158
  * @returns PriceFeedSubmission, index prices, market closed information
108
159
  */
@@ -128,8 +179,9 @@ export default class PriceFeeds {
128
179
 
129
180
  /**
130
181
  * Get all prices/isMarketClosed for the provided symbols via
131
- * "latest_price_feeds" and triangulation. Triangulation must be defined in config, unless
132
- * it is a direct price feed.
182
+ * "latest_price_feeds" and triangulation. Triangulation must be defined in
183
+ * config, unless it is a direct price feed. Uses read endpoints.
184
+ * @param symbol perpetual symbol of the form BTC-USD-MATIC
133
185
  * @returns map of feed-price symbol to price/isMarketClosed
134
186
  */
135
187
  public async fetchPrices(symbols: string[]): Promise<Map<string, [number, boolean]>> {
@@ -179,8 +231,10 @@ export default class PriceFeeds {
179
231
  * Fetch the provided feed prices and bool whether market is closed or open
180
232
  * - requires the feeds to be defined in priceFeedConfig.json
181
233
  * - if symbols undefined, all feeds are queried
182
- * - vaas are not of interest here
183
- * @param symbols array of feed-price symbols (e.g., [btc-usd, eth-usd]) or undefined
234
+ * - vaas are not of interest here, therefore only readonly price feed
235
+ * endpoints are used
236
+ * @param symbols array of feed-price symbols (e.g., [btc-usd, eth-usd]) or
237
+ * undefined
184
238
  * @returns mapping symbol-> [price, isMarketClosed]
185
239
  */
186
240
  public async fetchFeedPrices(symbols?: string[]): Promise<Map<string, [number, boolean]>> {
@@ -249,7 +303,7 @@ export default class PriceFeeds {
249
303
  }
250
304
 
251
305
  /**
252
- * Get all configured feed prices via "latest_price_feeds"
306
+ * Get all configured feed prices via "latest_price_feeds".
253
307
  * @returns map of feed-price symbol to price/isMarketClosed
254
308
  */
255
309
  public async fetchAllFeedPrices(): Promise<Map<string, [number, boolean]>> {
@@ -258,10 +312,10 @@ export default class PriceFeeds {
258
312
 
259
313
  /**
260
314
  * Get the latest prices for a given perpetual from the offchain oracle
261
- * networks
315
+ * networks. Uses write price feed endpoints.
262
316
  * @param symbol perpetual symbol of the form BTC-USD-MATIC
263
- * @returns array of price feed updates that can be submitted to the smart contract
264
- * and corresponding price information
317
+ * @returns array of price feed updates that can be submitted to the smart
318
+ * contract and corresponding price information
265
319
  */
266
320
  public async fetchLatestFeedPriceInfoForPerpetual(symbol: string): Promise<PriceFeedSubmission> {
267
321
  // get the feedIds that the contract uses
@@ -277,7 +331,8 @@ export default class PriceFeeds {
277
331
  // and another
278
332
  let idx = info[0].endpointId;
279
333
  let feedId = feedIds[k];
280
- queries.push(this.feedEndpoints[idx] + "/v2/updates/price/latest?encoding=base64&ids[]=" + feedId);
334
+ queries.push(this.writeFeedEndpoints[idx] + "/v2/updates/price/latest?encoding=base64&ids[]=" + feedId);
335
+
281
336
  for (let j = 0; j < info.length; j++) {
282
337
  if (symbols.has(feedId)) {
283
338
  symbols[feedId].append(info[j].symbol);
@@ -481,11 +536,12 @@ export default class PriceFeeds {
481
536
  static _constructFeedInfo(
482
537
  config: PriceFeedConfig,
483
538
  shuffleEndpoints: boolean
484
- ): [Map<string, { symbol: string; endpointId: number }[]>, string[]] {
539
+ ): [Map<string, { symbol: string; endpointId: number }[]>, string[], string[]] {
485
540
  let feed = new Map<string, [{ symbol: string; endpointId: number }]>();
486
541
  let endpointId = -1;
487
542
  let type = "";
488
543
  let feedEndpoints = new Array<string>();
544
+ let writeFeedEndpoints = new Array<string>();
489
545
 
490
546
  for (let k = 0; k < config.endpoints.length; k++) {
491
547
  const L = config.endpoints[k].endpoints.length;
@@ -493,7 +549,13 @@ export default class PriceFeeds {
493
549
  // if config has only one endpoint:
494
550
  endpointNr = Math.min(endpointNr, L - 1);
495
551
  feedEndpoints.push(config.endpoints[k].endpoints[endpointNr]);
552
+
553
+ // write endpoints
554
+ const n = config.endpoints[k].writeEndpoints.length;
555
+ const useEndpoint = Math.min(!shuffleEndpoints ? 0 : 1 + Math.floor(Math.random() * (n - 1)), n - 1);
556
+ writeFeedEndpoints.push(config.endpoints[k].writeEndpoints[useEndpoint]);
496
557
  }
558
+
497
559
  for (let k = 0; k < config.ids.length; k++) {
498
560
  if (type != config.ids[k].type) {
499
561
  type = config.ids[k].type;
@@ -518,6 +580,6 @@ export default class PriceFeeds {
518
580
  feed.set(id, [item]);
519
581
  }
520
582
  }
521
- return [feed, feedEndpoints];
583
+ return [feed, feedEndpoints, writeFeedEndpoints];
522
584
  }
523
585
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const D8X_SDK_VERSION = "1.3.4";
1
+ export const D8X_SDK_VERSION = "1.3.6";
@@ -1,108 +0,0 @@
1
- /* Autogenerated file. Do not edit manually. */
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- import type { BaseContract, Signer, utils } from "ethers";
5
- import type { EventFragment } from "@ethersproject/abi";
6
- import type { Listener, Provider } from "@ethersproject/providers";
7
- import type {
8
- TypedEventFilter,
9
- TypedEvent,
10
- TypedListener,
11
- OnEvent,
12
- } from "./common";
13
-
14
- export interface BeaconProxyInterface extends utils.Interface {
15
- functions: {};
16
-
17
- events: {
18
- "AdminChanged(address,address)": EventFragment;
19
- "BeaconUpgraded(address)": EventFragment;
20
- "Upgraded(address)": EventFragment;
21
- };
22
-
23
- getEvent(nameOrSignatureOrTopic: "AdminChanged"): EventFragment;
24
- getEvent(nameOrSignatureOrTopic: "BeaconUpgraded"): EventFragment;
25
- getEvent(nameOrSignatureOrTopic: "Upgraded"): EventFragment;
26
- }
27
-
28
- export interface AdminChangedEventObject {
29
- previousAdmin: string;
30
- newAdmin: string;
31
- }
32
- export type AdminChangedEvent = TypedEvent<
33
- [string, string],
34
- AdminChangedEventObject
35
- >;
36
-
37
- export type AdminChangedEventFilter = TypedEventFilter<AdminChangedEvent>;
38
-
39
- export interface BeaconUpgradedEventObject {
40
- beacon: string;
41
- }
42
- export type BeaconUpgradedEvent = TypedEvent<
43
- [string],
44
- BeaconUpgradedEventObject
45
- >;
46
-
47
- export type BeaconUpgradedEventFilter = TypedEventFilter<BeaconUpgradedEvent>;
48
-
49
- export interface UpgradedEventObject {
50
- implementation: string;
51
- }
52
- export type UpgradedEvent = TypedEvent<[string], UpgradedEventObject>;
53
-
54
- export type UpgradedEventFilter = TypedEventFilter<UpgradedEvent>;
55
-
56
- export interface BeaconProxy extends BaseContract {
57
- connect(signerOrProvider: Signer | Provider | string): this;
58
- attach(addressOrName: string): this;
59
- deployed(): Promise<this>;
60
-
61
- interface: BeaconProxyInterface;
62
-
63
- queryFilter<TEvent extends TypedEvent>(
64
- event: TypedEventFilter<TEvent>,
65
- fromBlockOrBlockhash?: string | number | undefined,
66
- toBlock?: string | number | undefined
67
- ): Promise<Array<TEvent>>;
68
-
69
- listeners<TEvent extends TypedEvent>(
70
- eventFilter?: TypedEventFilter<TEvent>
71
- ): Array<TypedListener<TEvent>>;
72
- listeners(eventName?: string): Array<Listener>;
73
- removeAllListeners<TEvent extends TypedEvent>(
74
- eventFilter: TypedEventFilter<TEvent>
75
- ): this;
76
- removeAllListeners(eventName?: string): this;
77
- off: OnEvent<this>;
78
- on: OnEvent<this>;
79
- once: OnEvent<this>;
80
- removeListener: OnEvent<this>;
81
-
82
- functions: {};
83
-
84
- callStatic: {};
85
-
86
- filters: {
87
- "AdminChanged(address,address)"(
88
- previousAdmin?: null,
89
- newAdmin?: null
90
- ): AdminChangedEventFilter;
91
- AdminChanged(
92
- previousAdmin?: null,
93
- newAdmin?: null
94
- ): AdminChangedEventFilter;
95
-
96
- "BeaconUpgraded(address)"(
97
- beacon?: string | null
98
- ): BeaconUpgradedEventFilter;
99
- BeaconUpgraded(beacon?: string | null): BeaconUpgradedEventFilter;
100
-
101
- "Upgraded(address)"(implementation?: string | null): UpgradedEventFilter;
102
- Upgraded(implementation?: string | null): UpgradedEventFilter;
103
- };
104
-
105
- estimateGas: {};
106
-
107
- populateTransaction: {};
108
- }