viem 2.0.0-alpha.3 → 2.0.0-alpha.5

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 (50) hide show
  1. package/_cjs/actions/wallet/writeContract.js.map +1 -1
  2. package/_cjs/chains/{utils/index.js → utils.js} +5 -5
  3. package/_cjs/chains/utils.js.map +1 -0
  4. package/_cjs/clients/decorators/wallet.js.map +1 -1
  5. package/_cjs/errors/node.js +11 -11
  6. package/_cjs/errors/node.js.map +1 -1
  7. package/_cjs/errors/rpc.js +18 -18
  8. package/_cjs/errors/rpc.js.map +1 -1
  9. package/_cjs/errors/version.js +1 -1
  10. package/_esm/actions/wallet/writeContract.js.map +1 -1
  11. package/_esm/chains/utils.js +5 -0
  12. package/_esm/chains/utils.js.map +1 -0
  13. package/_esm/clients/decorators/wallet.js.map +1 -1
  14. package/_esm/errors/node.js +22 -11
  15. package/_esm/errors/node.js.map +1 -1
  16. package/_esm/errors/rpc.js +36 -18
  17. package/_esm/errors/rpc.js.map +1 -1
  18. package/_esm/errors/version.js +1 -1
  19. package/_types/actions/wallet/writeContract.d.ts +3 -3
  20. package/_types/actions/wallet/writeContract.d.ts.map +1 -1
  21. package/_types/chains/celo/formatters.d.ts +7 -7
  22. package/_types/chains/definitions/base.d.ts +33 -33
  23. package/_types/chains/definitions/baseGoerli.d.ts +33 -33
  24. package/_types/chains/definitions/celo.d.ts +36 -36
  25. package/_types/chains/definitions/celoAlfajores.d.ts +36 -36
  26. package/_types/chains/definitions/celoCannoli.d.ts +36 -36
  27. package/_types/chains/definitions/optimism.d.ts +33 -33
  28. package/_types/chains/definitions/optimismGoerli.d.ts +33 -33
  29. package/_types/chains/definitions/zora.d.ts +33 -33
  30. package/_types/chains/definitions/zoraTestnet.d.ts +33 -33
  31. package/_types/chains/optimism/formatters.d.ts +7 -7
  32. package/_types/chains/{utils/index.d.ts → utils.d.ts} +7 -7
  33. package/_types/chains/utils.d.ts.map +1 -0
  34. package/_types/errors/version.d.ts +1 -1
  35. package/_types/types/utils.d.ts +12 -8
  36. package/_types/types/utils.d.ts.map +1 -1
  37. package/_types/utils/formatters/transaction.d.ts +2 -2
  38. package/_types/utils/formatters/transaction.d.ts.map +1 -1
  39. package/actions/wallet/writeContract.ts +35 -29
  40. package/chains/utils/package.json +3 -3
  41. package/chains/{utils/index.ts → utils.ts} +6 -6
  42. package/clients/decorators/wallet.ts +1 -1
  43. package/errors/version.ts +1 -1
  44. package/package.json +5 -5
  45. package/types/utils.ts +32 -11
  46. package/utils/formatters/transaction.ts +2 -2
  47. package/_cjs/chains/utils/index.js.map +0 -1
  48. package/_esm/chains/utils/index.js +0 -5
  49. package/_esm/chains/utils/index.js.map +0 -1
  50. package/_types/chains/utils/index.d.ts.map +0 -1
