@shapeshiftoss/types 8.6.0 → 8.6.1

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/dist/base.d.ts CHANGED
@@ -1,23 +1,36 @@
1
- export declare type BIP44Params = {
1
+ import type { AccountId, AssetId, ChainId } from '@shapeshiftoss/caip';
2
+ import type { PartialRecord } from './utility';
3
+ export type RootBip44Params = {
2
4
  purpose: number;
3
5
  coinType: number;
4
6
  accountNumber: number;
5
- isChange?: boolean;
6
- index?: number;
7
+ };
8
+ export type Bip44Params = RootBip44Params & {
9
+ isChange: boolean | undefined;
10
+ addressIndex: number | undefined;
7
11
  };
8
12
  export declare enum KnownChainIds {
9
13
  EthereumMainnet = "eip155:1",
10
14
  AvalancheMainnet = "eip155:43114",
11
15
  OptimismMainnet = "eip155:10",
12
16
  BnbSmartChainMainnet = "eip155:56",
17
+ PolygonMainnet = "eip155:137",
18
+ GnosisMainnet = "eip155:100",
19
+ ArbitrumMainnet = "eip155:42161",
20
+ ArbitrumNovaMainnet = "eip155:42170",
21
+ BaseMainnet = "eip155:8453",
13
22
  BitcoinMainnet = "bip122:000000000019d6689c085ae165831e93",
14
23
  BitcoinCashMainnet = "bip122:000000000000000000651ef99cb9fcbe",
15
24
  DogecoinMainnet = "bip122:00000000001a91e3dace36e2be3bf030",
16
25
  LitecoinMainnet = "bip122:12a765e31ffd4059bada1e25190f6e98",
17
26
  CosmosMainnet = "cosmos:cosmoshub-4",
18
- OsmosisMainnet = "cosmos:osmosis-1",
19
- ThorchainMainnet = "cosmos:thorchain-mainnet-v1"
27
+ ThorchainMainnet = "cosmos:thorchain-1",
28
+ MayachainMainnet = "cosmos:mayachain-mainnet-v1",
29
+ SolanaMainnet = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"
20
30
  }
31
+ export type EvmChainId = KnownChainIds.EthereumMainnet | KnownChainIds.AvalancheMainnet | KnownChainIds.OptimismMainnet | KnownChainIds.BnbSmartChainMainnet | KnownChainIds.PolygonMainnet | KnownChainIds.GnosisMainnet | KnownChainIds.ArbitrumMainnet | KnownChainIds.ArbitrumNovaMainnet | KnownChainIds.BaseMainnet;
32
+ export type CosmosSdkChainId = KnownChainIds.CosmosMainnet | KnownChainIds.ThorchainMainnet | KnownChainIds.MayachainMainnet;
33
+ export type UtxoChainId = KnownChainIds.BitcoinMainnet | KnownChainIds.BitcoinCashMainnet | KnownChainIds.DogecoinMainnet | KnownChainIds.LitecoinMainnet;
21
34
  export declare enum WithdrawType {
22
35
  DELAYED = 0,
23
36
  INSTANT = 1
@@ -27,3 +40,33 @@ export declare enum UtxoAccountType {
27
40
  SegwitP2sh = "SegwitP2sh",
28
41
  P2pkh = "P2pkh"
29
42
  }
43
+ export type Asset = {
44
+ assetId: AssetId;
45
+ chainId: ChainId;
46
+ description?: string;
47
+ isTrustedDescription?: boolean;
48
+ symbol: string;
49
+ name: string;
50
+ id?: string;
51
+ networkName?: string;
52
+ precision: number;
53
+ color: string;
54
+ networkColor?: string;
55
+ icon: string | undefined;
56
+ icons?: string[];
57
+ networkIcon?: string;
58
+ explorer: string;
59
+ explorerTxLink: string;
60
+ explorerAddressLink: string;
61
+ relatedAssetKey: AssetId | null | undefined;
62
+ isPool?: boolean;
63
+ };
64
+ export type AssetsById = Record<AssetId, Asset>;
65
+ export type AssetsByIdPartial = PartialRecord<AssetId, Asset>;
66
+ export type AccountMetadata = {
67
+ bip44Params: Bip44Params;
68
+ accountType?: UtxoAccountType;
69
+ };
70
+ export type AccountMetadataById = {
71
+ [k: AccountId]: AccountMetadata;
72
+ };
package/dist/base.js CHANGED
@@ -1,28 +1,31 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UtxoAccountType = exports.WithdrawType = exports.KnownChainIds = void 0;
4
- var KnownChainIds;
1
+ export var KnownChainIds;
5
2
  (function (KnownChainIds) {
6
3
  KnownChainIds["EthereumMainnet"] = "eip155:1";
7
4
  KnownChainIds["AvalancheMainnet"] = "eip155:43114";
8
5
  KnownChainIds["OptimismMainnet"] = "eip155:10";
9
6
  KnownChainIds["BnbSmartChainMainnet"] = "eip155:56";
7
+ KnownChainIds["PolygonMainnet"] = "eip155:137";
8
+ KnownChainIds["GnosisMainnet"] = "eip155:100";
9
+ KnownChainIds["ArbitrumMainnet"] = "eip155:42161";
10
+ KnownChainIds["ArbitrumNovaMainnet"] = "eip155:42170";
11
+ KnownChainIds["BaseMainnet"] = "eip155:8453";
10
12
  KnownChainIds["BitcoinMainnet"] = "bip122:000000000019d6689c085ae165831e93";
11
13
  KnownChainIds["BitcoinCashMainnet"] = "bip122:000000000000000000651ef99cb9fcbe";
12
14
  KnownChainIds["DogecoinMainnet"] = "bip122:00000000001a91e3dace36e2be3bf030";
13
15
  KnownChainIds["LitecoinMainnet"] = "bip122:12a765e31ffd4059bada1e25190f6e98";
14
16
  KnownChainIds["CosmosMainnet"] = "cosmos:cosmoshub-4";
15
- KnownChainIds["OsmosisMainnet"] = "cosmos:osmosis-1";
16
- KnownChainIds["ThorchainMainnet"] = "cosmos:thorchain-mainnet-v1";
17
- })(KnownChainIds = exports.KnownChainIds || (exports.KnownChainIds = {}));
18
- var WithdrawType;
17
+ KnownChainIds["ThorchainMainnet"] = "cosmos:thorchain-1";
18
+ KnownChainIds["MayachainMainnet"] = "cosmos:mayachain-mainnet-v1";
19
+ KnownChainIds["SolanaMainnet"] = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
20
+ })(KnownChainIds || (KnownChainIds = {}));
21
+ export var WithdrawType;
19
22
  (function (WithdrawType) {
20
23
  WithdrawType[WithdrawType["DELAYED"] = 0] = "DELAYED";
21
24
  WithdrawType[WithdrawType["INSTANT"] = 1] = "INSTANT";
22
- })(WithdrawType = exports.WithdrawType || (exports.WithdrawType = {}));
23
- var UtxoAccountType;
25
+ })(WithdrawType || (WithdrawType = {}));
26
+ export var UtxoAccountType;
24
27
  (function (UtxoAccountType) {
25
28
  UtxoAccountType["SegwitNative"] = "SegwitNative";
26
29
  UtxoAccountType["SegwitP2sh"] = "SegwitP2sh";
27
30
  UtxoAccountType["P2pkh"] = "P2pkh";
28
- })(UtxoAccountType = exports.UtxoAccountType || (exports.UtxoAccountType = {}));
31
+ })(UtxoAccountType || (UtxoAccountType = {}));
@@ -0,0 +1,270 @@
1
+ import type { AppDataRootSchema as AppDataRootSchemaLegacy } from '@cowprotocol/app-data/dist/generatedTypes/v0.4.0';
2
+ import type { AppDataRootSchema as AppDataRootSchemaLatest } from '@cowprotocol/app-data/dist/generatedTypes/v1.3.0';
3
+ import type { Nominal } from '@shapeshiftoss/caip';
4
+ import type { TypedDataField } from 'ethers5';
5
+ import type { Address } from 'viem';
6
+ import type { KnownChainIds } from './base';
7
+ export type AppDataHash = Nominal<string, 'AppDataHash'>;
8
+ export type AppData = Nominal<string, 'AppData'>;
9
+ export type OrderId = Nominal<string, 'OrderId'>;
10
+ export type CowSwapQuoteId = Nominal<number, 'CowSwapQuoteId'>;
11
+ export declare enum TypedDataPrimaryType {
12
+ Order = "Order",
13
+ OrderCancellations = "OrderCancellations"
14
+ }
15
+ export declare enum OrderKind {
16
+ BUY = "buy",
17
+ SELL = "sell"
18
+ }
19
+ export declare enum SellTokenSource {
20
+ ERC20 = "erc20",
21
+ INTERNAL = "internal",
22
+ EXTERNAL = "external"
23
+ }
24
+ export declare enum BuyTokenDestination {
25
+ ERC20 = "erc20",
26
+ INTERNAL = "internal"
27
+ }
28
+ export declare enum SigningScheme {
29
+ EIP712 = "eip712",
30
+ ETHSIGN = "ethsign",
31
+ PRESIGN = "presign",
32
+ EIP1271 = "eip1271"
33
+ }
34
+ export declare enum EcdsaSigningScheme {
35
+ EIP712 = "eip712",
36
+ ETHSIGN = "ethsign"
37
+ }
38
+ export declare enum OrderClass {
39
+ MARKET = "market",
40
+ LIMIT = "limit",
41
+ LIQUIDITY = "liquidity"
42
+ }
43
+ export declare enum PlacementError {
44
+ QUOTE_NOT_FOUND = "QuoteNotFound",
45
+ VALID_TO_TOO_FAR_IN_FUTURE = "ValidToTooFarInFuture",
46
+ PRE_VALIDATION_ERROR = "PreValidationError"
47
+ }
48
+ export declare enum OrderQuoteSideKindSell {
49
+ SELL = "sell"
50
+ }
51
+ export declare enum OrderQuoteSideKindBuy {
52
+ BUY = "buy"
53
+ }
54
+ export declare enum PriceQuality {
55
+ FAST = "fast",
56
+ OPTIMAL = "optimal",
57
+ VERIFIED = "verified"
58
+ }
59
+ export declare enum OrderError {
60
+ DUPLICATED_ORDER = "DuplicatedOrder",
61
+ QUOTE_NOT_FOUND = "QuoteNotFound",
62
+ QUOTE_NOT_VERIFIED = "QuoteNotVerified",
63
+ INVALID_QUOTE = "InvalidQuote",
64
+ MISSING_FROM = "MissingFrom",
65
+ WRONG_OWNER = "WrongOwner",
66
+ INVALID_EIP1271SIGNATURE = "InvalidEip1271Signature",
67
+ INSUFFICIENT_BALANCE = "InsufficientBalance",
68
+ INSUFFICIENT_ALLOWANCE = "InsufficientAllowance",
69
+ INVALID_SIGNATURE = "InvalidSignature",
70
+ SELL_AMOUNT_OVERFLOW = "SellAmountOverflow",
71
+ TRANSFER_SIMULATION_FAILED = "TransferSimulationFailed",
72
+ ZERO_AMOUNT = "ZeroAmount",
73
+ INCOMPATIBLE_SIGNING_SCHEME = "IncompatibleSigningScheme",
74
+ TOO_MANY_LIMIT_ORDERS = "TooManyLimitOrders",
75
+ TOO_MUCH_GAS = "TooMuchGas",
76
+ UNSUPPORTED_BUY_TOKEN_DESTINATION = "UnsupportedBuyTokenDestination",
77
+ UNSUPPORTED_SELL_TOKEN_SOURCE = "UnsupportedSellTokenSource",
78
+ UNSUPPORTED_ORDER_TYPE = "UnsupportedOrderType",
79
+ INSUFFICIENT_VALID_TO = "InsufficientValidTo",
80
+ EXCESSIVE_VALID_TO = "ExcessiveValidTo",
81
+ INVALID_NATIVE_SELL_TOKEN = "InvalidNativeSellToken",
82
+ SAME_BUY_AND_SELL_TOKEN = "SameBuyAndSellToken",
83
+ UNSUPPORTED_TOKEN = "UnsupportedToken",
84
+ INVALID_APP_DATA = "InvalidAppData",
85
+ APP_DATA_HASH_MISMATCH = "AppDataHashMismatch",
86
+ APPDATA_FROM_MISMATCH = "AppdataFromMismatch",
87
+ SELL_AMOUNT_DOES_NOT_COVER_FEE = "SellAmountDoesNotCoverFee",
88
+ NO_LIQUIDITY = "NoLiquidity"
89
+ }
90
+ export declare enum CompetitionOrderStatusType {
91
+ OPEN = "open",
92
+ SCHEDULED = "scheduled",
93
+ ACTIVE = "active",
94
+ SOLVED = "solved",
95
+ EXECUTING = "executing",
96
+ TRADED = "traded",
97
+ CANCELLED = "cancelled"
98
+ }
99
+ export declare enum OrderStatus {
100
+ PRESIGNATURE_PENDING = "presignaturePending",
101
+ OPEN = "open",
102
+ FULFILLED = "fulfilled",
103
+ CANCELLED = "cancelled",
104
+ EXPIRED = "expired"
105
+ }
106
+ export type OrderCreation = {
107
+ sellToken: Address;
108
+ buyToken: Address;
109
+ receiver?: Address | null;
110
+ sellAmount: string;
111
+ buyAmount: string;
112
+ validTo: number;
113
+ feeAmount: string;
114
+ kind: OrderKind;
115
+ partiallyFillable: boolean;
116
+ sellTokenBalance?: SellTokenSource;
117
+ buyTokenBalance?: BuyTokenDestination;
118
+ signingScheme: SigningScheme;
119
+ signature: string;
120
+ from?: Address | null;
121
+ quoteId?: CowSwapQuoteId | null;
122
+ appData: AppData | AppDataHash;
123
+ appDataHash?: AppDataHash | null;
124
+ };
125
+ export type UnsignedOrderCreation = Omit<OrderCreation, 'signature'> & Partial<Pick<OrderCreation, 'signature'>>;
126
+ export type EthflowData = {
127
+ refundTxHash: string | null;
128
+ userValidTo: number;
129
+ };
130
+ export type OnchainOrderData = {
131
+ sender: Address;
132
+ placementError?: PlacementError;
133
+ };
134
+ export type OrderMetaData = {
135
+ creationDate: string;
136
+ class: OrderClass;
137
+ owner: Address;
138
+ uid: string;
139
+ availableBalance?: string | null;
140
+ sellAmount: string;
141
+ executedSellAmount: string;
142
+ executedSellAmountBeforeFees: string;
143
+ executedBuyAmount: string;
144
+ isLiquidityOrder?: boolean;
145
+ ethflowData?: EthflowData;
146
+ onchainUser?: Address;
147
+ onchainOrderData?: OnchainOrderData;
148
+ executedSurplusFee?: string | null;
149
+ fullAppData?: string | null;
150
+ };
151
+ export type Order = OrderCreation & OrderMetaData & {
152
+ status: OrderStatus;
153
+ };
154
+ export type OrderParameters = {
155
+ sellToken: Address;
156
+ buyToken: Address;
157
+ receiver?: Address | null;
158
+ sellAmount: string;
159
+ buyAmount: string;
160
+ validTo: number;
161
+ appData: AppDataHash;
162
+ feeAmount: string;
163
+ kind: OrderKind;
164
+ partiallyFillable: boolean;
165
+ sellTokenBalance?: SellTokenSource;
166
+ buyTokenBalance?: BuyTokenDestination;
167
+ signingScheme?: SigningScheme;
168
+ };
169
+ export type OrderQuoteResponse = {
170
+ quote: OrderParameters;
171
+ from?: Address;
172
+ expiration: string;
173
+ id?: CowSwapQuoteId;
174
+ verified: boolean;
175
+ };
176
+ export type OrderQuoteSide = {
177
+ kind: OrderQuoteSideKindSell;
178
+ sellAmountBeforeFee: string;
179
+ } | {
180
+ kind: OrderQuoteSideKindSell;
181
+ sellAmountAfterFee: string;
182
+ } | {
183
+ kind: OrderQuoteSideKindBuy;
184
+ buyAmountAfterFee: string;
185
+ };
186
+ export type OrderQuoteValidity = {
187
+ validTo?: number;
188
+ } | {
189
+ validFor?: number;
190
+ };
191
+ export type OrderQuoteRequest = OrderQuoteSide & OrderQuoteValidity & {
192
+ sellToken: Address;
193
+ buyToken: Address;
194
+ receiver?: Address | null;
195
+ appData?: AppData | AppDataHash;
196
+ appDataHash?: AppDataHash;
197
+ sellTokenBalance?: SellTokenSource;
198
+ buyTokenBalance?: BuyTokenDestination;
199
+ from: Address;
200
+ priceQuality?: PriceQuality;
201
+ signingScheme?: SigningScheme;
202
+ onchainOrder?: any;
203
+ };
204
+ export type OrderCancellation = {
205
+ orderUids: string[];
206
+ signature: string;
207
+ signingScheme: EcdsaSigningScheme;
208
+ };
209
+ export type ExecutedAmounts = {
210
+ sell: string;
211
+ buy: string;
212
+ };
213
+ export type CompetitionOrderStatus = {
214
+ type: CompetitionOrderStatusType;
215
+ value?: {
216
+ solver: string;
217
+ executedAmounts?: ExecutedAmounts;
218
+ }[];
219
+ };
220
+ export type Quote = {
221
+ sellAmount?: string;
222
+ buyAmount?: string;
223
+ fee?: string;
224
+ };
225
+ export type PriceImprovement = {
226
+ factor: number;
227
+ maxVolumeFactor: number;
228
+ quote: Quote;
229
+ };
230
+ export type Surplus = {
231
+ factor: number;
232
+ maxVolumeFactor: number;
233
+ };
234
+ export type Volume = {
235
+ factor: number;
236
+ };
237
+ export type FeePolicy = Surplus | Volume | PriceImprovement;
238
+ export type ExecutedProtocolFee = {
239
+ policy?: FeePolicy;
240
+ amount?: string;
241
+ token?: Address;
242
+ };
243
+ export type Trade = {
244
+ blockNumber: number;
245
+ logIndex: number;
246
+ orderUid: string;
247
+ owner: Address;
248
+ sellToken: Address;
249
+ buyToken: Address;
250
+ sellAmount: string;
251
+ sellAmountBeforeFees: string;
252
+ buyAmount: string;
253
+ txHash: string | null;
254
+ executedProtocolFees?: ExecutedProtocolFee[];
255
+ };
256
+ export type CowSwapError = {
257
+ errorType: OrderError;
258
+ description: string;
259
+ data?: unknown;
260
+ };
261
+ export declare enum CowNetwork {
262
+ Mainnet = "mainnet",
263
+ Xdai = "xdai",
264
+ ArbitrumOne = "arbitrum_one",
265
+ Base = "base"
266
+ }
267
+ export type CowChainId = KnownChainIds.EthereumMainnet | KnownChainIds.GnosisMainnet | KnownChainIds.ArbitrumMainnet;
268
+ export type TypedDataTypes = Record<string, TypedDataField[]>;
269
+ export type ParsedAppData = AppDataRootSchemaLatest | AppDataRootSchemaLegacy;
270
+ export declare const isLegacyAppData: (appData: ParsedAppData) => appData is AppDataRootSchemaLegacy;
@@ -0,0 +1,123 @@
1
+ // The following are lifted directly out of the cowprotocol source code because ethers version conflicts prevent us importing the SDK directly.
2
+ // https://github.dev/cowprotocol/cow-sdk/blob/main/src/order-book/generated/models/
3
+ export var TypedDataPrimaryType;
4
+ (function (TypedDataPrimaryType) {
5
+ TypedDataPrimaryType["Order"] = "Order";
6
+ TypedDataPrimaryType["OrderCancellations"] = "OrderCancellations";
7
+ })(TypedDataPrimaryType || (TypedDataPrimaryType = {}));
8
+ export var OrderKind;
9
+ (function (OrderKind) {
10
+ OrderKind["BUY"] = "buy";
11
+ OrderKind["SELL"] = "sell";
12
+ })(OrderKind || (OrderKind = {}));
13
+ export var SellTokenSource;
14
+ (function (SellTokenSource) {
15
+ SellTokenSource["ERC20"] = "erc20";
16
+ SellTokenSource["INTERNAL"] = "internal";
17
+ SellTokenSource["EXTERNAL"] = "external";
18
+ })(SellTokenSource || (SellTokenSource = {}));
19
+ export var BuyTokenDestination;
20
+ (function (BuyTokenDestination) {
21
+ BuyTokenDestination["ERC20"] = "erc20";
22
+ BuyTokenDestination["INTERNAL"] = "internal";
23
+ })(BuyTokenDestination || (BuyTokenDestination = {}));
24
+ export var SigningScheme;
25
+ (function (SigningScheme) {
26
+ SigningScheme["EIP712"] = "eip712";
27
+ SigningScheme["ETHSIGN"] = "ethsign";
28
+ SigningScheme["PRESIGN"] = "presign";
29
+ SigningScheme["EIP1271"] = "eip1271";
30
+ })(SigningScheme || (SigningScheme = {}));
31
+ export var EcdsaSigningScheme;
32
+ (function (EcdsaSigningScheme) {
33
+ EcdsaSigningScheme["EIP712"] = "eip712";
34
+ EcdsaSigningScheme["ETHSIGN"] = "ethsign";
35
+ })(EcdsaSigningScheme || (EcdsaSigningScheme = {}));
36
+ export var OrderClass;
37
+ (function (OrderClass) {
38
+ OrderClass["MARKET"] = "market";
39
+ OrderClass["LIMIT"] = "limit";
40
+ OrderClass["LIQUIDITY"] = "liquidity";
41
+ })(OrderClass || (OrderClass = {}));
42
+ export var PlacementError;
43
+ (function (PlacementError) {
44
+ PlacementError["QUOTE_NOT_FOUND"] = "QuoteNotFound";
45
+ PlacementError["VALID_TO_TOO_FAR_IN_FUTURE"] = "ValidToTooFarInFuture";
46
+ PlacementError["PRE_VALIDATION_ERROR"] = "PreValidationError";
47
+ })(PlacementError || (PlacementError = {}));
48
+ export var OrderQuoteSideKindSell;
49
+ (function (OrderQuoteSideKindSell) {
50
+ OrderQuoteSideKindSell["SELL"] = "sell";
51
+ })(OrderQuoteSideKindSell || (OrderQuoteSideKindSell = {}));
52
+ export var OrderQuoteSideKindBuy;
53
+ (function (OrderQuoteSideKindBuy) {
54
+ OrderQuoteSideKindBuy["BUY"] = "buy";
55
+ })(OrderQuoteSideKindBuy || (OrderQuoteSideKindBuy = {}));
56
+ export var PriceQuality;
57
+ (function (PriceQuality) {
58
+ PriceQuality["FAST"] = "fast";
59
+ PriceQuality["OPTIMAL"] = "optimal";
60
+ PriceQuality["VERIFIED"] = "verified";
61
+ })(PriceQuality || (PriceQuality = {}));
62
+ export var OrderError;
63
+ (function (OrderError) {
64
+ OrderError["DUPLICATED_ORDER"] = "DuplicatedOrder";
65
+ OrderError["QUOTE_NOT_FOUND"] = "QuoteNotFound";
66
+ OrderError["QUOTE_NOT_VERIFIED"] = "QuoteNotVerified";
67
+ OrderError["INVALID_QUOTE"] = "InvalidQuote";
68
+ OrderError["MISSING_FROM"] = "MissingFrom";
69
+ OrderError["WRONG_OWNER"] = "WrongOwner";
70
+ OrderError["INVALID_EIP1271SIGNATURE"] = "InvalidEip1271Signature";
71
+ OrderError["INSUFFICIENT_BALANCE"] = "InsufficientBalance";
72
+ OrderError["INSUFFICIENT_ALLOWANCE"] = "InsufficientAllowance";
73
+ OrderError["INVALID_SIGNATURE"] = "InvalidSignature";
74
+ OrderError["SELL_AMOUNT_OVERFLOW"] = "SellAmountOverflow";
75
+ OrderError["TRANSFER_SIMULATION_FAILED"] = "TransferSimulationFailed";
76
+ OrderError["ZERO_AMOUNT"] = "ZeroAmount";
77
+ OrderError["INCOMPATIBLE_SIGNING_SCHEME"] = "IncompatibleSigningScheme";
78
+ OrderError["TOO_MANY_LIMIT_ORDERS"] = "TooManyLimitOrders";
79
+ OrderError["TOO_MUCH_GAS"] = "TooMuchGas";
80
+ OrderError["UNSUPPORTED_BUY_TOKEN_DESTINATION"] = "UnsupportedBuyTokenDestination";
81
+ OrderError["UNSUPPORTED_SELL_TOKEN_SOURCE"] = "UnsupportedSellTokenSource";
82
+ OrderError["UNSUPPORTED_ORDER_TYPE"] = "UnsupportedOrderType";
83
+ OrderError["INSUFFICIENT_VALID_TO"] = "InsufficientValidTo";
84
+ OrderError["EXCESSIVE_VALID_TO"] = "ExcessiveValidTo";
85
+ OrderError["INVALID_NATIVE_SELL_TOKEN"] = "InvalidNativeSellToken";
86
+ OrderError["SAME_BUY_AND_SELL_TOKEN"] = "SameBuyAndSellToken";
87
+ OrderError["UNSUPPORTED_TOKEN"] = "UnsupportedToken";
88
+ OrderError["INVALID_APP_DATA"] = "InvalidAppData";
89
+ OrderError["APP_DATA_HASH_MISMATCH"] = "AppDataHashMismatch";
90
+ OrderError["APPDATA_FROM_MISMATCH"] = "AppdataFromMismatch";
91
+ // Not documented in API docs, but exists.
92
+ // Most likely non-exhaustive, see https://github.com/cowprotocol/contracts/blob/aaffdc55b2a13738b7c32de96f487d3eb5b4f8c6/src/ts/api.ts#L110
93
+ OrderError["SELL_AMOUNT_DOES_NOT_COVER_FEE"] = "SellAmountDoesNotCoverFee";
94
+ OrderError["NO_LIQUIDITY"] = "NoLiquidity";
95
+ })(OrderError || (OrderError = {}));
96
+ export var CompetitionOrderStatusType;
97
+ (function (CompetitionOrderStatusType) {
98
+ CompetitionOrderStatusType["OPEN"] = "open";
99
+ CompetitionOrderStatusType["SCHEDULED"] = "scheduled";
100
+ CompetitionOrderStatusType["ACTIVE"] = "active";
101
+ CompetitionOrderStatusType["SOLVED"] = "solved";
102
+ CompetitionOrderStatusType["EXECUTING"] = "executing";
103
+ CompetitionOrderStatusType["TRADED"] = "traded";
104
+ CompetitionOrderStatusType["CANCELLED"] = "cancelled";
105
+ })(CompetitionOrderStatusType || (CompetitionOrderStatusType = {}));
106
+ export var OrderStatus;
107
+ (function (OrderStatus) {
108
+ OrderStatus["PRESIGNATURE_PENDING"] = "presignaturePending";
109
+ OrderStatus["OPEN"] = "open";
110
+ OrderStatus["FULFILLED"] = "fulfilled";
111
+ OrderStatus["CANCELLED"] = "cancelled";
112
+ OrderStatus["EXPIRED"] = "expired";
113
+ })(OrderStatus || (OrderStatus = {}));
114
+ export var CowNetwork;
115
+ (function (CowNetwork) {
116
+ CowNetwork["Mainnet"] = "mainnet";
117
+ CowNetwork["Xdai"] = "xdai";
118
+ CowNetwork["ArbitrumOne"] = "arbitrum_one";
119
+ CowNetwork["Base"] = "base";
120
+ })(CowNetwork || (CowNetwork = {}));
121
+ export const isLegacyAppData = (appData) => {
122
+ return appData.version === 'v0.4.0';
123
+ };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export * from './cowSwap';
1
2
  export * from './base';
