@gmx-io/sdk 2.1.2 → 2.2.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.
Files changed (64) hide show
  1. package/build/cjs/src/abis/TransitStation.js +2222 -0
  2. package/build/cjs/src/abis/index.js +2 -0
  3. package/build/cjs/src/clients/v2/index.js +54 -27
  4. package/build/cjs/src/codegen/prebuilt/hashedKinkModelMarketRatesKeys.json +32 -0
  5. package/build/cjs/src/codegen/prebuilt/hashedMarketConfigKeys.json +272 -0
  6. package/build/cjs/src/codegen/prebuilt/hashedMarketValuesKeys.json +60 -0
  7. package/build/cjs/src/configs/chains.js +9 -1
  8. package/build/cjs/src/configs/markets.js +28 -0
  9. package/build/cjs/src/configs/tokens.js +9 -0
  10. package/build/cjs/src/utils/__tests__/numbers.spec.js +79 -0
  11. package/build/cjs/src/utils/errors/transactionsErrors.js +1 -0
  12. package/build/cjs/src/utils/numbers/index.js +1 -0
  13. package/build/cjs/src/utils/numbers/parts.js +48 -0
  14. package/build/cjs/src/utils/numbers/utils.js +67 -26
  15. package/build/cjs/src/utils/orderTransactions/utils.js +55 -1
  16. package/build/cjs/src/utils/paxos/__tests__/api.spec.js +128 -0
  17. package/build/cjs/src/utils/paxos/api.js +129 -0
  18. package/build/cjs/src/utils/paxos/types.js +2 -0
  19. package/build/cjs/src/utils/usdgBoostApr/api.js +7 -0
  20. package/build/cjs/src/utils/usdgBoostApr/types.js +2 -0
  21. package/build/cjs/src/utils/whitelists/api.js +9 -0
  22. package/build/cjs/src/utils/whitelists/types.js +2 -0
  23. package/build/esm/src/abis/TransitStation.js +2220 -0
  24. package/build/esm/src/abis/index.js +2 -0
  25. package/build/esm/src/clients/v2/index.js +27 -0
  26. package/build/esm/src/codegen/prebuilt/hashedKinkModelMarketRatesKeys.json +32 -0
  27. package/build/esm/src/codegen/prebuilt/hashedMarketConfigKeys.json +272 -0
  28. package/build/esm/src/codegen/prebuilt/hashedMarketValuesKeys.json +60 -0
  29. package/build/esm/src/configs/chains.js +7 -0
  30. package/build/esm/src/configs/markets.js +28 -0
  31. package/build/esm/src/configs/tokens.js +9 -0
  32. package/build/esm/src/utils/__tests__/numbers.spec.js +80 -1
  33. package/build/esm/src/utils/errors/transactionsErrors.js +1 -0
  34. package/build/esm/src/utils/numbers/index.js +1 -0
  35. package/build/esm/src/utils/numbers/parts.js +41 -0
  36. package/build/esm/src/utils/numbers/utils.js +57 -24
  37. package/build/esm/src/utils/orderTransactions/utils.js +53 -1
  38. package/build/esm/src/utils/paxos/__tests__/api.spec.js +126 -0
  39. package/build/esm/src/utils/paxos/api.js +120 -0
  40. package/build/esm/src/utils/paxos/types.js +1 -0
  41. package/build/esm/src/utils/usdgBoostApr/api.js +3 -0
  42. package/build/esm/src/utils/usdgBoostApr/types.js +1 -0
  43. package/build/esm/src/utils/whitelists/api.js +5 -0
  44. package/build/esm/src/utils/whitelists/types.js +1 -0
  45. package/build/tsconfig.tsbuildinfo +1 -1
  46. package/build/types/src/abis/TransitStation.d.ts +1710 -0
  47. package/build/types/src/abis/index.d.ts +1709 -0
  48. package/build/types/src/clients/v2/index.d.ts +20 -0
  49. package/build/types/src/codegen/prebuilt/index.d.ts +364 -0
  50. package/build/types/src/configs/chains.d.ts +1 -0
  51. package/build/types/src/utils/errors/transactionsErrors.d.ts +1 -0
  52. package/build/types/src/utils/numbers/index.d.ts +1 -0
  53. package/build/types/src/utils/numbers/parts.d.ts +12 -0
  54. package/build/types/src/utils/numbers/utils.d.ts +25 -9
  55. package/build/types/src/utils/orderTransactions/utils.d.ts +7 -0
  56. package/build/types/src/utils/paxos/__tests__/api.spec.d.ts +1 -0
  57. package/build/types/src/utils/paxos/api.d.ts +24 -0
  58. package/build/types/src/utils/paxos/types.d.ts +139 -0
  59. package/build/types/src/utils/trade/types.d.ts +2 -0
  60. package/build/types/src/utils/usdgBoostApr/api.d.ts +5 -0
  61. package/build/types/src/utils/usdgBoostApr/types.d.ts +19 -0
  62. package/build/types/src/utils/whitelists/api.d.ts +7 -0
  63. package/build/types/src/utils/whitelists/types.d.ts +6 -0
  64. package/package.json +1 -1
