@gainsnetwork/sdk 0.1.28-rc1 → 0.2.0-rc1

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 (66) hide show
  1. package/lib/constants.d.ts +1 -8
  2. package/lib/constants.js +3 -9
  3. package/lib/contracts/addresses.json +8 -44
  4. package/lib/contracts/index.js +1 -4
  5. package/lib/contracts/types/generated/GNSMultiCollatDiamond.d.ts +4608 -1133
  6. package/lib/contracts/types/generated/factories/GNSMultiCollatDiamond__factory.d.ts +190 -43
  7. package/lib/contracts/types/generated/factories/GNSMultiCollatDiamond__factory.js +9988 -1722
  8. package/lib/contracts/types/generated/factories/index.d.ts +0 -7
  9. package/lib/contracts/types/generated/factories/index.js +1 -15
  10. package/lib/contracts/types/generated/index.d.ts +0 -14
  11. package/lib/contracts/types/generated/index.js +1 -15
  12. package/lib/contracts/types/index.d.ts +2 -10
  13. package/lib/contracts/utils/borrowingFees.d.ts +4 -4
  14. package/lib/contracts/utils/borrowingFees.js +9 -5
  15. package/lib/contracts/utils/index.d.ts +0 -1
  16. package/lib/contracts/utils/index.js +0 -1
  17. package/lib/contracts/utils/openTrades.d.ts +1 -1
  18. package/lib/contracts/utils/openTrades.js +330 -138
  19. package/lib/contracts/utils/pairs.d.ts +1 -1
  20. package/lib/contracts/utils/pairs.js +27 -23
  21. package/lib/trade/fees/borrowing/converter.d.ts +12 -10
  22. package/lib/trade/fees/borrowing/converter.js +18 -24
  23. package/lib/trade/fees/borrowing/index.d.ts +3 -4
  24. package/lib/trade/fees/borrowing/index.js +12 -18
  25. package/lib/trade/fees/borrowing/types.d.ts +14 -20
  26. package/lib/trade/fees/index.js +2 -2
  27. package/lib/trade/index.d.ts +0 -1
  28. package/lib/trade/index.js +0 -1
  29. package/lib/trade/liquidation.d.ts +3 -3
  30. package/lib/trade/liquidation.js +4 -5
  31. package/lib/trade/pnl.js +12 -12
  32. package/lib/trade/types.d.ts +33 -69
  33. package/lib/trade/types.js +9 -16
  34. package/package.json +1 -1
  35. package/lib/contracts/types/generated/GFarmTradingStorageV5.d.ts +0 -1911
  36. package/lib/contracts/types/generated/GFarmTradingStorageV5.js +0 -2
  37. package/lib/contracts/types/generated/GNSBorrowingFees.d.ts +0 -1067
  38. package/lib/contracts/types/generated/GNSBorrowingFees.js +0 -2
  39. package/lib/contracts/types/generated/GNSNftRewardsV6.d.ts +0 -533
  40. package/lib/contracts/types/generated/GNSNftRewardsV6.js +0 -2
  41. package/lib/contracts/types/generated/GNSNftRewardsV6_3_1.d.ts +0 -613
  42. package/lib/contracts/types/generated/GNSNftRewardsV6_3_1.js +0 -2
  43. package/lib/contracts/types/generated/GNSTrading.d.ts +0 -758
  44. package/lib/contracts/types/generated/GNSTrading.js +0 -2
  45. package/lib/contracts/types/generated/GNSTradingCallbacks.d.ts +0 -875
  46. package/lib/contracts/types/generated/GNSTradingCallbacks.js +0 -2
  47. package/lib/contracts/types/generated/GNSTradingStorage.d.ts +0 -1387
  48. package/lib/contracts/types/generated/GNSTradingStorage.js +0 -2
  49. package/lib/contracts/types/generated/factories/GFarmTradingStorageV5__factory.d.ts +0 -83
  50. package/lib/contracts/types/generated/factories/GFarmTradingStorageV5__factory.js +0 -2691
  51. package/lib/contracts/types/generated/factories/GNSBorrowingFees__factory.d.ts +0 -124
  52. package/lib/contracts/types/generated/factories/GNSBorrowingFees__factory.js +0 -1784
  53. package/lib/contracts/types/generated/factories/GNSNftRewardsV6_3_1__factory.d.ts +0 -100
  54. package/lib/contracts/types/generated/factories/GNSNftRewardsV6_3_1__factory.js +0 -1116
  55. package/lib/contracts/types/generated/factories/GNSNftRewardsV6__factory.d.ts +0 -100
  56. package/lib/contracts/types/generated/factories/GNSNftRewardsV6__factory.js +0 -1003
  57. package/lib/contracts/types/generated/factories/GNSTradingCallbacks__factory.d.ts +0 -113
  58. package/lib/contracts/types/generated/factories/GNSTradingCallbacks__factory.js +0 -1428
  59. package/lib/contracts/types/generated/factories/GNSTradingStorage__factory.d.ts +0 -96
  60. package/lib/contracts/types/generated/factories/GNSTradingStorage__factory.js +0 -2241
  61. package/lib/contracts/types/generated/factories/GNSTrading__factory.d.ts +0 -95
  62. package/lib/contracts/types/generated/factories/GNSTrading__factory.js +0 -1071
  63. package/lib/contracts/utils/openLimitOrders.d.ts +0 -8
  64. package/lib/contracts/utils/openLimitOrders.js +0 -88
  65. package/lib/trade/openLimitOrder.d.ts +0 -2
  66. package/lib/trade/openLimitOrder.js +0 -23
