@aurigami/sdk 1.21.0 → 1.23.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.
- package/dist/consts/constants.d.ts +11 -1
- package/dist/helpers/aurigami-api.d.ts +1 -1
- package/dist/sdk.cjs.development.js +35 -23
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +35 -23
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/index.d.ts +11 -13
- package/package.json +2 -2
- package/src/SDK.ts +18 -24
- package/src/consts/constants.ts +13 -1
- package/src/consts/decimals.ts +2 -0
- package/src/helpers/aurigami-api.ts +2 -2
- package/src/helpers/helpers.ts +2 -2
- package/src/types/index.ts +11 -14
- package/src/a.ts.log +0 -29
|
@@ -54,6 +54,14 @@ export declare const networkAddresses: {
|
|
|
54
54
|
readonly name: "auNEARX";
|
|
55
55
|
readonly address: string;
|
|
56
56
|
readonly underlying: string;
|
|
57
|
+
}, {
|
|
58
|
+
readonly name: "auUSDCNative";
|
|
59
|
+
readonly address: string;
|
|
60
|
+
readonly underlying: string;
|
|
61
|
+
}, {
|
|
62
|
+
readonly name: "auUSDTNative";
|
|
63
|
+
readonly address: string;
|
|
64
|
+
readonly underlying: string;
|
|
57
65
|
}];
|
|
58
66
|
readonly misc: {
|
|
59
67
|
readonly COMPTROLLER: string;
|
|
@@ -90,6 +98,8 @@ export declare const networkAddresses: {
|
|
|
90
98
|
readonly AURORA_WNEAR: string;
|
|
91
99
|
readonly NEARX: string;
|
|
92
100
|
readonly STADER: string;
|
|
101
|
+
readonly USDC_NATIVE: string;
|
|
102
|
+
readonly USDT_NATIVE: string;
|
|
93
103
|
};
|
|
94
104
|
};
|
|
95
105
|
export declare const DEPOSIT_ONLY_TOKENS: string[];
|
|
@@ -126,4 +136,4 @@ export declare const SD_INCENTIVE_IN_SD = 83.35;
|
|
|
126
136
|
export declare const STADER_ETH: string;
|
|
127
137
|
export declare const USDT_ETH: string;
|
|
128
138
|
export declare const AURIGAMI_SUBGRAPH_URL = "https://api.thegraph.com/subgraphs/name/takao-aurigami/aurigami-feb-27";
|
|
129
|
-
export declare const GRAPHQL_URL = "https://explorer.
|
|
139
|
+
export declare const GRAPHQL_URL = "https://old.explorer.aurora.dev/api/v1/graphql";
|
|
@@ -10,4 +10,4 @@ export declare type PaginagedApiResponse<T> = {
|
|
|
10
10
|
items: T[];
|
|
11
11
|
meta: MetaApiResponse;
|
|
12
12
|
};
|
|
13
|
-
export declare function getPaginatedApi(url: string, params?: Record<string, any>, page?: number, pageSize?: number): Promise<PaginagedApiResponse<
|
|
13
|
+
export declare function getPaginatedApi<T = any>(url: string, params?: Record<string, any>, page?: number, pageSize?: number): Promise<PaginagedApiResponse<T>>;
|
|
@@ -108,6 +108,14 @@ var networkAddresses = {
|
|
|
108
108
|
name: 'auNEARX',
|
|
109
109
|
address: /*#__PURE__*/MAINNET_ADDRESSES.auTokens.NEARX.toLowerCase(),
|
|
110
110
|
underlying: /*#__PURE__*/'0xb39eeb9e168ef6c639f5e282fef1f6bc4dcae375'.toLowerCase()
|
|
111
|
+
}, {
|
|
112
|
+
name: 'auUSDCNative',
|
|
113
|
+
address: /*#__PURE__*/MAINNET_ADDRESSES.auTokens.USDC_NATIVE.toLowerCase(),
|
|
114
|
+
underlying: /*#__PURE__*/'0x368ebb46aca6b8d0787c96b2b20bd3cc3f2c45f7'.toLowerCase()
|
|
115
|
+
}, {
|
|
116
|
+
name: 'auUSDTNative',
|
|
117
|
+
address: /*#__PURE__*/MAINNET_ADDRESSES.auTokens.USDT_NATIVE.toLowerCase(),
|
|
118
|
+
underlying: /*#__PURE__*/'0x80da25da4d783e57d2fcda0436873a193a4beccf'.toLowerCase()
|
|
111
119
|
}],
|
|
112
120
|
misc: {
|
|
113
121
|
COMPTROLLER: /*#__PURE__*/MAINNET_ADDRESSES.comptroller.toLowerCase(),
|
|
@@ -143,7 +151,9 @@ var networkAddresses = {
|
|
|
143
151
|
WNEAR_TRI: /*#__PURE__*/'0x84b123875f0f36b966d0b6ca14b31121bd9676ad'.toLowerCase(),
|
|
144
152
|
AURORA_WNEAR: /*#__PURE__*/'0x1e0e812fbcd3eb75d8562ad6f310ed94d258d008'.toLowerCase(),
|
|
145
153
|
NEARX: /*#__PURE__*/'0xb39eeb9e168ef6c639f5e282fef1f6bc4dcae375'.toLowerCase(),
|
|
146
|
-
STADER: /*#__PURE__*/'0x078e103d5f9629ac48b8563fa2bfcd2f6d5fde84'.toLowerCase()
|
|
154
|
+
STADER: /*#__PURE__*/'0x078e103d5f9629ac48b8563fa2bfcd2f6d5fde84'.toLowerCase(),
|
|
155
|
+
USDC_NATIVE: /*#__PURE__*/'0x368ebb46aca6b8d0787c96b2b20bd3cc3f2c45f7'.toLowerCase(),
|
|
156
|
+
USDT_NATIVE: /*#__PURE__*/'0x80da25da4d783e57d2fcda0436873a193a4beccf'.toLowerCase()
|
|
147
157
|
}
|
|
148
158
|
};
|
|
149
159
|
var DEPOSIT_ONLY_TOKENS = [/*#__PURE__*/MAINNET_ADDRESSES.auTokens.AURORA.toLowerCase(), /*#__PURE__*/MAINNET_ADDRESSES.auTokens.TRI.toLowerCase(), /*#__PURE__*/MAINNET_ADDRESSES.auTokens.PLY.toLowerCase(), /*#__PURE__*/MAINNET_ADDRESSES.auTokens.USN.toLowerCase()];
|
|
@@ -212,7 +222,7 @@ var SD_INCENTIVE_IN_SD = 83.35;
|
|
|
212
222
|
var STADER_ETH = /*#__PURE__*/'0x30D20208d987713f46DFD34EF128Bb16C404D10f'.toLowerCase();
|
|
213
223
|
var USDT_ETH = /*#__PURE__*/'0xdAC17F958D2ee523a2206206994597C13D831ec7'.toLowerCase();
|
|
214
224
|
var AURIGAMI_SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/takao-aurigami/aurigami-feb-27';
|
|
215
|
-
var GRAPHQL_URL = 'https://explorer.
|
|
225
|
+
var GRAPHQL_URL = 'https://old.explorer.aurora.dev/api/v1/graphql';
|
|
216
226
|
|
|
217
227
|
var decimalRecords = {
|
|
218
228
|
'0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': 18,
|
|
@@ -241,7 +251,9 @@ var decimalRecords = {
|
|
|
241
251
|
'0x84b123875f0f36b966d0b6ca14b31121bd9676ad': 18,
|
|
242
252
|
'0x1e0e812fbcd3eb75d8562ad6f310ed94d258d008': 18,
|
|
243
253
|
'0xb39eeb9e168ef6c639f5e282fef1f6bc4dcae375': 24,
|
|
244
|
-
'0x078e103d5f9629ac48b8563fa2bfcd2f6d5fde84': 18
|
|
254
|
+
'0x078e103d5f9629ac48b8563fa2bfcd2f6d5fde84': 18,
|
|
255
|
+
'0x80da25da4d783e57d2fcda0436873a193a4beccf': 6,
|
|
256
|
+
'0x368ebb46aca6b8d0787c96b2b20bd3cc3f2c45f7': 6
|
|
245
257
|
};
|
|
246
258
|
|
|
247
259
|
function _regeneratorRuntime() {
|
|
@@ -937,7 +949,7 @@ function _getBlocksTimestamp() {
|
|
|
937
949
|
case 8:
|
|
938
950
|
results = _context5.sent.reduce(function (acc, cur) {
|
|
939
951
|
return _extends({}, acc, cur);
|
|
940
|
-
});
|
|
952
|
+
}, {});
|
|
941
953
|
missingBlocks = blockNumbers.filter(function (blockNumber) {
|
|
942
954
|
return !results["b" + blockNumber];
|
|
943
955
|
});
|
|
@@ -5706,10 +5718,6 @@ function _postApi() {
|
|
|
5706
5718
|
return _postApi.apply(this, arguments);
|
|
5707
5719
|
}
|
|
5708
5720
|
|
|
5709
|
-
function getLiquidationEventsQuery(address, limit) {
|
|
5710
|
-
return "{\n liquidationEvents(\n first: " + limit + ",\n where: {from: \"" + address.toLowerCase() + "\"}\n ) {\n amount\n auTokenSymbol\n blockTime\n from\n id\n underlyingRepayAmountUSD\n underlyingSymbol\n underlyingRepayAmount\n }\n }";
|
|
5711
|
-
}
|
|
5712
|
-
|
|
5713
5721
|
var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
5714
5722
|
_inheritsLoose(SdkRead, _BlockchainEntityRead);
|
|
5715
5723
|
function SdkRead(networkConnection) {
|
|
@@ -6053,38 +6061,42 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
6053
6061
|
}();
|
|
6054
6062
|
_proto.getLiquidationHistory = /*#__PURE__*/function () {
|
|
6055
6063
|
var _getLiquidationHistory = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(address) {
|
|
6056
|
-
var
|
|
6064
|
+
var liquidationHistoryResp, blocks, blocksTimestamp, liquidationEvents;
|
|
6057
6065
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
6058
6066
|
while (1) switch (_context16.prev = _context16.next) {
|
|
6059
6067
|
case 0:
|
|
6060
6068
|
_context16.next = 2;
|
|
6061
|
-
return
|
|
6069
|
+
return getPaginatedApi('/liquidate/history', {
|
|
6070
|
+
user: address
|
|
6071
|
+
});
|
|
6062
6072
|
case 2:
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6073
|
+
liquidationHistoryResp = _context16.sent;
|
|
6074
|
+
blocks = liquidationHistoryResp.items.map(function (event) {
|
|
6075
|
+
return event.blockNumber;
|
|
6076
|
+
});
|
|
6077
|
+
_context16.next = 6;
|
|
6078
|
+
return getBlocksTimestamp(this._networkConnection.provider, blocks);
|
|
6079
|
+
case 6:
|
|
6080
|
+
blocksTimestamp = _context16.sent;
|
|
6081
|
+
liquidationEvents = liquidationHistoryResp.items.map(function (event, idx) {
|
|
6069
6082
|
var underlyingAddress = networkAddresses.auTokens.find(function (auToken) {
|
|
6070
|
-
return auToken.
|
|
6083
|
+
return auToken.address.toLowerCase() === event.marketRepayToken.toLowerCase();
|
|
6071
6084
|
}).underlying;
|
|
6072
6085
|
var decimal = getDecimal(underlyingAddress);
|
|
6073
6086
|
var token = new Token(underlyingAddress, decimal);
|
|
6074
|
-
var tokenAmount = new TokenAmount(token, event.
|
|
6087
|
+
var tokenAmount = new TokenAmount(token, event.repayAmount.toString(), true);
|
|
6075
6088
|
return {
|
|
6076
|
-
liquidationTime:
|
|
6089
|
+
liquidationTime: blocksTimestamp[idx],
|
|
6077
6090
|
tokenAmount: tokenAmount,
|
|
6078
|
-
|
|
6079
|
-
transactionId: event.id.split('-')[0]
|
|
6091
|
+
transactionId: event.txnHash
|
|
6080
6092
|
};
|
|
6081
6093
|
});
|
|
6082
6094
|
return _context16.abrupt("return", liquidationEvents);
|
|
6083
|
-
case
|
|
6095
|
+
case 9:
|
|
6084
6096
|
case "end":
|
|
6085
6097
|
return _context16.stop();
|
|
6086
6098
|
}
|
|
6087
|
-
}, _callee16);
|
|
6099
|
+
}, _callee16, this);
|
|
6088
6100
|
}));
|
|
6089
6101
|
function getLiquidationHistory(_x21) {
|
|
6090
6102
|
return _getLiquidationHistory.apply(this, arguments);
|