@@ -0,0 +1,139 @@
1
+ export type TransitFeeTier = "zeroFee" | "standardFee";
2
+ export type TransitResponseFormat = "encoded" | "full" | "structured";
3
+ export type TransitOrderStatus = "PENDING_BRIDGE" | "PROCESSING" | "PROCESSED" | "REMOVED";
4
+ export type TransitFeeTierResponse = {
5
+ feeTier: TransitFeeTier;
6
+ zeroFeeCapacity: bigint;
7
+ };
8
+ export type TransitTokenMetadata = {
9
+ chain_id: string;
10
+ address: string;
11
+ name: string;
12
+ symbol: string;
13
+ decimals: string;
14
+ token_standard: string;
15
+ };
16
+ export type TransitRoute = {
17
+ sourceChainId: number;
18
+ destinationChainId: number;
19
+ destinationChainEID: number;
20
+ offerAsset: string;
21
+ wantAsset: string;
22
+ minOrderSize: bigint;
23
+ tokenMetadataMap: Record<string, TransitTokenMetadata>;
24
+ };
25
+ export type TransitRoutesParams = {
26
+ filter?: string;
27
+ feeTier?: TransitFeeTier;
28
+ };
29
+ export type TransitPermitData = {
30
+ domain: {
31
+ name: string;
32
+ version: string;
33
+ chainId: number;
34
+ verifyingContract: string;
35
+ };
36
+ types: Record<string, {
37
+ name: string;
38
+ type: string;
39
+ }[]>;
40
+ value: {
41
+ owner: string;
42
+ spender: string;
43
+ value: string;
44
+ nonce: string;
45
+ deadline: string;
46
+ };
47
+ deadline: string;
48
+ };
49
+ export type TransitAuthorizationMethod = {
50
+ type: "eip2612_permit";
51
+ description: string;
52
+ permitData: TransitPermitData;
53
+ } | {
54
+ type: "erc20_approve";
55
+ description: string;
56
+ transaction: {
57
+ encoded: string;
58
+ };
59
+ };
60
+ export type TransitAuthorizationParams = {
61
+ userAddress: string;
62
+ tokenAddress: string;
63
+ spenderAddress: string;
64
+ amount: bigint;
65
+ chainId: number;
66
+ };
67
+ export type TransitAuthorizationResponse = {
68
+ spenderAddress: string;
69
+ alreadyApproved: boolean;
70
+ methods: TransitAuthorizationMethod[];
71
+ };
72
+ export type TransitQuoteParams = {
73
+ userAddress: string;
74
+ offerAsset: string;
75
+ wantAsset: string;
76
+ offerAmount: bigint;
77
+ sourceChainId: number;
78
+ destinationChainId: number;
79
+ permitSignature?: string;
80
+ permitDeadline?: number;
81
+ responseFormat?: TransitResponseFormat;
82
+ feeTier?: TransitFeeTier;
83
+ };
84
+ export type TransitQuoteTransaction = {
85
+ to: string;
86
+ data?: string;
87
+ value: bigint;
88
+ abi?: unknown[];
89
+ functionName?: "submitOrder" | "submitOrderWithPermit";
90
+ args?: unknown[];
91
+ };
92
+ export type TransitQuote = {
93
+ transaction: TransitQuoteTransaction;
94
+ amountOut: bigint;
95
+ protocolFee: bigint;
96
+ fillCostFee: bigint;
97
+ conversionRateFee: bigint;
98
+ conversionRateHundredthsBps: number;
99
+ integratorFee: bigint;
100
+ totalFees: bigint;
101
+ estimatedLatencyMs: number | undefined;
102
+ };
103
+ export type TransitOrderExecution = {
104
+ id: string;
105
+ amount: bigint;
106
+ remaining: bigint;
107
+ timestamp: number;
108
+ txHash: string;
109
+ chainId: number;
110
+ };
111
+ export type TransitOrder = {
112
+ id: string;
113
+ offerAsset: string;
114
+ wantAsset: string;
115
+ amountDue: bigint;
116
+ remainingAmountDue: bigint;
117
+ offerAmount: bigint;
118
+ receiver: string;
119
+ distributorCode: string;
120
+ destinationChainId: number;
121
+ sourceChainId: number;
122
+ receiveTime: number;
123
+ status: TransitOrderStatus;
124
+ user: string;
125
+ createdAt: string;
126
+ updatedAt: string;
127
+ tokenMetadata: Record<string, TransitTokenMetadata>;
128
+ orderExecuteds: TransitOrderExecution[];
129
+ };
130
+ export type TransitOrdersParams = {
131
+ userAddress: string;
132
+ pageSize?: number;
133
+ pageToken?: string;
134
+ filter?: string;
135
+ };
136
+ export type TransitOrdersResponse = {
137
+ orders: TransitOrder[];
138
+ nextPageToken: string | undefined;
139
+ };
@@ -127,6 +127,8 @@ export type DepositAmounts = {
127
127
  glvTokenUsd: bigint;
128
128
  shortTokenAmount: bigint;
129
129
  shortTokenUsd: bigint;
130
+ initialShortTokenAmount?: bigint;
131
+ shortTokenSwapPathStats?: SwapPathStats;
130
132
  swapFeeUsd: bigint;
131
133
  uiFeeUsd: bigint;
132
134
  swapPriceImpactDeltaUsd: bigint;
@@ -0,0 +1,5 @@
1
+ import { IHttp } from "../http/types";
2
+ import { UsdgBoostAprResponse } from "./types";
3
+ export declare function fetchApiUsdgBoostApr(ctx: {
4
+ api: IHttp;
5
+ }): Promise<UsdgBoostAprResponse>;
@@ -0,0 +1,19 @@
1
+ export type UsdgPoolBoostApr = {
2
+ marketAddress: string;
3
+ boostApr: number;
4
+ lastRoundTimestamp: number;
5
+ };
6
+ export type UsdgGlvBoostApr = {
7
+ glvAddress: string;
8
+ boostApr: number;
9
+ gmRate: number;
10
+ premium: number | null;
11
+ lastRoundTimestamp: number;
12
+ };
13
+ export type UsdgBoostAprResponse = {
14
+ status: "not_started";
15
+ } | {
16
+ status: "active";
17
+ pools: UsdgPoolBoostApr[];
18
+ glv: UsdgGlvBoostApr | null;
19
+ };
@@ -0,0 +1,7 @@
1
+ import { IHttp } from "../http/types";
2
+ import { AccountWhitelists } from "./types";
3
+ export declare function fetchApiWhitelists(ctx: {
4
+ api: IHttp;
5
+ }, params: {
6
+ address: string;
7
+ }): Promise<AccountWhitelists>;
@@ -0,0 +1,6 @@
1
+ export type AccountWhitelists = {
2
+ deposit: {
3
+ markets: Record<string, boolean>;
4
+ glvs: Record<string, boolean>;
5
+ };
6
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmx-io/sdk",
3
- "version": "2.1.2",
3
+ "version": "2.2.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",