@@ -1,10 +1,3 @@
1
- export { GFarmTradingStorageV5__factory } from "./GFarmTradingStorageV5__factory";
2
- export { GNSBorrowingFees__factory } from "./GNSBorrowingFees__factory";
3
1
  export { GNSMultiCollatDiamond__factory } from "./GNSMultiCollatDiamond__factory";
4
- export { GNSNftRewardsV6__factory } from "./GNSNftRewardsV6__factory";
5
- export { GNSNftRewardsV6_3_1__factory } from "./GNSNftRewardsV6_3_1__factory";
6
- export { GNSTrading__factory } from "./GNSTrading__factory";
7
- export { GNSTradingCallbacks__factory } from "./GNSTradingCallbacks__factory";
8
- export { GNSTradingStorage__factory } from "./GNSTradingStorage__factory";
9
2
  export { GToken__factory } from "./GToken__factory";
10
3
  export { GTokenOpenPnlFeed__factory } from "./GTokenOpenPnlFeed__factory";
@@ -1,25 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GTokenOpenPnlFeed__factory = exports.GToken__factory = exports.GNSTradingStorage__factory = exports.GNSTradingCallbacks__factory = exports.GNSTrading__factory = exports.GNSNftRewardsV6_3_1__factory = exports.GNSNftRewardsV6__factory = exports.GNSMultiCollatDiamond__factory = exports.GNSBorrowingFees__factory = exports.GFarmTradingStorageV5__factory = void 0;
3
+ exports.GTokenOpenPnlFeed__factory = exports.GToken__factory = exports.GNSMultiCollatDiamond__factory = void 0;
4
4
  /* Autogenerated file. Do not edit manually. */
5
5
  /* tslint:disable */
6
6
  /* eslint-disable */
7
- var GFarmTradingStorageV5__factory_1 = require("./GFarmTradingStorageV5__factory");
8
- Object.defineProperty(exports, "GFarmTradingStorageV5__factory", { enumerable: true, get: function () { return GFarmTradingStorageV5__factory_1.GFarmTradingStorageV5__factory; } });
9
- var GNSBorrowingFees__factory_1 = require("./GNSBorrowingFees__factory");
10
- Object.defineProperty(exports, "GNSBorrowingFees__factory", { enumerable: true, get: function () { return GNSBorrowingFees__factory_1.GNSBorrowingFees__factory; } });
11
7
  var GNSMultiCollatDiamond__factory_1 = require("./GNSMultiCollatDiamond__factory");
12
8
  Object.defineProperty(exports, "GNSMultiCollatDiamond__factory", { enumerable: true, get: function () { return GNSMultiCollatDiamond__factory_1.GNSMultiCollatDiamond__factory; } });
