@sentio/sdk 2.18.1-rc.3 → 2.18.1-rc.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * ignore eth call exception and return undefined if that happened
3
+ * @param call
4
+ */
5
+ export declare function ethCallIgnoreException<Res>(call: () => Promise<Res>): Promise<Res | undefined>;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * ignore eth call exception and return undefined if that happened
3
+ * @param call
4
+ */
5
+ export async function ethCallIgnoreException(call) {
6
+ try {
7
+ return await call();
8
+ }
9
+ catch (err) {
10
+ if (err.code === 'CALL_EXCEPTION') {
11
+ console.log('eth call exception, return undefined', err);
12
+ return undefined;
13
+ }
14
+ throw err;
15
+ }
16
+ }
17
+ //# sourceMappingURL=call.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call.js","sourceRoot":"","sources":["../../src/utils/call.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAM,IAAwB;IACxE,IAAI;QACF,OAAO,MAAM,IAAI,EAAE,CAAA;KACpB;IAAC,OAAO,GAAG,EAAE;QACZ,IAAI,GAAG,CAAC,IAAI,KAAK,gBAAgB,EAAE;YACjC,OAAO,CAAC,GAAG,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAA;YACxD,OAAO,SAAS,CAAA;SACjB;QACD,MAAM,GAAG,CAAA;KACV;AACH,CAAC","sourcesContent":["/**\n * ignore eth call exception and return undefined if that happened\n * @param call\n */\nexport async function ethCallIgnoreException<Res>(call: () => Promise<Res>): Promise<Res | undefined> {\n try {\n return await call()\n } catch (err) {\n if (err.code === 'CALL_EXCEPTION') {\n console.log('eth call exception, return undefined', err)\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.1-rc.3",
3
+ "version": "2.18.1-rc.5",
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.1-rc.3",
75
- "@sentio/runtime": "^2.18.1-rc.3"
74
+ "@sentio/protos": "2.18.1-rc.5",
75
+ "@sentio/runtime": "^2.18.1-rc.5"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "tsup": "npm:@sentio/tsup@^6.7.0"
@@ -0,0 +1,15 @@
1
+ /**
2
+ * ignore eth call exception and return undefined if that happened
3
+ * @param call
4
+ */
5
+ export async function ethCallIgnoreException<Res>(call: () => Promise<Res>): Promise<Res | undefined> {
6
+ try {
7
+ return await call()
8
+ } catch (err) {
9
+ if (err.code === 'CALL_EXCEPTION') {
10
+ console.log('eth call exception, return undefined', err)
11
+ return undefined
12
+ }
13
+ throw err
14
+ }
15
+ }
@@ -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'