viem 0.0.0-main.20240415T030544 → 0.0.0-main.20240415T031936

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.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
- exports.version = '0.0.0-main.20240415T030544';
4
+ exports.version = '0.0.0-main.20240415T031936';
5
5
  //# sourceMappingURL=version.js.map
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAction = void 0;
4
4
  function getAction(client, action, name) {
5
- return (params) => client[action.name || name]?.(params) ?? action(client, params);
5
+ return (params) => client[action.name]?.(params) ??
6
+ client[name]?.(params) ??
7
+ action(client, params);
6
8
  }
7
9
  exports.getAction = getAction;
8
10
  //# sourceMappingURL=getAction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getAction.js","sourceRoot":"","sources":["../../utils/getAction.ts"],"names":[],"mappings":";;;AASA,SAAgB,SAAS,CACvB,MAAc,EACd,MAA8C,EAG9C,IAAY;IAEZ,OAAO,CAAC,MAAc,EAAc,EAAE,CAElC,MAGD,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAC9D,CAAC;AAbD,8BAaC"}
1
+ {"version":3,"file":"getAction.js","sourceRoot":"","sources":["../../utils/getAction.ts"],"names":[],"mappings":";;;AASA,SAAgB,SAAS,CACvB,MAAc,EACd,MAA8C,EAI9C,IAAY;IAEZ,OAAO,CAAC,MAAc,EAAc,EAAE,CACnC,MAAqE,CACpE,MAAM,CAAC,IAAI,CACZ,EAAE,CAAC,MAAM,CAAC;QACV,MAAqE,CACpE,IAAI,CACL,EAAE,CAAC,MAAM,CAAC;QACX,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAC1B,CAAC;AAhBD,8BAgBC"}
@@ -1,2 +1,2 @@
1
- export const version = '0.0.0-main.20240415T030544';
1
+ export const version = '0.0.0-main.20240415T031936';
2
2
  //# sourceMappingURL=version.js.map
@@ -6,9 +6,12 @@
6
6
  * wants to override the `sendTransaction` implementation).
7
7
  */
8
8
  export function getAction(client, action,
9
- // Some minifiers drop `Function.prototype.name`, meaning that `action.name`
10
- // will not work. For that case, the consumer needs to pass the name explicitly.
9
+ // Some minifiers drop `Function.prototype.name` or can change function
10
+ // names so that getting the name by reflection through `action.name` will
11
+ // not work.
11
12
  name) {
12
- return (params) => client[action.name || name]?.(params) ?? action(client, params);
13
+ return (params) => client[action.name]?.(params) ??
14
+ client[name]?.(params) ??
15
+ action(client, params);
13
16
  }
14
17
  //# sourceMappingURL=getAction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getAction.js","sourceRoot":"","sources":["../../utils/getAction.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CACvB,MAAc,EACd,MAA8C;AAC9C,4EAA4E;AAC5E,gFAAgF;AAChF,IAAY;IAEZ,OAAO,CAAC,MAAc,EAAc,EAAE,CAElC,MAGD,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAC9D,CAAC"}
1
+ {"version":3,"file":"getAction.js","sourceRoot":"","sources":["../../utils/getAction.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CACvB,MAAc,EACd,MAA8C;AAC9C,uEAAuE;AACvE,0EAA0E;AAC1E,YAAY;AACZ,IAAY;IAEZ,OAAO,CAAC,MAAc,EAAc,EAAE,CACnC,MAAqE,CACpE,MAAM,CAAC,IAAI,CACZ,EAAE,CAAC,MAAM,CAAC;QACV,MAAqE,CACpE,IAAI,CACL,EAAE,CAAC,MAAM,CAAC;QACX,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAC1B,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const version = "0.0.0-main.20240415T030544";
1
+ export declare const version = "0.0.0-main.20240415T031936";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getAction.d.ts","sourceRoot":"","sources":["../../utils/getAction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAExD;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,MAAM,SAAS,EAAE,EAAE,UAAU,SAAS,EAAE,EAChE,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,KAAK,UAAU,EAG9C,IAAI,EAAE,MAAM,uBAEa,UAAU,CAMpC"}
1
+ {"version":3,"file":"getAction.d.ts","sourceRoot":"","sources":["../../utils/getAction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAExD;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,MAAM,SAAS,EAAE,EAAE,UAAU,SAAS,EAAE,EAChE,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,KAAK,UAAU,EAI9C,IAAI,EAAE,MAAM,uBAEa,UAAU,CAQpC"}
package/errors/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '0.0.0-main.20240415T030544'
1
+ export const version = '0.0.0-main.20240415T031936'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript Interface for Ethereum",
4
- "version": "0.0.0-main.20240415T030544",
4
+ "version": "0.0.0-main.20240415T031936",
5
5
  "type": "module",
6
6
  "main": "./_cjs/index.js",
7
7
  "module": "./_esm/index.js",
@@ -10,14 +10,17 @@ import type { Client } from '../clients/createClient.js'
10
10
  export function getAction<params extends {}, returnType extends {}>(
11
11
  client: Client,
12
12
  action: (_: any, params: params) => returnType,
13
- // Some minifiers drop `Function.prototype.name`, meaning that `action.name`
14
- // will not work. For that case, the consumer needs to pass the name explicitly.
13
+ // Some minifiers drop `Function.prototype.name` or can change function
14
+ // names so that getting the name by reflection through `action.name` will
15
+ // not work.
15
16
  name: string,
16
17
  ) {
17
18
  return (params: params): returnType =>
18
- (
19
- client as Client & {
20
- [key: string]: (params: params) => returnType
21
- }
22
- )[action.name || name]?.(params) ?? action(client, params)
19
+ (client as Client & { [key: string]: (params: params) => returnType })[
20
+ action.name
21
+ ]?.(params) ??
22
+ (client as Client & { [key: string]: (params: params) => returnType })[
23
+ name
24
+ ]?.(params) ??
25
+ action(client, params)
23
26
  }