13
- var GNSNftRewardsV6__factory_1 = require("./GNSNftRewardsV6__factory");
14
- Object.defineProperty(exports, "GNSNftRewardsV6__factory", { enumerable: true, get: function () { return GNSNftRewardsV6__factory_1.GNSNftRewardsV6__factory; } });
15
- var GNSNftRewardsV6_3_1__factory_1 = require("./GNSNftRewardsV6_3_1__factory");
16
- Object.defineProperty(exports, "GNSNftRewardsV6_3_1__factory", { enumerable: true, get: function () { return GNSNftRewardsV6_3_1__factory_1.GNSNftRewardsV6_3_1__factory; } });
17
- var GNSTrading__factory_1 = require("./GNSTrading__factory");
18
- Object.defineProperty(exports, "GNSTrading__factory", { enumerable: true, get: function () { return GNSTrading__factory_1.GNSTrading__factory; } });
19
- var GNSTradingCallbacks__factory_1 = require("./GNSTradingCallbacks__factory");
20
- Object.defineProperty(exports, "GNSTradingCallbacks__factory", { enumerable: true, get: function () { return GNSTradingCallbacks__factory_1.GNSTradingCallbacks__factory; } });
21
- var GNSTradingStorage__factory_1 = require("./GNSTradingStorage__factory");
22
- Object.defineProperty(exports, "GNSTradingStorage__factory", { enumerable: true, get: function () { return GNSTradingStorage__factory_1.GNSTradingStorage__factory; } });
23
9
  var GToken__factory_1 = require("./GToken__factory");
24
10
  Object.defineProperty(exports, "GToken__factory", { enumerable: true, get: function () { return GToken__factory_1.GToken__factory; } });
25
11
  var GTokenOpenPnlFeed__factory_1 = require("./GTokenOpenPnlFeed__factory");
@@ -1,21 +1,7 @@
1
- export type { GFarmTradingStorageV5 } from "./GFarmTradingStorageV5";
2
- export type { GNSBorrowingFees } from "./GNSBorrowingFees";
3
1
  export type { GNSMultiCollatDiamond } from "./GNSMultiCollatDiamond";
4
- export type { GNSNftRewardsV6 } from "./GNSNftRewardsV6";
5
- export type { GNSNftRewardsV6_3_1 } from "./GNSNftRewardsV6_3_1";
6
- export type { GNSTrading } from "./GNSTrading";
7
- export type { GNSTradingCallbacks } from "./GNSTradingCallbacks";
8
- export type { GNSTradingStorage } from "./GNSTradingStorage";
9
2
  export type { GToken } from "./GToken";
10
3
  export type { GTokenOpenPnlFeed } from "./GTokenOpenPnlFeed";
11
4
  export * as factories from "./factories";
12
- export { GFarmTradingStorageV5__factory } from "./factories/GFarmTradingStorageV5__factory";
13
- export { GNSBorrowingFees__factory } from "./factories/GNSBorrowingFees__factory";
14
5
  export { GNSMultiCollatDiamond__factory } from "./factories/GNSMultiCollatDiamond__factory";
15
- export { GNSNftRewardsV6__factory } from "./factories/GNSNftRewardsV6__factory";
16
- export { GNSNftRewardsV6_3_1__factory } from "./factories/GNSNftRewardsV6_3_1__factory";
17
- export { GNSTrading__factory } from "./factories/GNSTrading__factory";
18
- export { GNSTradingCallbacks__factory } from "./factories/GNSTradingCallbacks__factory";
19
- export { GNSTradingStorage__factory } from "./factories/GNSTradingStorage__factory";
20
6
  export { GToken__factory } from "./factories/GToken__factory";
21
7
  export { GTokenOpenPnlFeed__factory } from "./factories/GTokenOpenPnlFeed__factory";
@@ -23,24 +23,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.GTokenOpenPnlFeed__factory = exports.GToken__factory = exports.GNSTradingStorage__factory = exports.GNSTradingCallbacks__factory = exports.GNSTrading__factory = exports.GNSNftRewardsV6_3_1__factory = exports.GNSNftRewardsV6__factory = exports.GNSMultiCollatDiamond__factory = exports.GNSBorrowingFees__factory = exports.GFarmTradingStorageV5__factory = exports.factories = void 0;
26
+ exports.GTokenOpenPnlFeed__factory = exports.GToken__factory = exports.GNSMultiCollatDiamond__factory = exports.factories = void 0;
27
27
  exports.factories = __importStar(require("./factories"));
