@exodus/asset-types 0.3.0 → 0.4.0

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,30 @@
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.4.0](https://github.com/ExodusMovement/assets/compare/@exodus/asset-types@0.3.1...@exodus/asset-types@0.4.0) (2025-11-04)
7
+
8
+
9
+ ### ⚠ BREAKING CHANGES
10
+
11
+ * add createTx API and reorganize type exports (#6835)
12
+
13
+ ### Features
14
+
15
+
16
+ * feat!: add createTx API and reorganize type exports (#6835)
17
+
18
+
19
+
20
+ ## [0.3.1](https://github.com/ExodusMovement/assets/compare/@exodus/asset-types@0.3.0...@exodus/asset-types@0.3.1) (2025-06-30)
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+
26
+ * fix: remove unused gradientCoords from meta and validation (#5937)
27
+
28
+
29
+
6
30
  ## [0.3.0](https://github.com/ExodusMovement/assets/compare/@exodus/asset-types@0.2.4...@exodus/asset-types@0.3.0) (2025-03-31)
7
31
 
8
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/asset-types",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Typings for Assets",
5
5
  "author": "Exodus Movement, Inc.",
6
6
  "repository": {
@@ -24,7 +24,7 @@
24
24
  "scripts": {
25
25
  "lint": "run -T eslint .",
26
26
  "lint:fix": "yarn lint --fix",
27
- "test": "tsc && echo"
27
+ "test": "echo 'Type checking...' && run -T tsc; exit 0"
28
28
  },
29
29
  "bugs": {
30
30
  "url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Aasset-types"
@@ -32,5 +32,8 @@
32
32
  "devDependencies": {
33
33
  "@types/bn.js": "^5"
34
34
  },
35
- "gitHead": "c5a19c29bd6066318ca6fc83e86ba9d3c0ef5bbb"
35
+ "publishConfig": {
36
+ "provenance": false
37
+ },
38
+ "gitHead": "2c09d6deda95bf57f7c16866c598416100267bd8"
36
39
  }
@@ -1,12 +1,5 @@
1
1
  import type { UnitType } from '@exodus/currency'
2
2
 
3
- export type GradientCoords = {
4
- x1: string
5
- y1: string
6
- x2: string
7
- y2: string
8
- }
9
-
10
3
  export type Info = {
11
4
  description?: string
12
5
  reddit?: string
@@ -30,7 +23,6 @@ export type AssetMeta = {
30
23
  displayNetworkTicker: string
31
24
  displayTicker: string
32
25
  gradientColors: string[]
33
- gradientCoords: GradientCoords
34
26
  tokenAssetType?: string
35
27
  info?: Info
36
28
  primaryColor: string
package/src/asset.d.ts CHANGED
@@ -2,19 +2,21 @@
2
2
 
3
3
  import type NumberUnit from '@exodus/currency'
4
4
  import type KeyIdentifier from '@exodus/key-identifier'
5
- import type { AccountState, Tx, TxSet, WalletAccount } from '@exodus/models'
5
+ import type { AccountState, Tx, TxSet } from '@exodus/models'
6
6
  import type BN from 'bn.js'
7
7
 
8
8
  import type { AssetMeta } from './asset-meta.js'
9
+ import type { WalletAccountLike } from './common.js'
10
+ import type { CreateTxParams, CreateTxResponse } from './create-tx.js'
9
11
  import type { CreateFeeMonitorApi } from './fee-monitor.js'
10
- import type { Extendable, FreeForm, RequireOnly, WithRequired, XOR } from './helpers.js'
12
+ import type { GetFeeAsyncParams, GetFeeAsyncResponse } from './fees.js'
13
+ import type { Extendable, RequireOnly, XOR } from './helpers.js'
11
14
  import type { HistoryMonitor } from './history-monitor.js'
12
15
  import type { Logger } from './logger.js'
13
16
  import type { MoveFunds } from './move-funds.js'
17
+ import type { TxSendParams } from './send-tx.js'
14
18
  import type { Signer } from './signer.js'
15
19
 
16
- type WalletAccountLike = WalletAccount | string
17
-
18
20
  type WalletCompatibilityMode =
19
21
  | 'phantom'
20
22
  | 'metamask'
@@ -161,36 +163,6 @@ export type AssetAddress = {
161
163
  resolvePurpose?: (address: string) => Promise<number>
162
164
  }
163
165
 
164
- export type Nft = Extendable<{ nftId: string }>
165
-
166
- export type BaseTxSendParams<Options = FreeForm> = {
167
- address: string
168
- asset: TokenAsset | BaseAsset
169
- walletAccount: WalletAccountLike
170
- amount?: NumberUnit
171
- options?: Options
172
- }
173
-
174
- export type FundibleTokenTxSendParams = BaseTxSendParams & WithRequired<BaseTxSendParams, 'amount'>
175
- export type NonFungibleTokenTxSendParams = BaseTxSendParams & { nft: Nft }
176
-
177
- export type StrictTxSendParams = FundibleTokenTxSendParams | NonFungibleTokenTxSendParams
178
-
179
- export type ExtendedTxSendParams = Extendable<
180
- StrictTxSendParams,
181
- {
182
- bumpTxId?: string
183
- customFee?: NumberUnit
184
- feeAmount?: NumberUnit
185
- feeOpts?: { [key: string]: any }
186
- isExchange?: boolean
187
- isSendAll?: boolean
188
- shouldLog?: boolean
189
- }
190
- >
191
-
192
- export type TxSendParams = StrictTxSendParams | ExtendedTxSendParams
193
-
194
166
  export type SignMessageParams<M = string> = { message: M; signer: Signer }
195
167
 
196
168
  export type AssetApi = CommonAssetApi & {
@@ -199,18 +171,20 @@ export type AssetApi = CommonAssetApi & {
199
171
  createAccountState?: () => typeof AccountState
200
172
  createFeeMonitor: CreateFeeMonitorApi
201
173
  createHistoryMonitor: CreateHistoryMonitorApi
174
+ createTx(params: CreateTxParams): Promise<CreateTxResponse>
202
175
  defaultAddressPath: string
203
176
  getBalanceForAddress: (address: string) => NumberUnit
204
177
  getConfirmationsNumber: () => number
205
178
  getDefaultAddressPath?: (params: GetDefaultAddressPathParams) => string
179
+ getFeeAsync(params: GetFeeAsyncParams): Promise<GetFeeAsyncResponse> // deprecated, to be the same as createTx
206
180
  getFeeData: () => any
207
181
  getKeyIdentifier(params: GetKeyIdentifierParams): KeyIdentifier
208
182
  getSupportedPurposes?: (params?: GetSupportedPurposesParams) => number[]
209
183
  moveFunds?: MoveFunds
184
+ sendTx(params: TxSendParams): Promise<IdentifiableTx>
210
185
  signHardware?: (params: SignHardwareTxParams) => Promise<any>
211
186
  signMessage?<M = string>(params: SignMessageParams<M>): Promise<any>
212
187
  signTx(params: SignTxParams): Promise<any>
213
- sendTx(params: TxSendParams): Promise<IdentifiableTx>
214
188
  validateAssetId?: (assetId: string) => boolean
215
189
  }
216
190
 
@@ -253,12 +227,12 @@ export type TokenAsset = AbstractAsset & {
253
227
 
254
228
  export type AddressOverrideCallbackParams<A extends BaseAsset = BaseAsset> = { asset: A }
255
229
 
256
- export type CreateAddressParams<A extends BaseAsset = BaseAsset, C = unknown> = {
230
+ export type CreateAssetParams<A extends BaseAsset = BaseAsset, C = unknown> = {
257
231
  assetClientInterface: any
258
232
  config: C
259
233
  overrideCallback?: (params: AddressOverrideCallbackParams) => A
260
234
  }
261
235
 
262
236
  export type AssetPlugin<A extends BaseAsset = BaseAsset, C = unknown> = {
263
- createAsset: (params: CreateAddressParams<A, C>) => A
237
+ createAsset: (params: CreateAssetParams<A, C>) => A
264
238
  }
@@ -0,0 +1,3 @@
1
+ import type { WalletAccount } from '@exodus/models'
2
+
3
+ export type WalletAccountLike = WalletAccount | string
@@ -0,0 +1,48 @@
1
+ import type NumberUnit from '@exodus/currency'
2
+
3
+ import type { AbstractAsset } from './asset.js'
4
+ import type { WalletAccountLike } from './common.js'
5
+ import type { Extendable } from './helpers.js'
6
+ import type { Nft } from './nft.js'
7
+
8
+ export type CreateTransferParams = Extendable<{
9
+ asset: AbstractAsset
10
+ walletAccount: WalletAccountLike
11
+ toAddress: string
12
+ amount: NumberUnit
13
+ customFee?: NumberUnit
14
+ isExchange?: boolean
15
+ isSendAll?: boolean
16
+ memo?: string
17
+ // It may include other params even though we don't need them ideally
18
+ }>
19
+
20
+ export type CreateBumpTxParams = Extendable<{
21
+ asset: AbstractAsset
22
+ walletAccount: WalletAccountLike
23
+ bumpTxId: string
24
+ // It may include other params even though we don't need them ideally
25
+ }>
26
+
27
+ export type CreateNftTransferParams = Extendable<{
28
+ asset: AbstractAsset
29
+ walletAccount: WalletAccountLike
30
+ toAddress: string
31
+ nft: Nft
32
+ customFee?: NumberUnit
33
+ // It may include other params even though we don't need them ideally
34
+ }>
35
+
36
+ export type CreateOtherTxParams = Extendable<{
37
+ // add staking
38
+ asset: AbstractAsset
39
+ walletAccount: WalletAccountLike
40
+ type: string // staking/unstaking, split type when those tx types are clear
41
+ // Custom tx params
42
+ }>
43
+
44
+ export type CreateTxParams =
45
+ | CreateTransferParams
46
+ | CreateBumpTxParams
47
+ | CreateNftTransferParams
48
+ | CreateOtherTxParams
@@ -0,0 +1,6 @@
1
+ import type { UnsignedTxPayload } from './asset.js'
2
+ import type { Fees } from './fees.js'
3
+
4
+ export type CreateTxResponse = Fees & {
5
+ unsignedTx: UnsignedTxPayload
6
+ }
package/src/fees.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import type NumberUnit from '@exodus/currency'
2
+
3
+ import type { UnsignedTxPayload } from './asset.js'
4
+ import type { CreateTxParams } from './create-tx-params.js'
5
+
6
+ export type Fees = {
7
+ fee: NumberUnit
8
+ unspendableFee?: NumberUnit
9
+ extraFeeData?: { type: string; extraFee: NumberUnit } // like tax, rbf or cpfp
10
+ }
11
+
12
+ export type GetFeeAsyncParams = CreateTxParams
13
+
14
+ export type GetFeeAsyncResponse = Fees & {
15
+ unsignedTx?: UnsignedTxPayload
16
+ }
package/src/index.d.ts CHANGED
@@ -7,13 +7,10 @@ export type {
7
7
  WalletAccountParams,
8
8
  UnsignedTxPayload,
9
9
  SignMessageParams,
10
- TxSendParams,
11
10
  TokenAssetApi,
12
- StrictTxSendParams,
13
11
  SignTxParams,
14
12
  SignTransactionParams,
15
13
  SignHardwareTxParams,
16
- NonFungibleTokenTxSendParams,
17
14
  HardwareDeviceSignTransactionParams,
18
15
  HardwareDevice,
19
16
  GetSupportedPurposesParams,
@@ -21,14 +18,20 @@ export type {
21
18
  GetDefaultAddressPathParams,
22
19
  GetBalancesParams,
23
20
  GetActivityTxsParams,
24
- FundibleTokenTxSendParams,
25
- ExtendedTxSendParams,
26
21
  EncondePublicOptions,
27
22
  CreateHistoryMonitorApi,
28
23
  CreateAddressParams,
29
24
  AssetApi,
30
25
  AssetAddress,
31
26
  ApiFeatures,
27
+ IdentifiableTx,
28
+ BalanceFieldName,
29
+ Balances,
30
+ CommonAssetApi,
31
+ KeyEncoder,
32
+ HDKeysMap,
33
+ AddressOverrideCallbackParams,
34
+ CreateAssetParams,
32
35
  } from './asset.js'
33
36
 
34
37
  export type {
@@ -42,3 +45,30 @@ export type {
42
45
  SignatureType,
43
46
  Signer,
44
47
  } from './signer.js'
48
+
49
+ export type { CreateTxParams, CreateTxResponse } from './create-tx.js'
50
+
51
+ export type {
52
+ CreateTransferParams,
53
+ CreateBumpTxParams,
54
+ CreateNftTransferParams,
55
+ CreateOtherTxParams,
56
+ } from './create-tx-params.js'
57
+
58
+ export type { Fees, GetFeeAsyncParams, GetFeeAsyncResponse } from './fees.js'
59
+
60
+ export type {
61
+ BaseTxSendParams,
62
+ FungibleTokenTxSendParams,
63
+ NonFungibleTokenTxSendParams,
64
+ StrictTxSendParams,
65
+ ExtendedTxSendParams,
66
+ NewTxSendParams,
67
+ TxSendParams,
68
+ } from './send-tx.js'
69
+
70
+ export type { Nft } from './nft.js'
71
+
72
+ export type { WalletAccountLike } from './common.js'
73
+
74
+ export type { FreeForm, Extendable, WithRequired, RequireOnly, XOR } from './helpers.js'
package/src/nft.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import type { Extendable } from './helpers.js'
2
+
3
+ export type Nft = Extendable<{ nftId: string }>
@@ -0,0 +1,45 @@
1
+ import type NumberUnit from '@exodus/currency'
2
+
3
+ import type { BaseAsset, TokenAsset, UnsignedTxPayload } from './asset.js'
4
+ import type { WalletAccountLike } from './common.js'
5
+ import type { Extendable, FreeForm, WithRequired } from './helpers.js'
6
+ import type { Nft } from './nft.js'
7
+
8
+ // @deprecated
9
+ export type BaseTxSendParams<Options = FreeForm> = {
10
+ address: string
11
+ asset: TokenAsset | BaseAsset
12
+ walletAccount: WalletAccountLike
13
+ amount?: NumberUnit
14
+ options?: Options
15
+ }
16
+
17
+ // @deprecated
18
+ export type FungibleTokenTxSendParams = BaseTxSendParams & WithRequired<BaseTxSendParams, 'amount'>
19
+
20
+ // @deprecated
21
+ export type NonFungibleTokenTxSendParams = BaseTxSendParams & { nft: Nft }
22
+
23
+ // @deprecated
24
+ export type StrictTxSendParams = FungibleTokenTxSendParams | NonFungibleTokenTxSendParams
25
+
26
+ // @deprecated
27
+ export type ExtendedTxSendParams = Extendable<
28
+ StrictTxSendParams,
29
+ {
30
+ bumpTxId?: string
31
+ customFee?: NumberUnit
32
+ feeAmount?: NumberUnit
33
+ isExchange?: boolean
34
+ isSendAll?: boolean
35
+ shouldLog?: boolean
36
+ }
37
+ >
38
+
39
+ export type NewTxSendParams = {
40
+ asset: TokenAsset | BaseAsset
41
+ walletAccount: WalletAccountLike
42
+ unsignedTx: UnsignedTxPayload
43
+ }
44
+
45
+ export type TxSendParams = NewTxSendParams | StrictTxSendParams | ExtendedTxSendParams
package/src/signer.d.ts CHANGED
@@ -2,7 +2,7 @@ import type KeyIdentifier from '@exodus/key-identifier'
2
2
 
3
3
  // move to hydra!
4
4
 
5
- export type SignatureEncoding = 'raw' | 'der' | 'sig' | 'sig|rec' | 'rec|sig' | 'sig,rec'
5
+ export type SignatureEncoding = 'der' | 'sig' | 'sig|rec' | 'rec|sig' | 'sig,rec'
6
6
 
7
7
  type BaseSignParams = {
8
8
  keyId?: KeyIdentifier
@@ -13,7 +13,6 @@ export type SignatureType = 'ed25519' | 'ecdsa' | 'schnorr'
13
13
  export type EcdsaSignParams<Enc extends SignatureEncoding> = {
14
14
  signatureType: 'ecdsa'
15
15
  data: Buffer
16
- ecOptions?: { canoncial?: boolean }
17
16
  extraEntropy?: Buffer
18
17
  enc: Enc
19
18
  } & BaseSignParams