@sentio/sdk 2.18.0 → 2.18.1-rc.10

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 (40) hide show
  1. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js +49 -23
  2. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js.map +1 -1
  3. package/lib/eth/builtin/internal/erc1155-processor.js +19 -8
  4. package/lib/eth/builtin/internal/erc1155-processor.js.map +1 -1
  5. package/lib/eth/builtin/internal/erc20-processor.js +39 -18
  6. package/lib/eth/builtin/internal/erc20-processor.js.map +1 -1
  7. package/lib/eth/builtin/internal/erc20bytes-processor.js +21 -9
  8. package/lib/eth/builtin/internal/erc20bytes-processor.js.map +1 -1
  9. package/lib/eth/builtin/internal/erc721-processor.js +31 -14
  10. package/lib/eth/builtin/internal/erc721-processor.js.map +1 -1
  11. package/lib/eth/builtin/internal/weth9-processor.js +25 -11
  12. package/lib/eth/builtin/internal/weth9-processor.js.map +1 -1
  13. package/lib/eth/codegen/file.js +4 -1
  14. package/lib/eth/codegen/file.js.map +1 -1
  15. package/lib/eth/codegen/function-calls.js +2 -1
  16. package/lib/eth/codegen/function-calls.js.map +1 -1
  17. package/lib/eth/eth.d.ts +2 -2
  18. package/lib/eth/eth.js +12 -13
  19. package/lib/eth/eth.js.map +1 -1
  20. package/lib/eth/provider.js +1 -1
  21. package/lib/eth/provider.js.map +1 -1
  22. package/lib/utils/call.d.ts +6 -0
  23. package/lib/utils/call.js +21 -0
  24. package/lib/utils/call.js.map +1 -0
  25. package/lib/utils/index.d.ts +1 -0
  26. package/lib/utils/index.js +1 -0
  27. package/lib/utils/index.js.map +1 -1
  28. package/package.json +3 -3
  29. package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +50 -24
  30. package/src/eth/builtin/internal/erc1155-processor.ts +20 -9
  31. package/src/eth/builtin/internal/erc20-processor.ts +40 -19
  32. package/src/eth/builtin/internal/erc20bytes-processor.ts +22 -10
  33. package/src/eth/builtin/internal/erc721-processor.ts +32 -15
  34. package/src/eth/builtin/internal/weth9-processor.ts +26 -12
  35. package/src/eth/codegen/file.ts +4 -1
  36. package/src/eth/codegen/function-calls.ts +2 -1
  37. package/src/eth/eth.ts +11 -13
  38. package/src/eth/provider.ts +1 -1
  39. package/src/utils/call.ts +20 -0
  40. package/src/utils/index.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/eth/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAY,MAAM,QAAQ,CAAA;AAE3D,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,eAAe,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;AAErE,MAAM,SAAS,GAAG,IAAI,GAAG,EAA2B,CAAA;AAEpD,oFAAoF;AACpF,uBAAuB;AACvB,uCAAuC;AACvC,MAAM;AACN,6CAA6C;AAC7C,2CAA2C;AAC3C,MAAM;AACN,sBAAsB;AACtB,IAAI;AAEJ,MAAM,UAAU,WAAW,CAAC,OAAoB;IAC9C,4DAA4D;IAC5D,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAA;KAC9B;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAA;IAC/C,iCAAiC;IAEjC,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IAC3D,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,GAAG,GAAG,OAAO,CAA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,CAAC,CAAC,IAAI,KAAK,gBAAgB,EAAE;oBAC/B,UAAU,CAAC,GAAG,EAAE;wBACd,IAAI,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,OAAO,EAAE;4BAC3C,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;yBAC/B;oBACH,CAAC,EAAE,IAAI,CAAC,CAAA;iBACT;YACH,CAAC,CAAC,CAAA;YACF,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;YACpC,qFAAqF;YACrF,IAAI,KAAK,KAAK,QAAQ,EAAE;gBACtB,UAAU,CAAC,GAAG,EAAE;oBACd,IAAI,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,OAAO,EAAE;wBAC3C,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;qBAC/B;gBACH,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,CAAA;aACd;SACF;QAED,MAAM,MAAM,GAAG,MAAM,OAAO,CAAA;QAC5B,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,KAAK,CAAC,0BAA0B,CAAC,CAAA;SACxC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import { JsonRpcProvider, Network, Provider } from 'ethers'\n\nimport PQueue from 'p-queue'\nimport { Endpoints } from '@sentio/runtime'\nimport { EthChainId } from '../core/chain.js'\n\nexport const DummyProvider = new JsonRpcProvider('', Network.from(1))\n\nconst providers = new Map<string, JsonRpcProvider>()\n\n// export function getEthChainId(networkish?: EthContext | EthChainId): EthChainId {\n// if (!networkish) {\n// networkish = EthChainId.ETHEREUM\n// }\n// if (networkish instanceof BaseContext) {\n// networkish = networkish.getChainId()\n// }\n// return networkish\n// }\n\nexport function getProvider(chainId?: EthChainId): Provider {\n // const network = getNetworkFromCtxOrNetworkish(networkish)\n if (!chainId) {\n chainId = EthChainId.ETHEREUM\n }\n const network = Network.from(parseInt(chainId))\n // TODO check if other key needed\n\n const address = Endpoints.INSTANCE.chainServer.get(chainId)\n const key = network.chainId.toString() + '-' + address\n let provider = providers.get(key)\n\n if (provider) {\n return provider\n }\n\n if (address === undefined) {\n throw Error(\n 'Provider not found for chain ' +\n network.chainId +\n ', configured chains: ' +\n [...Endpoints.INSTANCE.chainServer.keys()].join(' ')\n )\n }\n provider = new QueuedStaticJsonRpcProvider(address, network, Endpoints.INSTANCE.concurrency)\n providers.set(network.chainId.toString(), provider)\n return provider\n}\n\nfunction getTag(prefix: string, value: any): string {\n return (\n prefix +\n ':' +\n JSON.stringify(value, (k, v) => {\n if (v == null) {\n return 'null'\n }\n if (typeof v === 'bigint') {\n return `bigint:${v.toString()}`\n }\n if (typeof v === 'string') {\n return v.toLowerCase()\n }\n\n // Sort object keys\n if (typeof v === 'object' && !Array.isArray(v)) {\n const keys = Object.keys(v)\n keys.sort()\n return keys.reduce((accum, key) => {\n accum[key] = v[key]\n return accum\n }, <any>{})\n }\n\n return v\n })\n )\n}\n\nclass QueuedStaticJsonRpcProvider extends JsonRpcProvider {\n executor: PQueue\n #performCache = new Map<string, Promise<any>>()\n\n constructor(url: string, network: Network, concurrency: number) {\n // TODO re-enable match when possible\n super(url, network, { staticNetwork: network, batchMaxCount: 1 })\n this.executor = new PQueue({ concurrency: concurrency })\n }\n\n async send(method: string, params: Array<any>): Promise<any> {\n if (method !== 'eth_call') {\n return super.send(method, params)\n }\n const tag = getTag(method, params)\n const block = params[params.length - 1]\n let perform = this.#performCache.get(tag)\n if (!perform) {\n perform = this.executor.add(() => super.send(method, params))\n perform.catch((e) => {\n if (e.code !== 'CALL_EXCEPTION') {\n setTimeout(() => {\n if (this.#performCache.get(tag) === perform) {\n this.#performCache.delete(tag)\n }\n }, 1000)\n }\n })\n this.#performCache.set(tag, perform)\n // For non latest block call, we cache permanently, otherwise we cache for one minute\n if (block === 'latest') {\n setTimeout(() => {\n if (this.#performCache.get(tag) === perform) {\n this.#performCache.delete(tag)\n }\n }, 60 * 1000)\n }\n }\n\n const result = await perform\n if (!result) {\n throw Error('Unexpected null response')\n }\n return result\n }\n}\n"]}
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/eth/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAY,MAAM,QAAQ,CAAA;AAE3D,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,eAAe,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;AAErE,MAAM,SAAS,GAAG,IAAI,GAAG,EAA2B,CAAA;AAEpD,oFAAoF;AACpF,uBAAuB;AACvB,uCAAuC;AACvC,MAAM;AACN,6CAA6C;AAC7C,2CAA2C;AAC3C,MAAM;AACN,sBAAsB;AACtB,IAAI;AAEJ,MAAM,UAAU,WAAW,CAAC,OAAoB;IAC9C,4DAA4D;IAC5D,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAA;KAC9B;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAA;IAC/C,iCAAiC;IAEjC,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IAC3D,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,GAAG,GAAG,OAAO,CAAA;IACtD,IAAI,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAEjC,IAAI,QAAQ,EAAE;QACZ,OAAO,QAAQ,CAAA;KAChB;IAED,IAAI,OAA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,GAAG,CAAC,GAAG,CAAC,KAAK,OAAO,EAAE;4BAC3C,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;yBAC/B;oBACH,CAAC,EAAE,IAAI,CAAC,CAAA;iBACT;YACH,CAAC,CAAC,CAAA;YACF,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;YACpC,qFAAqF;YACrF,IAAI,KAAK,KAAK,QAAQ,EAAE;gBACtB,UAAU,CAAC,GAAG,EAAE;oBACd,IAAI,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,OAAO,EAAE;wBAC3C,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;qBAC/B;gBACH,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,CAAA;aACd;SACF;QAED,MAAM,MAAM,GAAG,MAAM,OAAO,CAAA;QAC5B,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,KAAK,CAAC,0BAA0B,CAAC,CAAA;SACxC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import { JsonRpcProvider, Network, Provider } from 'ethers'\n\nimport PQueue from 'p-queue'\nimport { Endpoints } from '@sentio/runtime'\nimport { EthChainId } from '../core/chain.js'\n\nexport const DummyProvider = new JsonRpcProvider('', Network.from(1))\n\nconst providers = new Map<string, JsonRpcProvider>()\n\n// export function getEthChainId(networkish?: EthContext | EthChainId): EthChainId {\n// if (!networkish) {\n// networkish = EthChainId.ETHEREUM\n// }\n// if (networkish instanceof BaseContext) {\n// networkish = networkish.getChainId()\n// }\n// return networkish\n// }\n\nexport function getProvider(chainId?: EthChainId): Provider {\n // const network = getNetworkFromCtxOrNetworkish(networkish)\n if (!chainId) {\n chainId = EthChainId.ETHEREUM\n }\n const network = Network.from(parseInt(chainId))\n // TODO check if other key needed\n\n const address = Endpoints.INSTANCE.chainServer.get(chainId)\n const key = network.chainId.toString() + '-' + address\n let provider = providers.get(key)\n\n if (provider) {\n return provider\n }\n\n if (address === undefined) {\n throw Error(\n 'Provider not found for chain ' +\n network.chainId +\n ', configured chains: ' +\n [...Endpoints.INSTANCE.chainServer.keys()].join(' ')\n )\n }\n provider = new QueuedStaticJsonRpcProvider(address, network, Endpoints.INSTANCE.concurrency)\n providers.set(network.chainId.toString(), provider)\n return provider\n}\n\nfunction getTag(prefix: string, value: any): string {\n return (\n prefix +\n ':' +\n JSON.stringify(value, (k, v) => {\n if (v == null) {\n return 'null'\n }\n if (typeof v === 'bigint') {\n return `bigint:${v.toString()}`\n }\n if (typeof v === 'string') {\n return v.toLowerCase()\n }\n\n // Sort object keys\n if (typeof v === 'object' && !Array.isArray(v)) {\n const keys = Object.keys(v)\n keys.sort()\n return keys.reduce((accum, key) => {\n accum[key] = v[key]\n return accum\n }, <any>{})\n }\n\n return v\n })\n )\n}\n\nclass QueuedStaticJsonRpcProvider extends JsonRpcProvider {\n executor: PQueue\n #performCache = new Map<string, Promise<any>>()\n\n constructor(url: string, network: Network, concurrency: number) {\n // TODO re-enable match when possible\n super(url, network, { staticNetwork: network, batchMaxCount: 1 })\n this.executor = new PQueue({ concurrency: concurrency })\n }\n\n async send(method: string, params: Array<any>): Promise<any> {\n if (method !== 'eth_call') {\n return super.send(method, params)\n }\n const tag = getTag(method, params)\n const block = params[params.length - 1]\n let perform = this.#performCache.get(tag)\n if (!perform) {\n perform = this.executor.add(() => super.send(method, params))\n perform.catch((e) => {\n if (e.code !== 'CALL_EXCEPTION' && e.code !== 'BAD_DATA') {\n setTimeout(() => {\n if (this.#performCache.get(tag) === perform) {\n this.#performCache.delete(tag)\n }\n }, 1000)\n }\n })\n this.#performCache.set(tag, perform)\n // For non latest block call, we cache permanently, otherwise we cache for one minute\n if (block === 'latest') {\n setTimeout(() => {\n if (this.#performCache.get(tag) === perform) {\n this.#performCache.delete(tag)\n }\n }, 60 * 1000)\n }\n }\n\n const result = await perform\n if (!result) {\n throw Error('Unexpected null response')\n }\n return result\n }\n}\n"]}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * ignore eth call exception and return undefined if that happened
3
+ * @param promise promise return by eth call
4
+ * @param logError whether to log error
5
+ */
6
+ export declare function ignoreEthCallException<Res>(promise: Promise<Res>, logError?: boolean): Promise<Res | undefined>;
@@ -0,0 +1,21 @@
1
+ import { SimpleEthersError } from '../eth/index.js';
2
+ /**
3
+ * ignore eth call exception and return undefined if that happened
4
+ * @param promise promise return by eth call
5
+ * @param logError whether to log error
6
+ */
7
+ export async function ignoreEthCallException(promise, logError = false) {
8
+ try {
9
+ return await promise;
10
+ }
11
+ catch (err) {
12
+ if (err instanceof SimpleEthersError || err.code === 'CALL_EXCEPTION' || err.code === 'BAD_DATA') {
13
+ if (logError) {
14
+ console.error('eth call exception, return undefined', err);
15
+ }
16
+ return undefined;
17
+ }
18
+ throw err;
19
+ }
20
+ }
21
+ //# sourceMappingURL=call.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call.js","sourceRoot":"","sources":["../../src/utils/call.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAEnD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAM,OAAqB,EAAE,QAAQ,GAAG,KAAK;IACvF,IAAI;QACF,OAAO,MAAM,OAAO,CAAA;KACrB;IAAC,OAAO,GAAG,EAAE;QACZ,IAAI,GAAG,YAAY,iBAAiB,IAAI,GAAG,CAAC,IAAI,KAAK,gBAAgB,IAAI,GAAG,CAAC,IAAI,KAAK,UAAU,EAAE;YAChG,IAAI,QAAQ,EAAE;gBACZ,OAAO,CAAC,KAAK,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAA;aAC3D;YACD,OAAO,SAAS,CAAA;SACjB;QACD,MAAM,GAAG,CAAA;KACV;AACH,CAAC","sourcesContent":["import { SimpleEthersError } from '../eth/index.js'\n\n/**\n * ignore eth call exception and return undefined if that happened\n * @param promise promise return by eth call\n * @param logError whether to log error\n */\nexport async function ignoreEthCallException<Res>(promise: Promise<Res>, logError = false): Promise<Res | undefined> {\n try {\n return await promise\n } catch (err) {\n if (err instanceof SimpleEthersError || err.code === 'CALL_EXCEPTION' || err.code === 'BAD_DATA') {\n if (logError) {\n console.error('eth call exception, return undefined', err)\n }\n return undefined\n }\n throw err\n }\n}\n"]}
@@ -2,3 +2,4 @@ export * from './conversion.js';
2
2
  export * as token from './token.js';