28
- var GFarmTradingStorageV5__factory_1 = require("./factories/GFarmTradingStorageV5__factory");
29
- Object.defineProperty(exports, "GFarmTradingStorageV5__factory", { enumerable: true, get: function () { return GFarmTradingStorageV5__factory_1.GFarmTradingStorageV5__factory; } });
30
- var GNSBorrowingFees__factory_1 = require("./factories/GNSBorrowingFees__factory");
31
- Object.defineProperty(exports, "GNSBorrowingFees__factory", { enumerable: true, get: function () { return GNSBorrowingFees__factory_1.GNSBorrowingFees__factory; } });
32
28
  var GNSMultiCollatDiamond__factory_1 = require("./factories/GNSMultiCollatDiamond__factory");
33
29
  Object.defineProperty(exports, "GNSMultiCollatDiamond__factory", { enumerable: true, get: function () { return GNSMultiCollatDiamond__factory_1.GNSMultiCollatDiamond__factory; } });
34
- var GNSNftRewardsV6__factory_1 = require("./factories/GNSNftRewardsV6__factory");
35
- Object.defineProperty(exports, "GNSNftRewardsV6__factory", { enumerable: true, get: function () { return GNSNftRewardsV6__factory_1.GNSNftRewardsV6__factory; } });
36
- var GNSNftRewardsV6_3_1__factory_1 = require("./factories/GNSNftRewardsV6_3_1__factory");
37
- Object.defineProperty(exports, "GNSNftRewardsV6_3_1__factory", { enumerable: true, get: function () { return GNSNftRewardsV6_3_1__factory_1.GNSNftRewardsV6_3_1__factory; } });
38
- var GNSTrading__factory_1 = require("./factories/GNSTrading__factory");
39
- Object.defineProperty(exports, "GNSTrading__factory", { enumerable: true, get: function () { return GNSTrading__factory_1.GNSTrading__factory; } });
40
- var GNSTradingCallbacks__factory_1 = require("./factories/GNSTradingCallbacks__factory");
41
- Object.defineProperty(exports, "GNSTradingCallbacks__factory", { enumerable: true, get: function () { return GNSTradingCallbacks__factory_1.GNSTradingCallbacks__factory; } });
42
- var GNSTradingStorage__factory_1 = require("./factories/GNSTradingStorage__factory");
43
- Object.defineProperty(exports, "GNSTradingStorage__factory", { enumerable: true, get: function () { return GNSTradingStorage__factory_1.GNSTradingStorage__factory; } });
44
30
  var GToken__factory_1 = require("./factories/GToken__factory");
45
31
  Object.defineProperty(exports, "GToken__factory", { enumerable: true, get: function () { return GToken__factory_1.GToken__factory; } });
46
32
  var GTokenOpenPnlFeed__factory_1 = require("./factories/GTokenOpenPnlFeed__factory");
@@ -1,20 +1,12 @@
1
- import { GFarmTradingStorageV5, GTokenOpenPnlFeed, GNSNftRewardsV6_3_1, GNSBorrowingFees, GNSTradingCallbacks, GToken, GNSMultiCollatDiamond } from "./generated";
1
+ import { GTokenOpenPnlFeed, GToken, GNSMultiCollatDiamond } from "./generated";
2
2
  export type Contracts = {
3
- gfarmTradingStorageV5: GFarmTradingStorageV5;
3
+ gnsMultiCollatDiamond: GNSMultiCollatDiamond;
4
4
  gTokenOpenPnlFeed: GTokenOpenPnlFeed;
5
- gnsNftRewards: GNSNftRewardsV6_3_1;
6
- gnsBorrowingFees: GNSBorrowingFees;
7
- gnsTradingCallbacks: GNSTradingCallbacks;
8
5
  gToken: GToken;
9
- gnsMultiCollatDiamond: GNSMultiCollatDiamond;
10
6
  };
11
7
  export type ContractAddresses = {
12
- gfarmTradingStorageV5: string;
13
8
  gnsMultiCollatDiamond: string;
14
9
  gTokenOpenPnlFeed: string;
15
- gnsNftRewards: string;
16
- gnsBorrowingFees: string;
17
- gnsTradingCallbacks: string;
18
10
  gToken: string;
19
11
  };
20
12
  export type BlockTag = number | "latest" | "pending";
@@ -1,8 +1,8 @@
1
- import { GNSBorrowingFees } from "../types/generated";
1
+ import { GNSMultiCollatDiamond } from "../types/generated";
2
2
  import { BorrowingFee } from "../../trade";
