@swapkit/helpers 1.0.0-rc.71 → 1.0.0-rc.72

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/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { BaseDecimal } from '@swapkit/types';
1
2
  import { Chain } from '@swapkit/types';
2
3
  import type { ChainflipList } from '@swapkit/tokens';
3
4
  import { ChainId } from '@swapkit/types';
@@ -15,7 +16,7 @@ import type { TraderjoeList } from '@swapkit/tokens';
15
16
  import type { UniswapList } from '@swapkit/tokens';
16
17
  import type { WoofiList } from '@swapkit/tokens';
17
18
 
18
- declare type AllowedNumberTypes = 'bigint' | 'number' | 'string';
19
+ declare type AllowedNumberTypes = "bigint" | "number" | "string";
19
20
 
20
21
  export declare const assetFromString: (assetString: string) => {
21
22
  chain: Chain;
@@ -146,6 +147,7 @@ declare const errorMessages: {
146
147
  readonly core_swap_contract_not_supported: 10205;
147
148
  readonly core_swap_transaction_error: 10206;
148
149
  readonly core_swap_quote_mode_not_supported: 10207;
150
+ readonly core_swap_provider_not_found: 10208;
149
151
  /**
150
152
  * Core - Transaction
151
153
  */
@@ -172,6 +174,13 @@ declare const errorMessages: {
172
174
  readonly wallet_ledger_get_address_error: 20003;
173
175
  readonly wallet_ledger_device_not_found: 20004;
174
176
  readonly wallet_ledger_device_locked: 20005;
177
+ /**
178
+ * Chainflip
179
+ */
180
+ readonly chainflip_channel_error: 30001;
181
+ /**
182
+ * THORChain
183
+ */
175
184
  /**
176
185
  * Helpers
177
186
  */
@@ -240,7 +249,7 @@ export declare const getCommonAssetInfo: (assetString: CommonAssetString) => {
240
249
  export declare const getDecimal: ({ chain, symbol }: {
241
250
  chain: Chain;
242
251
  symbol: string;
243
- }) => Promise<number>;
252
+ }) => BaseDecimal | Promise<number>;
244
253
 
245
254
  export declare function getEstimatedPoolShare({ runeDepth, poolUnits, assetDepth, liquidityUnits, runeAmount, assetAmount, }: ShareParams<{
246
255
  runeAmount: string;
@@ -281,19 +290,26 @@ export declare const isGasAsset: ({ chain, symbol }: {
281
290
  }) => boolean;
282
291
 
283
292
  export declare type MemoOptions<T extends MemoType> = {
284
- [MemoType.BOND]: WithAddress;
285
- [MemoType.LEAVE]: WithAddress;
286
- [MemoType.CLOSE_LOAN]: WithAddress<{
293
+ [MemoType.BOND]: {
294
+ address: string;
295
+ };
296
+ [MemoType.LEAVE]: {
297
+ address: string;
298
+ };
299
+ [MemoType.CLOSE_LOAN]: {
300
+ address: string;
287
301
  asset: string;
288
302
  minAmount?: string;
289
- }>;
290
- [MemoType.OPEN_LOAN]: WithAddress<{
303
+ };
304
+ [MemoType.OPEN_LOAN]: {
305
+ address: string;
291
306
  asset: string;
292
307
  minAmount?: string;
293
- }>;
294
- [MemoType.UNBOND]: WithAddress<{
308
+ };
309
+ [MemoType.UNBOND]: {
310
+ address: string;
295
311
  unbondAmount: number;
296
- }>;
312
+ };
297
313
  [MemoType.DEPOSIT]: WithChain<{
298
314
  symbol: string;
299
315
  address?: string;
@@ -306,7 +322,7 @@ export declare type MemoOptions<T extends MemoType> = {
306
322
  targetAssetString?: string;
307
323
  singleSide?: boolean;
308
324
  }>;
309
- [MemoType.THORNAME_REGISTER]: Omit<ThornameRegisterParam, 'preferredAsset' | 'expiryBlock'>;
325
+ [MemoType.THORNAME_REGISTER]: Omit<ThornameRegisterParam, "preferredAsset" | "expiryBlock">;
310
326
  }[T];
311
327
 
312
328
  export declare type NumberPrimitives = bigint | number | string;
@@ -317,14 +333,14 @@ declare type NumberPrimitivesType = {
317
333
  string: string;
318
334
  };
319
335
 
320
- declare type PoolParams<T = {}> = T & {
336
+ declare type PoolParams = {
321
337
  runeAmount: string;
322
338
  assetAmount: string;
323
339
  runeDepth: string;
324
340
  assetDepth: string;
325
341
  };
326
342
 
327
- declare type ShareParams<T = {}> = T & {
343
+ declare type ShareParams<T extends {}> = T & {
328
344
  liquidityUnits: string;
329
345
  poolUnits: string;
330
346
  };
@@ -354,7 +370,7 @@ export declare type ThornameRegisterParam = {
354
370
  expiryBlock?: string;
355
371
  };
356
372
 
357
- declare type TokenNames = (typeof ThorchainList)['tokens'][number]['identifier'] | (typeof CoinGeckoList)['tokens'][number]['identifier'] | (typeof MayaList)['tokens'][number]['identifier'] | (typeof PancakeswapETHList)['tokens'][number]['identifier'] | (typeof PancakeswapList)['tokens'][number]['identifier'] | (typeof PangolinList)['tokens'][number]['identifier'] | (typeof StargateARBList)['tokens'][number]['identifier'] | (typeof SushiswapList)['tokens'][number]['identifier'] | (typeof TraderjoeList)['tokens'][number]['identifier'] | (typeof WoofiList)['tokens'][number]['identifier'] | (typeof UniswapList)['tokens'][number]['identifier'] | (typeof ChainflipList)['tokens'][number]['identifier'];
373
+ declare type TokenNames = (typeof ThorchainList)["tokens"][number]["identifier"] | (typeof CoinGeckoList)["tokens"][number]["identifier"] | (typeof MayaList)["tokens"][number]["identifier"] | (typeof PancakeswapETHList)["tokens"][number]["identifier"] | (typeof PancakeswapList)["tokens"][number]["identifier"] | (typeof PangolinList)["tokens"][number]["identifier"] | (typeof StargateARBList)["tokens"][number]["identifier"] | (typeof SushiswapList)["tokens"][number]["identifier"] | (typeof TraderjoeList)["tokens"][number]["identifier"] | (typeof WoofiList)["tokens"][number]["identifier"] | (typeof UniswapList)["tokens"][number]["identifier"] | (typeof ChainflipList)["tokens"][number]["identifier"];
358
374
 
359
375
  declare type TokenTax = {
360
376
  buy: number;
@@ -363,11 +379,7 @@ declare type TokenTax = {
363
379
 
364
380
  export declare function validateTHORName(name: string): boolean;
365
381
 
366
- declare type WithAddress<T = {}> = T & {
367
- address: string;
368
- };
369
-
370
- declare type WithChain<T = {}> = T & {
382
+ declare type WithChain<T extends {}> = T & {
371
383
  chain: Chain;
372
384
  };
373
385