@gainsnetwork/sdk 0.0.29-rc1 → 0.0.30-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 (33) hide show
  1. package/lib/contracts/addresses.json +3 -6
  2. package/lib/contracts/index.js +2 -3
  3. package/lib/contracts/types/generated/GNSBorrowingFeesV6_4.d.ts +1058 -0
  4. package/lib/contracts/types/generated/GNSTradingCallbacksV6_4.d.ts +821 -0
  5. package/lib/contracts/types/generated/GNSTradingCallbacksV6_4.js +2 -0
  6. package/lib/contracts/types/generated/factories/GNSBorrowingFeesV6_4__factory.d.ts +113 -0
  7. package/lib/contracts/types/generated/factories/GNSBorrowingFeesV6_4__factory.js +1742 -0
  8. package/lib/contracts/types/generated/factories/GNSTradingCallbacksV6_4__factory.d.ts +82 -0
  9. package/lib/contracts/types/generated/factories/GNSTradingCallbacksV6_4__factory.js +1326 -0
  10. package/lib/contracts/types/generated/factories/index.d.ts +2 -3
  11. package/lib/contracts/types/generated/factories/index.js +5 -7
  12. package/lib/contracts/types/generated/index.d.ts +4 -6
  13. package/lib/contracts/types/generated/index.js +5 -7
  14. package/lib/contracts/types/index.d.ts +3 -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/openLimitOrders.js +12 -1
  18. package/lib/contracts/utils/pairs.d.ts +1 -2
  19. package/lib/contracts/utils/pairs.js +8 -21
  20. package/lib/trade/fees/borrowing/index.d.ts +4 -11
  21. package/lib/trade/fees/borrowing/index.js +24 -35
  22. package/lib/trade/fees/borrowing/types.d.ts +3 -0
  23. package/lib/trade/openLimitOrder.js +2 -2
  24. package/lib/trade/types.d.ts +2 -0
  25. package/package.json +1 -1
  26. package/lib/contracts/types/generated/GTokenV6_3_2.d.ts +0 -1838
  27. package/lib/contracts/types/generated/factories/GTokenV6_3_2__factory.d.ts +0 -110
  28. package/lib/contracts/types/generated/factories/GTokenV6_3_2__factory.js +0 -2682
  29. package/lib/contracts/utils/borrowingFees.d.ts +0 -8
  30. package/lib/contracts/utils/borrowingFees.js +0 -28
  31. package/lib/trade/fees/borrowing/converter.d.ts +0 -7
  32. package/lib/trade/fees/borrowing/converter.js +0 -38
  33. /package/lib/contracts/types/generated/{GTokenV6_3_2.js → GNSBorrowingFeesV6_4.js} +0 -0