package/types/utils.ts CHANGED
@@ -125,15 +125,10 @@ export type NeverBy<T, K extends keyof T> = {
125
125
  */
126
126
  export type NoUndefined<T> = T extends undefined ? never : T
127
127
 
128
- /**
129
- * @description Construct a type with the properties of union type T except for those in type K.
130
- * @example
131
- * type Result = UnionOmit<{ a: string, b: number } | { a: string, b: undefined, c: number }, 'a'>
132
- * => { b: number } | { b: undefined, c: number }
133
- */
134
- export type UnionOmit<T, K extends keyof any> = T extends any
135
- ? Omit<T, K>
136
- : never
128
+ export type Omit<type, keys extends keyof type> = Pick<
129
+ type,
130
+ Exclude<keyof type, keys>
131
+ >
137
132
 
138
133
  /**
139
134
  * @description Combines members of an intersection into a readable type.
@@ -147,8 +142,6 @@ export type Prettify<T> = {
147
142
  [K in keyof T]: T[K]
148
143
  } & {}
149
144
 
150
- export type UnionEvaluate<type> = type extends object ? Prettify<type> : type
151
-
152
145
  /**
153
146
  * @description Creates a type that extracts the values of T.
154
147
  *
@@ -199,3 +192,31 @@ export type OneOf<
199
192
  ? Prettify<Item & { [K in Exclude<keys, keyof Item>]?: undefined }>
200
193
  : never
201
194
  type KeyofUnion<type> = type extends type ? keyof type : never
195
+
196
+ ///////////////////////////////////////////////////////////////////////////
197
+ // Loose types
198
+
199
+ /** Loose version of {@link Omit} */
200
+ export type LooseOmit<type, keys extends string> = Pick<
201
+ type,
202
+ Exclude<keyof type, keys>
203
+ >
204
+
205
+ ///////////////////////////////////////////////////////////////////////////
206
+ // Union types
207
+
208
+ export type UnionEvaluate<type> = type extends object ? Prettify<type> : type
209
+
210
+ export type UnionLooseOmit<type, keys extends string> = type extends any
211
+ ? LooseOmit<type, keys>
212
+ : never
213
+
214
+ /**
215
+ * @description Construct a type with the properties of union type T except for those in type K.
216
+ * @example
217
+ * type Result = UnionOmit<{ a: string, b: number } | { a: string, b: undefined, c: number }, 'a'>
218
+ * => { b: number } | { b: undefined, c: number }
219
+ */
220
+ export type UnionOmit<type, keys extends keyof type> = type extends any
221
+ ? Omit<type, keys>
222
+ : never
@@ -6,7 +6,7 @@ import type {
6
6
  } from '../../types/chain.js'
7
7
  import type { RpcTransaction } from '../../types/rpc.js'
8
8
  import type { Transaction } from '../../types/transaction.js'
9
- import type { UnionOmit } from '../../types/utils.js'
9
+ import type { UnionLooseOmit } from '../../types/utils.js'
10
10
  import { hexToNumber } from '../encoding/fromHex.js'
11
11
  import { defineFormatter } from './formatter.js'
12
12
 
@@ -27,7 +27,7 @@ export type FormattedTransaction<
27
27
  >,
28
28
  _ExcludedPendingDependencies extends string = TransactionPendingDependencies &
29
29
  ExtractChainFormatterExclude<TChain, 'transaction'>,
30
- > = UnionOmit<_FormatterReturnType, TransactionPendingDependencies> & {
30
+ > = UnionLooseOmit<_FormatterReturnType, TransactionPendingDependencies> & {
31
31
  [K in _ExcludedPendingDependencies]: never
32
32
  } & Pick<
33
33
  Transaction<bigint, number, TBlockTag extends 'pending' ? true : false>,
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../chains/utils/index.ts"],"names":[],"mappings":";;;AAAA,uDAAsD;AAA7C,+GAAA,cAAc,OAAA;AACvB,yDAG+B;AAF7B,0HAAA,wBAAwB,OAAA;AACxB,iHAAA,eAAe,OAAA;AAEjB,iDAAyD;AAAhD,kHAAA,oBAAoB,OAAA;AAyB7B,2DAA8D;AAArD,mHAAA,kBAAkB,OAAA"}
@@ -1,5 +0,0 @@
1
- export { formattersCelo } from '../celo/formatters.js';
2
- export { serializeTransactionCelo, serializersCelo, } from '../celo/serializers.js';
3
- export { parseTransactionCelo } from '../celo/parsers.js';
4
- export { formattersOptimism } from '../optimism/formatters.js';
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../chains/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EACL,wBAAwB,EACxB,eAAe,GAChB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAyBzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../chains/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EACL,wBAAwB,EACxB,eAAe,GAChB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACzD,YAAY,EACV,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,EACrB,kBAAkB,EAClB,yBAAyB,EACzB,kCAAkC,EAClC,yBAAyB,EACzB,eAAe,EACf,sBAAsB,EACtB,+BAA+B,EAC/B,sBAAsB,EACtB,2BAA2B,EAC3B,yBAAyB,EACzB,mBAAmB,EACnB,mBAAmB,EACnB,0BAA0B,EAC1B,gBAAgB,EAChB,uBAAuB,EACvB,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9D,YAAY,EACV,aAAa,EACb,sBAAsB,EACtB,0BAA0B,EAC1B,gBAAgB,EAChB,yBAAyB,EACzB,6BAA6B,EAC7B,sBAAsB,EACtB,6BAA6B,EAC7B,sCAAsC,EACtC,mBAAmB,EACnB,0BAA0B,EAC1B,mCAAmC,GACpC,MAAM,sBAAsB,CAAA"}