3
3
  export * from './dex-price.js';
4
4
  export { getPriceByType, getPriceClient, getPriceBySymbol } from './price.js';
5
+ export * from './call.js';
@@ -2,4 +2,5 @@ export * from './conversion.js';
2
2
  export * as token from './token.js';
3
3
  export * from './dex-price.js';
4
4
  export { getPriceByType, getPriceClient, getPriceBySymbol } from './price.js';
5
+ export * from './call.js';
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA","sourcesContent":["export * from './conversion.js'\nexport * as token from './token.js'\nexport * from './dex-price.js'\nexport { getPriceByType, getPriceClient, getPriceBySymbol } from './price.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7E,cAAc,WAAW,CAAA","sourcesContent":["export * from './conversion.js'\nexport * as token from './token.js'\nexport * from './dex-price.js'\nexport { getPriceByType, getPriceClient, getPriceBySymbol } from './price.js'\nexport * from './call.js'\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentio/sdk",
3
- "version": "2.18.0",
3
+ "version": "2.18.1-rc.10",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -71,8 +71,8 @@
71
71
  "typedoc": "^0.24.1",
72
72
  "utility-types": "^3.10.0",
73
73
  "yaml": "^2.2.1",
74
- "@sentio/protos": "2.18.0",
75
- "@sentio/runtime": "^2.18.0"
74
+ "@sentio/protos": "2.18.1-rc.10",
75
+ "@sentio/runtime": "^2.18.1-rc.10"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "tsup": "npm:@sentio/tsup@^6.7.0"
@@ -197,36 +197,40 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
197
197
  }