3
- export declare const fetchAllPairBorrowingFees: (contract: GNSBorrowingFees) => Promise<BorrowingFee.Pair[]>;
4
- export declare const fetchGroupBorrowingFees: (contract: GNSBorrowingFees, groupIxs: number[]) => Promise<BorrowingFee.Group[]>;
5
- export declare const fetchAllPairAndGroupBorrowingFees: (contract: GNSBorrowingFees) => Promise<{
3
+ export declare const fetchAllPairBorrowingFees: (contract: GNSMultiCollatDiamond, collateralIndex: number) => Promise<BorrowingFee.Pair[]>;
4
+ export declare const fetchGroupBorrowingFees: (contract: GNSMultiCollatDiamond, collateralIndex: number, groupIxs: number[]) => Promise<BorrowingFee.Group[]>;
5
+ export declare const fetchAllPairAndGroupBorrowingFees: (contract: GNSMultiCollatDiamond, collateralIndex: number) => Promise<{
6
6
  pairs: BorrowingFee.Pair[];
7
7
  groups: BorrowingFee.Group[];
8
8
  }>;
@@ -11,18 +11,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.fetchAllPairAndGroupBorrowingFees = exports.fetchGroupBorrowingFees = exports.fetchAllPairBorrowingFees = void 0;
13
13
  const trade_1 = require("../../trade");
14
- const fetchAllPairBorrowingFees = (contract) => __awaiter(void 0, void 0, void 0, function* () { return (0, trade_1.convertPairBorrowingFees)(yield contract.getAllPairs()); });
14
+ const fetchAllPairBorrowingFees = (contract, collateralIndex) => __awaiter(void 0, void 0, void 0, function* () {
15
+ return (0, trade_1.convertPairBorrowingFees)(yield contract.getAllBorrowingPairs(collateralIndex));
16
+ });
15
17
  exports.fetchAllPairBorrowingFees = fetchAllPairBorrowingFees;
16
- const fetchGroupBorrowingFees = (contract, groupIxs) => __awaiter(void 0, void 0, void 0, function* () { return (0, trade_1.convertGroupBorrowingFees)(yield contract.getGroups(groupIxs)); });
18
+ const fetchGroupBorrowingFees = (contract, collateralIndex, groupIxs) => __awaiter(void 0, void 0, void 0, function* () {
19
+ return (0, trade_1.convertGroupBorrowingFees)(yield contract.getBorrowingGroups(collateralIndex, groupIxs));
20
+ });
17
21
  exports.fetchGroupBorrowingFees = fetchGroupBorrowingFees;
18
- const fetchAllPairAndGroupBorrowingFees = (contract) => __awaiter(void 0, void 0, void 0, function* () {
19
- const pairs = yield (0, exports.fetchAllPairBorrowingFees)(contract);
22
+ const fetchAllPairAndGroupBorrowingFees = (contract, collateralIndex) => __awaiter(void 0, void 0, void 0, function* () {
23
+ const pairs = yield (0, exports.fetchAllPairBorrowingFees)(contract, collateralIndex);
20
24
  const groupIxs = [
21
25
  ...new Set(pairs
22
26
  .map(value => value.groups.map(value => value.groupIndex))
23
27
  .reduce((acc, value) => acc.concat(value), [])),
24
28
  ].sort((a, b) => a - b);
25
- const groups = yield (0, exports.fetchGroupBorrowingFees)(contract, groupIxs);
29
+ const groups = yield (0, exports.fetchGroupBorrowingFees)(contract, collateralIndex, groupIxs);
26
30
  return { pairs, groups };
27
31
  });
28
32
  exports.fetchAllPairAndGroupBorrowingFees = fetchAllPairAndGroupBorrowingFees;
@@ -1,4 +1,3 @@
1
1
  export * from "./openTrades";
2
2
  export * from "./pairs";
3
- export * from "./openLimitOrders";
4
3
  export * from "./borrowingFees";
@@ -16,5 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./openTrades"), exports);
18
18
  __exportStar(require("./pairs"), exports);
19
- __exportStar(require("./openLimitOrders"), exports);
20
19
  __exportStar(require("./borrowingFees"), exports);
@@ -1,7 +1,7 @@
1
1
  import { TradeContainer, TradeContainerRaw } from "../../trade/types";
2
2
  import { Contracts, BlockTag } from "../../contracts/types";
3
3
  export type FetchOpenPairTradesOverrides = {
4
- pairBatchSize?: number;
4
+ batchSize?: number;
5
5
  useMulticall?: boolean;
6
6
  blockTag?: BlockTag;
7
7
  };