@@ -1,8 +0,0 @@
1
- import { GNSBorrowingFeesV6_3_2 } from "../types/generated";
2
- import { BorrowingFee } from "../../trade";
3
- export declare const fetchAllPairBorrowingFees: (contract: GNSBorrowingFeesV6_3_2) => Promise<BorrowingFee.Pair[]>;
4
- export declare const fetchGroupBorrowingFees: (contract: GNSBorrowingFeesV6_3_2, groupIxs: number[]) => Promise<BorrowingFee.Group[]>;
5
- export declare const fetchAllPairAndGroupBorrowingFees: (contract: GNSBorrowingFeesV6_3_2) => Promise<{
6
- pairs: BorrowingFee.Pair[];
7
- groups: BorrowingFee.Group[];
8
- }>;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.fetchAllPairAndGroupBorrowingFees = exports.fetchGroupBorrowingFees = exports.fetchAllPairBorrowingFees = void 0;
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()); });
15
- 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)); });
17
- exports.fetchGroupBorrowingFees = fetchGroupBorrowingFees;
18
- const fetchAllPairAndGroupBorrowingFees = (contract) => __awaiter(void 0, void 0, void 0, function* () {
19
- const pairs = yield (0, exports.fetchAllPairBorrowingFees)(contract);
20
- const groupIxs = [
21
- ...new Set(pairs
22
- .map(value => value.groups.map(value => value.groupIndex))
23
- .reduce((acc, value) => acc.concat(value), [])),
24
- ].sort((a, b) => a - b);
25
- const groups = yield (0, exports.fetchGroupBorrowingFees)(contract, groupIxs);
26
- return { pairs, groups };
27
- });
28
- exports.fetchAllPairAndGroupBorrowingFees = fetchAllPairAndGroupBorrowingFees;
@@ -1,7 +0,0 @@
1
- import { GNSBorrowingFeesInterfaceV6_3_2 } from "@/contracts/types/generated/GNSBorrowingFeesV6_3_2";
2
- import { BorrowingFee } from ".";
3
- export declare const convertPairGroupBorrowingFee: (pairGroup: GNSBorrowingFeesInterfaceV6_3_2.PairGroupStructOutput) => BorrowingFee.PairGroup;
4
- export declare const convertPairBorrowingFee: (pair: GNSBorrowingFeesInterfaceV6_3_2.PairStructOutput) => BorrowingFee.Pair;
5
- export declare const convertPairBorrowingFees: (pairs: GNSBorrowingFeesInterfaceV6_3_2.PairStructOutput[]) => BorrowingFee.Pair[];
6
- export declare const convertGroupBorrowingFee: (group: GNSBorrowingFeesInterfaceV6_3_2.GroupStructOutput) => BorrowingFee.Group;
7
- export declare const convertGroupBorrowingFees: (groups: GNSBorrowingFeesInterfaceV6_3_2.GroupStructOutput[]) => BorrowingFee.Group[];
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertGroupBorrowingFees = exports.convertGroupBorrowingFee = exports.convertPairBorrowingFees = exports.convertPairBorrowingFee = exports.convertPairGroupBorrowingFee = void 0;
4
- const convertPairGroupBorrowingFee = (pairGroup) => ({
5
- groupIndex: pairGroup.groupIndex,
6
- initialAccFeeLong: parseFloat(pairGroup.initialAccFeeLong.toString()) / 1e10,
7
- initialAccFeeShort: parseFloat(pairGroup.initialAccFeeShort.toString()) / 1e10,
8
- prevGroupAccFeeLong: parseFloat(pairGroup.prevGroupAccFeeLong.toString()) / 1e10,
9
- prevGroupAccFeeShort: parseFloat(pairGroup.prevGroupAccFeeShort.toString()) / 1e10,
10
- pairAccFeeLong: parseFloat(pairGroup.pairAccFeeLong.toString()) / 1e10,
11
- pairAccFeeShort: parseFloat(pairGroup.pairAccFeeShort.toString()) / 1e10,
12
- block: pairGroup.block,
13
- });
14
- exports.convertPairGroupBorrowingFee = convertPairGroupBorrowingFee;
15
- const convertPairBorrowingFee = (pair) => ({
16
- feePerBlock: pair.feePerBlock / 1e10,
17
- accFeeLong: parseFloat(pair.accFeeLong.toString()) / 1e10,
18
- accFeeShort: parseFloat(pair.accFeeShort.toString()) / 1e10,
19
- accLastUpdatedBlock: pair.accLastUpdatedBlock,
20
- lastAccBlockWeightedMarketCap: parseFloat(pair.lastAccBlockWeightedMarketCap.toString()) / 1e40,
21
- groups: pair.groups.map(value => (0, exports.convertPairGroupBorrowingFee)(value)),
22
- });
23
- exports.convertPairBorrowingFee = convertPairBorrowingFee;
24
- const convertPairBorrowingFees = (pairs) => pairs.map(value => (0, exports.convertPairBorrowingFee)(value));
25
- exports.convertPairBorrowingFees = convertPairBorrowingFees;
26
- const convertGroupBorrowingFee = (group) => ({
27
- oiLong: parseFloat(group.oiLong.toString()) / 1e10,
28
- oiShort: parseFloat(group.oiShort.toString()) / 1e10,
29
- feePerBlock: group.feePerBlock / 1e10,
30
- accFeeLong: parseFloat(group.accFeeLong.toString()) / 1e10,
31
- accFeeShort: parseFloat(group.accFeeShort.toString()) / 1e10,
32
- accLastUpdatedBlock: group.accLastUpdatedBlock,
33
- lastAccBlockWeightedMarketCap: parseFloat(group.lastAccBlockWeightedMarketCap.toString()) / 1e40,
34
- maxOi: parseFloat(group.maxOi.toString()) / 1e10,
35
- });
36
- exports.convertGroupBorrowingFee = convertGroupBorrowingFee;
37
- const convertGroupBorrowingFees = (groups) => groups.map(value => (0, exports.convertGroupBorrowingFee)(value));
38
- exports.convertGroupBorrowingFees = convertGroupBorrowingFees;