198
198
 
199
199
  async accessController(overrides?: Overrides): Promise<string> {
200
+ const stack = new Error().stack;
200
201
  try {
201
202
  return await this.contract.getFunction("accessController()")(
202
203
  overrides || {}
203
204
  );
204
205
  } catch (e) {
205
- throw transformEtherError(e, undefined);
206
+ throw transformEtherError(e, undefined, stack);
206
207
  }
207
208
  }
208
209
 
209
210
  async aggregator(overrides?: Overrides): Promise<string> {
211
+ const stack = new Error().stack;
210
212
  try {
211
213
  return await this.contract.getFunction("aggregator()")(overrides || {});
212
214
  } catch (e) {
213
- throw transformEtherError(e, undefined);
215
+ throw transformEtherError(e, undefined, stack);
214
216
  }
215
217
  }
216
218
 
217
219
  async decimals(overrides?: Overrides): Promise<bigint> {
220
+ const stack = new Error().stack;
218
221
  try {
219
222
  return await this.contract.getFunction("decimals()")(overrides || {});
220
223
  } catch (e) {
221
- throw transformEtherError(e, undefined);
224
+ throw transformEtherError(e, undefined, stack);
222
225
  }
223
226
  }
224
227
 
225
228
  async description(overrides?: Overrides): Promise<string> {
229
+ const stack = new Error().stack;
226
230
  try {
227
231
  return await this.contract.getFunction("description()")(overrides || {});
228
232
  } catch (e) {
229
- throw transformEtherError(e, undefined);
233
+ throw transformEtherError(e, undefined, stack);
230
234
  }
231
235
  }
