@exodus/asset-types 0.3.1 → 0.5.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,42 @@
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.5.0](https://github.com/ExodusMovement/assets/compare/@exodus/asset-types@0.3.1...@exodus/asset-types@0.5.0) (2025-12-03)
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
+ * feat: open source 4 packages with MIT license (#7035)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+
24
+ * fix: undo manual version bumps for proper CI release (#7041)
25
+
26
+
27
+
28
+ ## [0.4.0](https://github.com/ExodusMovement/assets/compare/@exodus/asset-types@0.3.1...@exodus/asset-types@0.4.0) (2025-11-04)
29
+
30
+
31
+ ### ⚠ BREAKING CHANGES
32
+
33
+ * add createTx API and reorganize type exports (#6835)
34
+
35
+ ### Features
36
+
37
+
38
+ * feat!: add createTx API and reorganize type exports (#6835)
39
+
40
+
41
+
6
42
  ## [0.3.1](https://github.com/ExodusMovement/assets/compare/@exodus/asset-types@0.3.0...@exodus/asset-types@0.3.1) (2025-06-30)
7
43
 
8
44
 
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Exodus Movement, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/asset-types",
3
- "version": "0.3.1",
3
+ "version": "0.5.0",
4
4
  "description": "Typings for Assets",
5
5
  "author": "Exodus Movement, Inc.",
6
6
  "repository": {
@@ -8,7 +8,13 @@
8
8
  "url": "git+https://github.com/ExodusMovement/assets.git"
9
9
  },
10
10
  "homepage": "https://github.com/ExodusMovement/assets/tree/master/shield/asset-types",
11
- "license": "UNLICENSED",
11
+ "license": "MIT",
12
+ "keywords": [
13
+ "types",
14
+ "typescript",
15
+ "assets",
16
+ "crypto"
17
+ ],
12
18
  "type": "module",
13
19
  "main": "src/index.d.ts",
14
20
  "files": [
@@ -24,7 +30,7 @@
24
30
  "scripts": {
25
31
  "lint": "run -T eslint .",
26
32
  "lint:fix": "yarn lint --fix",
27
- "test": "tsc && echo"
33
+ "test": "echo 'Type checking...' && run -T tsc; exit 0"
28
34
  },
29
35
  "bugs": {
30
36
  "url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Aasset-types"
@@ -32,5 +38,9 @@
32
38
  "devDependencies": {
33
39
  "@types/bn.js": "^5"
34
40
  },
35
- "gitHead": "526664d72a7a3c24ec8db150493fb3f1c490faa3"
41
+ "publishConfig": {
42
+ "access": "public",
43
+ "provenance": false
44
+ },
45
+ "gitHead": "5ea6d9188d1c8cca1d9d67ef06ed6f15308d4c38"
36
46
  }
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