sushi 7.1.0 → 7.2.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.
Files changed (64) hide show
  1. package/_cjs/evm/config/subgraphs/get-subgraph-url.js +13 -1
  2. package/_cjs/evm/config/subgraphs/get-subgraph-url.js.map +1 -1
  3. package/_cjs/evm/config/subgraphs/index.js.map +1 -1
  4. package/_cjs/generic/currency/amount.js.map +1 -1
  5. package/_cjs/generic/currency/currency.js +1 -0
  6. package/_cjs/generic/currency/currency.js.map +1 -1
  7. package/_cjs/generic/currency/price.js.map +1 -1
  8. package/_cjs/generic/currency/token.js.map +1 -1
  9. package/_cjs/version.js +1 -1
  10. package/_esm/evm/config/subgraphs/get-subgraph-url.js +13 -1
  11. package/_esm/evm/config/subgraphs/get-subgraph-url.js.map +1 -1
  12. package/_esm/evm/config/subgraphs/index.js.map +1 -1
  13. package/_esm/generic/currency/amount.js.map +1 -1
  14. package/_esm/generic/currency/currency.js +1 -0
  15. package/_esm/generic/currency/currency.js.map +1 -1
  16. package/_esm/generic/currency/price.js.map +1 -1
  17. package/_esm/generic/currency/token.js.map +1 -1
  18. package/_esm/version.js +1 -1
  19. package/_types/evm/config/subgraphs/get-subgraph-url.d.ts +7 -1
  20. package/_types/evm/config/subgraphs/get-subgraph-url.d.ts.map +1 -1
  21. package/_types/evm/config/subgraphs/index.d.ts +1 -0
  22. package/_types/evm/config/subgraphs/index.d.ts.map +1 -1
  23. package/_types/evm/config/subgraphs/subgraphs/blade.d.ts +5 -2
  24. package/_types/evm/config/subgraphs/subgraphs/blade.d.ts.map +1 -1
  25. package/_types/evm/config/subgraphs/subgraphs/blocks.d.ts +5 -2
  26. package/_types/evm/config/subgraphs/subgraphs/blocks.d.ts.map +1 -1
  27. package/_types/evm/config/subgraphs/subgraphs/master-chef-v1.d.ts +5 -2
  28. package/_types/evm/config/subgraphs/subgraphs/master-chef-v1.d.ts.map +1 -1
  29. package/_types/evm/config/subgraphs/subgraphs/master-chef-v2.d.ts +5 -2
  30. package/_types/evm/config/subgraphs/subgraphs/master-chef-v2.d.ts.map +1 -1
  31. package/_types/evm/config/subgraphs/subgraphs/mini-chef.d.ts +5 -2
  32. package/_types/evm/config/subgraphs/subgraphs/mini-chef.d.ts.map +1 -1
  33. package/_types/evm/config/subgraphs/subgraphs/sushi-bar.d.ts +5 -2
  34. package/_types/evm/config/subgraphs/subgraphs/sushi-bar.d.ts.map +1 -1
  35. package/_types/evm/config/subgraphs/subgraphs/sushiswap-v2.d.ts +5 -2
  36. package/_types/evm/config/subgraphs/subgraphs/sushiswap-v2.d.ts.map +1 -1
  37. package/_types/evm/config/subgraphs/subgraphs/sushiswap-v3.d.ts +5 -2
  38. package/_types/evm/config/subgraphs/subgraphs/sushiswap-v3.d.ts.map +1 -1
  39. package/_types/generic/currency/amount.d.ts +17 -17
  40. package/_types/generic/currency/amount.d.ts.map +1 -1
  41. package/_types/generic/currency/currency.d.ts +4 -2
  42. package/_types/generic/currency/currency.d.ts.map +1 -1
  43. package/_types/generic/currency/price.d.ts +4 -4
  44. package/_types/generic/currency/price.d.ts.map +1 -1
  45. package/_types/generic/currency/token.d.ts +1 -1
  46. package/_types/generic/currency/token.d.ts.map +1 -1
  47. package/_types/generic/types/id.d.ts +1 -1
  48. package/_types/generic/types/id.d.ts.map +1 -1
  49. package/_types/generic/utils/subtract-slippage.d.ts +2 -2
  50. package/_types/generic/utils/subtract-slippage.d.ts.map +1 -1
  51. package/_types/version.d.ts +1 -1
  52. package/evm/config/subgraphs/get-subgraph-url.ts +31 -1
  53. package/evm/config/subgraphs/index.ts +1 -0
  54. package/evm/config/subgraphs/subgraph-url.test-d.ts +51 -0
  55. package/evm/config/subgraphs/subgraph-url.test.ts +28 -0
  56. package/generic/currency/amount.ts +30 -25
  57. package/generic/currency/currency.ts +11 -2
  58. package/generic/currency/extensible-currency.test-d.ts +51 -0
  59. package/generic/currency/extensible-currency.test.ts +83 -0
  60. package/generic/currency/price.ts +11 -9
  61. package/generic/currency/token.ts +1 -1
  62. package/generic/types/id.ts +1 -1
  63. package/generic/utils/subtract-slippage.ts +2 -2
  64. package/package.json +1 -1