232
236
 
@@ -234,13 +238,14 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
234
238
  _roundId: BigNumberish,
235
239
  overrides?: Overrides
236
240
  ): Promise<bigint> {
241
+ const stack = new Error().stack;
237
242
  try {
238
243
  return await this.contract.getFunction("getAnswer(uint256)")(
239
244
  _roundId,
240
245
  overrides || {}
241
246
  );
242
247
  } catch (e) {
243
- throw transformEtherError(e, undefined);
248
+ throw transformEtherError(e, undefined, stack);
244
249
  }
245
250
  }
246
251
 
@@ -256,13 +261,14 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
256
261
  answeredInRound: bigint;
257
262
  }
258
263
  > {
264
+ const stack = new Error().stack;
259
265
  try {
260
266
  return await this.contract.getFunction("getRoundData(uint80)")(
261
267
  _roundId,
262
268
  overrides || {}
263
269
  );
264
270
  } catch (e) {
265
- throw transformEtherError(e, undefined);
271
+ throw transformEtherError(e, undefined, stack);
266
272
  }
267
273
  }
268
274
 
@@ -270,29 +276,32 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
270
276
  _roundId: BigNumberish,
271
277
  overrides?: Overrides
272
278
  ): Promise<bigint> {
279
+ const stack = new Error().stack;
273
280
  try {
274
281
  return await this.contract.getFunction("getTimestamp(uint256)")(
275
282
  _roundId,
276
283
  overrides || {}
277
284
  );
278
285
  } catch (e) {
279
- throw transformEtherError(e, undefined);
286
+ throw transformEtherError(e, undefined, stack);
280
287
  }
281
288
  }