2
3
  export * from './market';
3
4
  export * from './utility';
5
+ export * from './zerion';
package/dist/index.js CHANGED
@@ -1,19 +1,5 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./base"), exports);
18
- __exportStar(require("./market"), exports);
19
- __exportStar(require("./utility"), exports);
1
+ export * from './cowSwap';
2
+ export * from './base';
3
+ export * from './market';
4
+ export * from './utility';
5
+ export * from './zerion';
package/dist/market.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- export declare type MarketData = {
1
+ import type { AssetId } from '@shapeshiftoss/caip';
2
+ export type MarketData = {
2
3
  price: string;
3
4
  marketCap: string;
4
5
  volume: string;
@@ -14,22 +15,22 @@ export declare enum HistoryTimeframe {
14
15
  YEAR = "1Y",
15
16
  ALL = "All"
16
17
  }
17
- export declare type HistoryData = {
18
+ export type HistoryData = {
18
19
  price: number;
19
20
  date: number;
20
21
  };
21
- export declare type PriceHistoryArgs = {
22
+ export type PriceHistoryArgs = {
22
23
  assetId: string;
23
24
  timeframe: HistoryTimeframe;
24
25
  };
25
- export declare type MarketDataArgs = {
26
+ export type MarketDataArgs = {
26
27
  assetId: string;
27
28
  };
28
- export declare type FindAllMarketType = (args: FindAllMarketArgs) => Promise<MarketCapResult>;
29
- export declare type PriceHistoryType = (args: PriceHistoryArgs) => Promise<HistoryData[]>;
30
- export declare type FindAllMarketArgs = {
29
+ export type FindAllMarketType = (args: FindAllMarketArgs) => Promise<MarketCapResult>;
30
+ export type PriceHistoryType = (args: PriceHistoryArgs) => Promise<HistoryData[]>;
31
+ export type FindAllMarketArgs = {
31
32
  count: number;
32
33
  };
33
- export declare type MarketCapResult = {
34
- [k: string]: MarketData;
34
+ export type MarketCapResult = {
35
+ [k: AssetId]: MarketData;
35
36
  };
package/dist/market.js CHANGED
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HistoryTimeframe = void 0;
4
- var HistoryTimeframe;
1
+ export var HistoryTimeframe;
5
2
  (function (HistoryTimeframe) {
6
3
  HistoryTimeframe["HOUR"] = "1H";
7
4
  HistoryTimeframe["DAY"] = "24H";
@@ -9,4 +6,4 @@ var HistoryTimeframe;
9
6
  HistoryTimeframe["MONTH"] = "1M";
10
7
  HistoryTimeframe["YEAR"] = "1Y";
11
8
  HistoryTimeframe["ALL"] = "All";
12
- })(HistoryTimeframe = exports.HistoryTimeframe || (exports.HistoryTimeframe = {}));
9
+ })(HistoryTimeframe || (HistoryTimeframe = {}));
package/dist/utility.d.ts CHANGED
@@ -4,21 +4,28 @@
4
4
  * See: https://stackoverflow.com/questions/55904032/how-to-get-optional-property-from-union
5
5
  */
6
6
  /** Get specific type for key(K) in union(T) */
7
- export declare type ValueOfUnion<T, K> = T extends unknown ? (K extends keyof T ? T[K] : undefined) : never;
7
+ export type ValueOfUnion<T, K> = T extends unknown ? (K extends keyof T ? T[K] : undefined) : never;
8
8
  /** Get all keys in union(T) as union */
9
- export declare type KeysOfUnion<T> = T extends unknown ? keyof T : never;
9
+ export type KeysOfUnion<T> = T extends unknown ? keyof T : never;
10
10
  /**
11
11
  * Create mapping of all keys in union(T) with proper type values
12
12
  *
13
13
  * _note: `| keyof T` index is simply to tell typescript that T is definitely a sub type of KeysOfUnion_
14
14
  */
15
- export declare type UnionMapping<T> = {
15
+ export type UnionMapping<T> = {
16
16
  [K in KeysOfUnion<T> | keyof T]: ValueOfUnion<T, K>;
17
17
  };
18
18
  /** Pick out the elements we know for sure and make everything else optional */
19
- export declare type UnionMerge<T> = Pick<UnionMapping<T>, keyof T> & Partial<UnionMapping<T>>;
19
+ export type UnionMerge<T> = Pick<UnionMapping<T>, keyof T> & Partial<UnionMapping<T>>;
20
20
  /** Adds all possible values of union(T) as a nested object under a `chainSpecific` key */
21
- export declare type ChainSpecific<T, M> = UnionMerge<T extends unknown ? (T extends keyof M ? {
21
+ export type ChainSpecific<T, M> = UnionMerge<T extends unknown ? (T extends keyof M ? {
22
22
  chainSpecific: M[T];
23
23
  } : undefined) : never>;
24
- export declare type PartialRecord<K extends keyof any, V> = Partial<Record<K, V>>;
24
+ export type PartialRecord<K extends keyof any, V> = Partial<Record<K, V>>;
25
+ export type NestedArray<T> = PartialRecord<keyof any, PartialRecord<keyof any, T[]>>;
26
+ type Head<T extends string> = T extends `${infer First}.${string}` ? First : T;
27
+ type Tail<T extends string> = T extends `${string}.${infer Rest}` ? Rest : never;
28
+ export type DeepPick<T, K extends string> = T extends object ? {
29
+ [P in Extract<Head<K>, keyof T>]: Tail<Extract<K, `${P}.${string}`>> extends never ? T[P] : DeepPick<T[P], Tail<Extract<K, `${P}.${string}`>>>;
30
+ } : T;
31
+ export {};
package/dist/utility.js CHANGED
@@ -1,7 +1,6 @@
1
- "use strict";
2
1
  /**
3
2
  * Further reading on ideas behind these utility types
4
3
  *
5
4
  * See: https://stackoverflow.com/questions/55904032/how-to-get-optional-property-from-union
6
5
  */
7
- Object.defineProperty(exports, "__esModule", { value: true });
6
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { ChainId } from '@shapeshiftoss/caip';
2
+ export declare const ZERION_CHAINS: readonly ["avalanche", "binance-smart-chain", "ethereum", "optimism", "polygon", "arbitrum", "xdai", "base"];
3
+ export type ZerionChainId = (typeof ZERION_CHAINS)[number];
4
+ export declare const ZERION_CHAINS_MAP: Record<ZerionChainId, ChainId>;
5
+ export declare const zerionChainIdToChainId: (chainId: ZerionChainId) => ChainId | undefined;