@@ -1,11 +1,11 @@
1
1
  import { Fraction } from '../math/fraction.js'
2
2
  import type { BigintIsh } from '../types/bigintish.js'
3
3
  import { Amount } from './amount.js'
4
- import type { Currency } from './currency.js'
4
+ import type { AnyCurrency } from './currency.js'
5
5
 
6
6
  export class Price<
7
- TBase extends Currency,
8
- TQuote extends Currency,
7
+ TBase extends AnyCurrency,
8
+ TQuote extends AnyCurrency,
9
9
  > extends Fraction {
10
10
  public readonly base: TBase
11
11
  public readonly quote: TQuote
@@ -13,11 +13,10 @@ export class Price<
13
13
  /**
14
14
  * Creates a Price from a human-readable quote-per-base value, e.g. "1.5".
15
15
  */
16
- public static fromHuman<TBase extends Currency, TQuote extends Currency>(
17
- base: TBase,
18
- quote: TQuote,
19
- value: string,
20
- ): Price<TBase, TQuote> {
16
+ public static fromHuman<
17
+ TBase extends AnyCurrency,
18
+ TQuote extends AnyCurrency,
19
+ >(base: TBase, quote: TQuote, value: string): Price<TBase, TQuote> {
21
20
  if (!value.match(/^\d*\.?\d+$/)) {
22
21
  throw new Error(`Invalid price: ${value}`)
23
22
  }
@@ -37,7 +36,10 @@ export class Price<
37
36
  /**
38
37
  * Tries to create a Price from a human-readable quote-per-base value.
39
38
  */
40
- public static tryFromHuman<TBase extends Currency, TQuote extends Currency>(
39
+ public static tryFromHuman<
40
+ TBase extends AnyCurrency,
41
+ TQuote extends AnyCurrency,
42
+ >(
41
43
  base: TBase,
42
44
  quote: TQuote,
43
45
  value: string,
@@ -28,7 +28,7 @@ export abstract class Token<
28
28
  }
29
29
 
30
30
  public override isSame(
31
- other: BaseCurrency<ChainId, CurrencyMetadata, string, object>,
31
+ other: BaseCurrency<string | number, CurrencyMetadata, string, object>,
32
32
  ): boolean {
33
33
  return (
34
34
  super.isSame(other) &&
@@ -1,7 +1,7 @@
1
1
  import type { ChainId } from '../chain/chains.js'
2
2
 
3
3
  export type ID<
4
- TChainId extends ChainId = ChainId,
4
+ TChainId extends string | number = ChainId,
5
5
  TAddress extends string = string,
6
6
  TIncludeNative extends boolean = false,
7
7
  > =
@@ -1,5 +1,5 @@
1
1
  import type { Amount } from '../currency/amount.js'
2
- import type { Currency } from '../currency/currency.js'
2
+ import type { AnyCurrency } from '../currency/currency.js'
3
3
 
4
4
  /**
5
5
  *
@@ -8,7 +8,7 @@ import type { Currency } from '../currency/currency.js'
8
8
  *
9
9
  * @returns The amount after subtracting the slippage, eg. amount * 0.9 if slippage is 10% (0.1).
10
10
  */
11
- export function subtractSlippage<TCurrency extends Currency>(
11
+ export function subtractSlippage<TCurrency extends AnyCurrency>(
12
12
  amount: Amount<TCurrency>,
13
13
  slippage: number,
14
14
  ) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sushi",
3
3
  "description": "Sushi",
4
- "version": "7.1.0",
4
+ "version": "7.2.0",
5
5
  "main": "./_cjs/generic/index.js",
6
6
  "module": "./_esm/generic/index.js",
7
7
  "types": "./_types/generic/index.d.ts",