282
289
 
283
290
  async latestAnswer(overrides?: Overrides): Promise<bigint> {
291
+ const stack = new Error().stack;
284
292
  try {
285
293
  return await this.contract.getFunction("latestAnswer()")(overrides || {});
286
294
  } catch (e) {
287
- throw transformEtherError(e, undefined);
295
+ throw transformEtherError(e, undefined, stack);
288
296
  }
289
297
  }
290
298
 
291
299
  async latestRound(overrides?: Overrides): Promise<bigint> {
300
+ const stack = new Error().stack;
292
301
  try {
293
302
  return await this.contract.getFunction("latestRound()")(overrides || {});
294
303
  } catch (e) {
295
- throw transformEtherError(e, undefined);
304
+ throw transformEtherError(e, undefined, stack);
296
305
  }
297
306
  }
298
307
 
@@ -307,30 +316,33 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
307
316
  answeredInRound: bigint;
308
317
  }
309
318
  > {
319
+ const stack = new Error().stack;
310
320
  try {
311
321
  return await this.contract.getFunction("latestRoundData()")(
312
322
  overrides || {}
313
323
  );
314
324
  } catch (e) {
315
- throw transformEtherError(e, undefined);
325
+ throw transformEtherError(e, undefined, stack);
316
326
  }
317
327
  }
