@exodus/asset-types 0.2.2 → 0.2.4

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,26 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.2.4](https://github.com/ExodusMovement/assets/compare/@exodus/asset-types@0.2.3...@exodus/asset-types@0.2.4) (2025-02-07)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+
12
+ * fix: require either signer or private key (#5016)
13
+
14
+
15
+
16
+ ## [0.2.3](https://github.com/ExodusMovement/assets/compare/@exodus/asset-types@0.2.2...@exodus/asset-types@0.2.3) (2025-02-07)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+
22
+ * fix: allow asset specific messages (#5010)
23
+
24
+
25
+
6
26
  ## [0.2.2](https://github.com/ExodusMovement/assets/compare/@exodus/asset-types@0.2.1...@exodus/asset-types@0.2.2) (2025-02-06)
7
27
 
8
28
  **Note:** Version bump only for package @exodus/asset-types
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/asset-types",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Typings for Assets",
5
5
  "author": "Exodus Movement, Inc.",
6
6
  "repository": {
@@ -23,7 +23,8 @@
23
23
  },
24
24
  "scripts": {
25
25
  "lint": "run -T eslint .",
26
- "lint:fix": "yarn lint --fix"
26
+ "lint:fix": "yarn lint --fix",
27
+ "test": "tsc && echo"
27
28
  },
28
29
  "bugs": {
29
30
  "url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Aasset-types"
@@ -31,5 +32,5 @@
31
32
  "devDependencies": {
32
33
  "@types/bn.js": "^5"
33
34
  },
34
- "gitHead": "581302b29426b95bfe5d45b486d96ea0ecda6346"
35
+ "gitHead": "fb14012ea166f96ea8eb3f7bc9038bdcb10a71be"
35
36
  }
@@ -40,5 +40,6 @@ export type AssetMeta = {
40
40
  decimals?: number
41
41
  mintAddress?: string
42
42
  units: Record<string, number>
43
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
44
  [prop: string]: any // allow additional chain specific properties
44
45
  }
package/src/asset.d.ts CHANGED
@@ -7,7 +7,7 @@ import type BN from 'bn.js'
7
7
 
8
8
  import type { AssetMeta } from './asset-meta.js'
9
9
  import type { CreateFeeMonitorApi } from './fee-monitor.js'
10
- import type { Extendable, FreeForm, RequireOnly, WithRequired } from './helpers.js'
10
+ import type { Extendable, FreeForm, RequireOnly, WithRequired, XOR } from './helpers.js'
11
11
  import type { HistoryMonitor } from './history-monitor.js'
12
12
  import type { Logger } from './logger.js'
13
13
  import type { MoveFunds } from './move-funds.js'
@@ -138,9 +138,8 @@ export type SignTxParams = Extendable<{
138
138
  txHex?: string
139
139
  partialSign?: boolean
140
140
  hdkeys?: HDKeysMap
141
- privateKey: string
142
- signer?: Signer
143
- }>
141
+ }> &
142
+ XOR<{ privateKey: string }, { signer: Signer }>
144
143
 
145
144
  export type CommonAssetApi = {
146
145
  features: ApiFeatures
@@ -192,7 +191,7 @@ export type ExtendedTxSendParams = Extendable<
192
191
 
193
192
  export type TxSendParams = StrictTxSendParams | ExtendedTxSendParams
194
193
 
195
- export type SignMessageParams = { message: string; signer: Signer }
194
+ export type SignMessageParams<M = string> = { message: M; signer: Signer }
196
195
 
197
196
  export type AssetApi = CommonAssetApi & {
198
197
  addressHasHistory?: (address: string) => Promise<boolean>
@@ -209,7 +208,7 @@ export type AssetApi = CommonAssetApi & {
209
208
  getSupportedPurposes?: (params?: GetSupportedPurposesParams) => number[]
210
209
  moveFunds?: MoveFunds
211
210
  signHardware?: (params: SignHardwareTxParams) => Promise<any>
212
- signMessage?(params: SignMessageParams): Promise<any>
211
+ signMessage?<M = string>(params: SignMessageParams<M>): Promise<any>
213
212
  signTx(params: SignTxParams): Promise<any>
214
213
  sendTx(params: TxSendParams): Promise<IdentifiableTx>
215
214
  validateAssetId?: (assetId: string) => boolean
package/src/helpers.d.ts CHANGED
@@ -15,3 +15,10 @@ export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] }
15
15
  * Make a set of keys of a given target type required, while making all other optional
16
16
  */
17
17
  export type RequireOnly<T, Keys extends keyof T> = Partial<T> & Pick<WithRequired<T, Keys>, Keys>
18
+
19
+ /**
20
+ * Exclusive OR
21
+ */
22
+ export type XOR<T, U> =
23
+ | (T & Partial<Record<Exclude<keyof U, keyof T>, never>>)
24
+ | (U & Partial<Record<Exclude<keyof T, keyof U>, never>>)