318
328
 
319
329
  async latestTimestamp(overrides?: Overrides): Promise<bigint> {
330
+ const stack = new Error().stack;
320
331
  try {
321
332
  return await this.contract.getFunction("latestTimestamp()")(
322
333
  overrides || {}
323
334
  );
324
335
  } catch (e) {
325
- throw transformEtherError(e, undefined);
336
+ throw transformEtherError(e, undefined, stack);
326
337
  }
327
338
  }
328
339
 
329
340
  async owner(overrides?: Overrides): Promise<string> {
341
+ const stack = new Error().stack;
330
342
  try {
331
343
  return await this.contract.getFunction("owner()")(overrides || {});
332
344
  } catch (e) {
333
- throw transformEtherError(e, undefined);
345
+ throw transformEtherError(e, undefined, stack);
334
346
  }
335
347
  }
336
348
 
@@ -338,31 +350,34 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
338
350
  arg0: BigNumberish,
339
351
  overrides?: Overrides
340
352
  ): Promise<string> {
353
+ const stack = new Error().stack;
341
354
  try {
342
355
  return await this.contract.getFunction("phaseAggregators(uint16)")(
343
356
  arg0,
344
357
  overrides || {}
345
358
  );
346
359
  } catch (e) {
347
- throw transformEtherError(e, undefined);
360
+ throw transformEtherError(e, undefined, stack);
348
361
  }
349
362
  }
350
363
 
351
364
  async phaseId(overrides?: Overrides): Promise<bigint> {
365
+ const stack = new Error().stack;
352
366
  try {
353
367
  return await this.contract.getFunction("phaseId()")(overrides || {});
354
368
  } catch (e) {
355
- throw transformEtherError(e, undefined);
369
+ throw transformEtherError(e, undefined, stack);
356
370
  }
357
371
  }
358
372
 
359
373
  async proposedAggregator(overrides?: Overrides): Promise<string> {
374
+ const stack = new Error().stack;
360
375
  try {
361
376
  return await this.contract.getFunction("proposedAggregator()")(
362
377
  overrides || {}
363
378
  );
364
379
  } catch (e) {
365
- throw transformEtherError(e, undefined);
380
+ throw transformEtherError(e, undefined, stack);
366
381
  }
367
382
  }
368
383
 
@@ -378,13 +393,14 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
378
393
  answeredInRound: bigint;
379
394
  }
380
395
  > {
396
+ const stack = new Error().stack;
381
397
  try {
382
398
  return await this.contract.getFunction("proposedGetRoundData(uint80)")(
383
399
  _roundId,
384
400
  overrides || {}
385
401
  );
386
402
  } catch (e) {
387
- throw transformEtherError(e, undefined);
403
+ throw transformEtherError(e, undefined, stack);
388
404
  }
389
405
  }
390
406
 
@@ -399,20 +415,22 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
399
415
  answeredInRound: bigint;
400
416
  }
401
417
  > {
418
+ const stack = new Error().stack;
402
419
  try {
403
420
  return await this.contract.getFunction("proposedLatestRoundData()")(
404
421
  overrides || {}
405
422
  );
406
423
  } catch (e) {
407
- throw transformEtherError(e, undefined);
424
+ throw transformEtherError(e, undefined, stack);
408
425
  }
409
426
  }
410
427
 
411
428
  async version(overrides?: Overrides): Promise<bigint> {
429
+ const stack = new Error().stack;
412
430
  try {
413
431
  return await this.contract.getFunction("version()")(overrides || {});
414
432
  } catch (e) {
415
- throw transformEtherError(e, undefined);
433
+ throw transformEtherError(e, undefined, stack);
416
434
  }
417
435
  }
418
436
 
@@ -420,57 +438,62 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
420
438
  contract: this.contract,
421
439
 
422
440
  async acceptOwnership(overrides?: Overrides): Promise<void> {
441
+ const stack = new Error().stack;
423
442
  try {
424
443
  return await this.contract
425
444
  .getFunction("acceptOwnership()")
426
445
  .staticCall(overrides || {});
427
446
  } catch (e) {
428
- throw transformEtherError(e, undefined);
447
+ throw transformEtherError(e, undefined, stack);
429
448
  }
430
449
  },
431
450
  async confirmAggregator(
432
451
  _aggregator: string,
433
452
  overrides?: Overrides
434
453
  ): Promise<void> {
454
+ const stack = new Error().stack;
435
455
  try {
436
456
  return await this.contract
437
457
  .getFunction("confirmAggregator(address)")
438
458
  .staticCall(_aggregator, overrides || {});
439
459
  } catch (e) {
440
- throw transformEtherError(e, undefined);
460
+ throw transformEtherError(e, undefined, stack);
441
461
  }
442
462
  },
443
463
  async proposeAggregator(
444
464
  _aggregator: string,
445
465
  overrides?: Overrides
446
466
  ): Promise<void> {
467
+ const stack = new Error().stack;
447
468
  try {
448
469
  return await this.contract
449
470
  .getFunction("proposeAggregator(address)")
450
471
  .staticCall(_aggregator, overrides || {});
451
472
  } catch (e) {
452
- throw transformEtherError(e, undefined);
473
+ throw transformEtherError(e, undefined, stack);
453
474
  }
454
475
  },
455
476
  async setController(
456
477
  _accessController: string,
457
478
  overrides?: Overrides
458
479
  ): Promise<void> {
480
+ const stack = new Error().stack;
459
481
  try {
460
482
  return await this.contract
461
483
  .getFunction("setController(address)")
462
484
  .staticCall(_accessController, overrides || {});
463
485
  } catch (e) {
464
- throw transformEtherError(e, undefined);
486
+ throw transformEtherError(e, undefined, stack);
465
487
  }
466
488
  },
467
489
  async transferOwnership(_to: string, overrides?: Overrides): Promise<void> {
490
+ const stack = new Error().stack;
468
491
  try {
469
492
  return await this.contract
470
493
  .getFunction("transferOwnership(address)")
471
494
  .staticCall(_to, overrides || {});
472
495
  } catch (e) {
473
- throw transformEtherError(e, undefined);
496
+ throw transformEtherError(e, undefined, stack);
474
497
  }
475
498
  },
476
499
  };
@@ -1161,6 +1184,9 @@ export function getEACAggregatorProxyContractOnContext(
1161
1184
  ): EACAggregatorProxyBoundContractView {
1162
1185
  const view = getEACAggregatorProxyContract(context.getChainId(), address);
1163
1186
  const boundView = new EACAggregatorProxyBoundContractView(address, view);
1164
- boundView.context = context as any;
1187
+ boundView.context = context;
1188
+ if (boundView.callStatic) {
1189
+ boundView.callStatic.context = context;
1190
+ }
1165
1191
  return boundView;
1166
1192
  }
@@ -129,6 +129,7 @@ export class ERC1155ContractView extends ContractView<ERC1155> {
129
129
  id: BigNumberish,
130
130
  overrides?: Overrides
131
131
  ): Promise<bigint> {
132
+ const stack = new Error().stack;
132
133
  try {
133
134
  return await this.contract.getFunction("balanceOf(address,uint256)")(
134
135
  account,
@@ -136,7 +137,7 @@ export class ERC1155ContractView extends ContractView<ERC1155> {
136
137
  overrides || {}
137
138
  );
138
139
  } catch (e) {
139
- throw transformEtherError(e, undefined);
140
+ throw transformEtherError(e, undefined, stack);
140
141
  }
141
142
  }
142
143
 
@@ -145,12 +146,13 @@ export class ERC1155ContractView extends ContractView<ERC1155> {
145
146
  ids: BigNumberish[],
146
147
  overrides?: Overrides
147
148
  ): Promise<bigint[]> {
149
+ const stack = new Error().stack;
148
150
  try {
149
151
  return await this.contract.getFunction(
150
152
  "balanceOfBatch(address[],uint256[])"
151
153
  )(accounts, ids, overrides || {});
152
154
  } catch (e) {
153
- throw transformEtherError(e, undefined);
155
+ throw transformEtherError(e, undefined, stack);
154
156
  }
155
157
  }
156
158
 
@@ -159,12 +161,13 @@ export class ERC1155ContractView extends ContractView<ERC1155> {
159
161
  operator: string,
160
162
  overrides?: Overrides
161
163
  ): Promise<boolean> {
164
+ const stack = new Error().stack;
162
165
  try {
163
166
  return await this.contract.getFunction(
164
167
  "isApprovedForAll(address,address)"
165
168
  )(account, operator, overrides || {});
166
169
  } catch (e) {
167
- throw transformEtherError(e, undefined);
170
+ throw transformEtherError(e, undefined, stack);
168
171
  }
169
172
  }
170
173
 
@@ -172,24 +175,26 @@ export class ERC1155ContractView extends ContractView<ERC1155> {
172
175
  interfaceId: BytesLike,
173
176
  overrides?: Overrides
174
177
  ): Promise<boolean> {
178
+ const stack = new Error().stack;
175
179
  try {
176
180
  return await this.contract.getFunction("supportsInterface(bytes4)")(
177
181
  interfaceId,
178
182
  overrides || {}
179
183
  );
180
184
  } catch (e) {
181
- throw transformEtherError(e, undefined);
185
+ throw transformEtherError(e, undefined, stack);
182
186
  }
183
187
  }
184
188
 
185
189
  async uri(id: BigNumberish, overrides?: Overrides): Promise<string> {
190
+ const stack = new Error().stack;
186
191
  try {
187
192
  return await this.contract.getFunction("uri(uint256)")(
188
193
  id,
189
194
  overrides || {}
190
195
  );
191
196
  } catch (e) {
192
- throw transformEtherError(e, undefined);
197
+ throw transformEtherError(e, undefined, stack);
193
198
  }
194
199
  }
195
200
 
@@ -204,6 +209,7 @@ export class ERC1155ContractView extends ContractView<ERC1155> {
204
209
  data: BytesLike,
205
210
  overrides?: Overrides
206
211
  ): Promise<void> {
212
+ const stack = new Error().stack;
207
213
  try {
208
214
  return await this.contract
209
215
  .getFunction(
@@ -211,7 +217,7 @@ export class ERC1155ContractView extends ContractView<ERC1155> {
211
217
  )
212
218
  .staticCall(from, to, ids, amounts, data, overrides || {});
213
219
  } catch (e) {
214
- throw transformEtherError(e, undefined);
220
+ throw transformEtherError(e, undefined, stack);
215
221
  }
216
222
  },
217
223
  async safeTransferFrom(
@@ -222,6 +228,7 @@ export class ERC1155ContractView extends ContractView<ERC1155> {
222
228
  data: BytesLike,
223
229
  overrides?: Overrides
224
230
  ): Promise<void> {
231
+ const stack = new Error().stack;
225
232
  try {
226
233
  return await this.contract
227
234
  .getFunction(
@@ -229,7 +236,7 @@ export class ERC1155ContractView extends ContractView<ERC1155> {
229
236
  )
230
237
  .staticCall(from, to, id, amount, data, overrides || {});
231
238
  } catch (e) {
232
- throw transformEtherError(e, undefined);
239
+ throw transformEtherError(e, undefined, stack);
233
240
  }
234
241
  },
235
242
  async setApprovalForAll(
@@ -237,12 +244,13 @@ export class ERC1155ContractView extends ContractView<ERC1155> {
237
244
  approved: boolean,
238
245
  overrides?: Overrides
239
246
  ): Promise<void> {
247
+ const stack = new Error().stack;
240
248
  try {
241
249
  return await this.contract
242
250
  .getFunction("setApprovalForAll(address,bool)")
243
251
  .staticCall(operator, approved, overrides || {});
244
252
  } catch (e) {
245
- throw transformEtherError(e, undefined);
253
+ throw transformEtherError(e, undefined, stack);
246
254
  }
247
255
  },
248
256
  };
@@ -625,6 +633,9 @@ export function getERC1155ContractOnContext(
625
633
  ): ERC1155BoundContractView {
626
634
  const view = getERC1155Contract(context.getChainId(), address);
627
635
  const boundView = new ERC1155BoundContractView(address, view);
628
- boundView.context = context as any;
636
+ boundView.context = context;
637
+ if (boundView.callStatic) {
638
+ boundView.callStatic.context = context;
639
+ }
629
640
  return boundView;
630
641
  }