@across-protocol/sdk 4.3.114-beta.0 → 4.3.114
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/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +1 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -2
- package/src/index.ts +0 -1
- package/dist/cjs/pool/TransactionManager.d.ts +0 -12
- package/dist/cjs/pool/TransactionManager.js +0 -121
- package/dist/cjs/pool/TransactionManager.js.map +0 -1
- package/dist/cjs/pool/index.d.ts +0 -1
- package/dist/cjs/pool/index.js +0 -5
- package/dist/cjs/pool/index.js.map +0 -1
- package/dist/cjs/pool/poolClient.d.ts +0 -228
- package/dist/cjs/pool/poolClient.js +0 -869
- package/dist/cjs/pool/poolClient.js.map +0 -1
- package/dist/cjs/pool/uma/across/constants.d.ts +0 -2
- package/dist/cjs/pool/uma/across/constants.js +0 -6
- package/dist/cjs/pool/uma/across/constants.js.map +0 -1
- package/dist/cjs/pool/uma/across/index.d.ts +0 -2
- package/dist/cjs/pool/uma/across/index.js +0 -8
- package/dist/cjs/pool/uma/across/index.js.map +0 -1
- package/dist/cjs/pool/uma/across/transactionManager.d.ts +0 -12
- package/dist/cjs/pool/uma/across/transactionManager.js +0 -121
- package/dist/cjs/pool/uma/across/transactionManager.js.map +0 -1
- package/dist/cjs/pool/uma/clients/erc20/client.d.ts +0 -26
- package/dist/cjs/pool/uma/clients/erc20/client.js +0 -38
- package/dist/cjs/pool/uma/clients/erc20/client.js.map +0 -1
- package/dist/cjs/pool/uma/clients/erc20/index.d.ts +0 -1
- package/dist/cjs/pool/uma/clients/erc20/index.js +0 -5
- package/dist/cjs/pool/uma/clients/erc20/index.js.map +0 -1
- package/dist/cjs/pool/uma/clients/index.d.ts +0 -1
- package/dist/cjs/pool/uma/clients/index.js +0 -6
- package/dist/cjs/pool/uma/clients/index.js.map +0 -1
- package/dist/cjs/pool/uma/index.d.ts +0 -13
- package/dist/cjs/pool/uma/index.js +0 -9
- package/dist/cjs/pool/uma/index.js.map +0 -1
- package/dist/cjs/pool/uma/oracle/index.d.ts +0 -1
- package/dist/cjs/pool/uma/oracle/index.js +0 -6
- package/dist/cjs/pool/uma/oracle/index.js.map +0 -1
- package/dist/cjs/pool/uma/oracle/utils.d.ts +0 -7
- package/dist/cjs/pool/uma/oracle/utils.js +0 -20
- package/dist/cjs/pool/uma/oracle/utils.js.map +0 -1
- package/dist/cjs/pool/uma/utils.d.ts +0 -17
- package/dist/cjs/pool/uma/utils.js +0 -69
- package/dist/cjs/pool/uma/utils.js.map +0 -1
- package/dist/esm/pool/TransactionManager.d.ts +0 -12
- package/dist/esm/pool/TransactionManager.js +0 -122
- package/dist/esm/pool/TransactionManager.js.map +0 -1
- package/dist/esm/pool/index.d.ts +0 -1
- package/dist/esm/pool/index.js +0 -2
- package/dist/esm/pool/index.js.map +0 -1
- package/dist/esm/pool/poolClient.d.ts +0 -238
- package/dist/esm/pool/poolClient.js +0 -899
- package/dist/esm/pool/poolClient.js.map +0 -1
- package/dist/esm/pool/uma/across/constants.d.ts +0 -2
- package/dist/esm/pool/uma/across/constants.js +0 -3
- package/dist/esm/pool/uma/across/constants.js.map +0 -1
- package/dist/esm/pool/uma/across/index.d.ts +0 -2
- package/dist/esm/pool/uma/across/index.js +0 -4
- package/dist/esm/pool/uma/across/index.js.map +0 -1
- package/dist/esm/pool/uma/across/transactionManager.d.ts +0 -12
- package/dist/esm/pool/uma/across/transactionManager.js +0 -122
- package/dist/esm/pool/uma/across/transactionManager.js.map +0 -1
- package/dist/esm/pool/uma/clients/erc20/client.d.ts +0 -26
- package/dist/esm/pool/uma/clients/erc20/client.js +0 -35
- package/dist/esm/pool/uma/clients/erc20/client.js.map +0 -1
- package/dist/esm/pool/uma/clients/erc20/index.d.ts +0 -1
- package/dist/esm/pool/uma/clients/erc20/index.js +0 -2
- package/dist/esm/pool/uma/clients/erc20/index.js.map +0 -1
- package/dist/esm/pool/uma/clients/index.d.ts +0 -1
- package/dist/esm/pool/uma/clients/index.js +0 -3
- package/dist/esm/pool/uma/clients/index.js.map +0 -1
- package/dist/esm/pool/uma/index.d.ts +0 -13
- package/dist/esm/pool/uma/index.js +0 -9
- package/dist/esm/pool/uma/index.js.map +0 -1
- package/dist/esm/pool/uma/oracle/index.d.ts +0 -1
- package/dist/esm/pool/uma/oracle/index.js +0 -3
- package/dist/esm/pool/uma/oracle/index.js.map +0 -1
- package/dist/esm/pool/uma/oracle/utils.d.ts +0 -23
- package/dist/esm/pool/uma/oracle/utils.js +0 -33
- package/dist/esm/pool/uma/oracle/utils.js.map +0 -1
- package/dist/esm/pool/uma/utils.d.ts +0 -17
- package/dist/esm/pool/uma/utils.js +0 -68
- package/dist/esm/pool/uma/utils.js.map +0 -1
- package/dist/types/pool/TransactionManager.d.ts +0 -13
- package/dist/types/pool/TransactionManager.d.ts.map +0 -1
- package/dist/types/pool/index.d.ts +0 -2
- package/dist/types/pool/index.d.ts.map +0 -1
- package/dist/types/pool/poolClient.d.ts +0 -239
- package/dist/types/pool/poolClient.d.ts.map +0 -1
- package/dist/types/pool/uma/across/constants.d.ts +0 -3
- package/dist/types/pool/uma/across/constants.d.ts.map +0 -1
- package/dist/types/pool/uma/across/index.d.ts +0 -3
- package/dist/types/pool/uma/across/index.d.ts.map +0 -1
- package/dist/types/pool/uma/across/transactionManager.d.ts +0 -13
- package/dist/types/pool/uma/across/transactionManager.d.ts.map +0 -1
- package/dist/types/pool/uma/clients/erc20/client.d.ts +0 -27
- package/dist/types/pool/uma/clients/erc20/client.d.ts.map +0 -1
- package/dist/types/pool/uma/clients/erc20/index.d.ts +0 -2
- package/dist/types/pool/uma/clients/erc20/index.d.ts.map +0 -1
- package/dist/types/pool/uma/clients/index.d.ts +0 -2
- package/dist/types/pool/uma/clients/index.d.ts.map +0 -1
- package/dist/types/pool/uma/index.d.ts +0 -14
- package/dist/types/pool/uma/index.d.ts.map +0 -1
- package/dist/types/pool/uma/oracle/index.d.ts +0 -2
- package/dist/types/pool/uma/oracle/index.d.ts.map +0 -1
- package/dist/types/pool/uma/oracle/utils.d.ts +0 -24
- package/dist/types/pool/uma/oracle/utils.d.ts.map +0 -1
- package/dist/types/pool/uma/utils.d.ts +0 -18
- package/dist/types/pool/uma/utils.d.ts.map +0 -1
- package/src/pool/TransactionManager.ts +0 -73
- package/src/pool/index.ts +0 -1
- package/src/pool/poolClient.ts +0 -849
- package/src/pool/uma/across/constants.ts +0 -2
- package/src/pool/uma/across/index.ts +0 -2
- package/src/pool/uma/across/transactionManager.ts +0 -73
- package/src/pool/uma/clients/erc20/README.md +0 -29
- package/src/pool/uma/clients/erc20/client.e2e.ts +0 -26
- package/src/pool/uma/clients/erc20/client.ts +0 -67
- package/src/pool/uma/clients/erc20/index.ts +0 -1
- package/src/pool/uma/clients/index.ts +0 -1
- package/src/pool/uma/index.ts +0 -33
- package/src/pool/uma/oracle/index.ts +0 -2
- package/src/pool/uma/oracle/utils.ts +0 -38
- package/src/pool/uma/utils.test.ts +0 -24
- package/src/pool/uma/utils.ts +0 -53
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * as arch from "./arch";
|
|
2
2
|
export * as addressAggregator from "./addressAggregator";
|
|
3
3
|
export * as lpFeeCalculator from "./lpFeeCalculator";
|
|
4
|
-
export * as pool from "./pool";
|
|
5
4
|
export * as relayFeeCalculator from "./relayFeeCalculator";
|
|
6
5
|
export * as utils from "./utils";
|
|
7
6
|
export * as contracts from "./contracts";
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.providers = exports.caching = exports.typechain = exports.clients = exports.typeguards = exports.interfaces = exports.constants = exports.merkleDistributor = exports.priceClient = exports.gasPriceOracle = exports.coingecko = exports.contracts = exports.utils = exports.relayFeeCalculator = exports.
|
|
3
|
+
exports.providers = exports.caching = exports.typechain = exports.clients = exports.typeguards = exports.interfaces = exports.constants = exports.merkleDistributor = exports.priceClient = exports.gasPriceOracle = exports.coingecko = exports.contracts = exports.utils = exports.relayFeeCalculator = exports.lpFeeCalculator = exports.addressAggregator = exports.arch = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
exports.arch = tslib_1.__importStar(require("./arch"));
|
|
6
6
|
exports.addressAggregator = tslib_1.__importStar(require("./addressAggregator"));
|
|
7
7
|
exports.lpFeeCalculator = tslib_1.__importStar(require("./lpFeeCalculator"));
|
|
8
|
-
exports.pool = tslib_1.__importStar(require("./pool"));
|
|
9
8
|
exports.relayFeeCalculator = tslib_1.__importStar(require("./relayFeeCalculator"));
|
|
10
9
|
exports.utils = tslib_1.__importStar(require("./utils"));
|
|
11
10
|
exports.contracts = tslib_1.__importStar(require("./contracts"));
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,uDAA+B;AAC/B,iFAAyD;AACzD,6EAAqD;AACrD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,uDAA+B;AAC/B,iFAAyD;AACzD,6EAAqD;AACrD,mFAA2D;AAC3D,yDAAiC;AACjC,iEAAyC;AACzC,iEAAyC;AACzC,2EAAmD;AACnD,qEAA6C;AAC7C,iFAAyD;AACzD,iEAAyC;AACzC,mEAA2C;AAC3C,mEAA2C;AAC3C,6DAAqC;AACrC,iEAAyC;AACzC,6DAAqC;AACrC,iEAAyC"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * as arch from "./arch";
|
|
2
2
|
export * as addressAggregator from "./addressAggregator";
|
|
3
3
|
export * as lpFeeCalculator from "./lpFeeCalculator";
|
|
4
|
-
export * as pool from "./pool";
|
|
5
4
|
export * as relayFeeCalculator from "./relayFeeCalculator";
|
|
6
5
|
export * as utils from "./utils";
|
|
7
6
|
export * as contracts from "./contracts";
|
package/dist/esm/index.js
CHANGED
|
@@ -4,8 +4,6 @@ import * as addressAggregator_1 from "./addressAggregator";
|
|
|
4
4
|
export { addressAggregator_1 as addressAggregator };
|
|
5
5
|
import * as lpFeeCalculator_1 from "./lpFeeCalculator";
|
|
6
6
|
export { lpFeeCalculator_1 as lpFeeCalculator };
|
|
7
|
-
import * as pool_1 from "./pool";
|
|
8
|
-
export { pool_1 as pool };
|
|
9
7
|
import * as relayFeeCalculator_1 from "./relayFeeCalculator";
|
|
10
8
|
export { relayFeeCalculator_1 as relayFeeCalculator };
|
|
11
9
|
import * as utils_1 from "./utils";
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"wBAAsB,QAAQ;mBAAlB,IAAI;qCACmB,qBAAqB;gCAA5C,iBAAiB;mCACI,mBAAmB;8BAAxC,eAAe;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"wBAAsB,QAAQ;mBAAlB,IAAI;qCACmB,qBAAqB;gCAA5C,iBAAiB;mCACI,mBAAmB;8BAAxC,eAAe;sCACS,sBAAsB;iCAA9C,kBAAkB;yBACP,SAAS;oBAApB,KAAK;6BACU,aAAa;wBAA5B,SAAS;6BACM,aAAa;wBAA5B,SAAS;kCACW,kBAAkB;6BAAtC,cAAc;+BACG,eAAe;0BAAhC,WAAW;qCACY,qBAAqB;gCAA5C,iBAAiB;6BACF,aAAa;wBAA5B,SAAS;8BACO,cAAc;yBAA9B,UAAU;8BACM,cAAc;yBAA9B,UAAU;2BACG,WAAW;sBAAxB,OAAO;6BACQ,aAAa;wBAA5B,SAAS;2BACI,WAAW;sBAAxB,OAAO;6BACQ,aAAa;wBAA5B,SAAS"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * as arch from "./arch";
|
|
2
2
|
export * as addressAggregator from "./addressAggregator";
|
|
3
3
|
export * as lpFeeCalculator from "./lpFeeCalculator";
|
|
4
|
-
export * as pool from "./pool";
|
|
5
4
|
export * as relayFeeCalculator from "./relayFeeCalculator";
|
|
6
5
|
export * as utils from "./utils";
|
|
7
6
|
export * as contracts from "./contracts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,eAAe,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,eAAe,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,kBAAkB,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@across-protocol/sdk",
|
|
3
3
|
"author": "UMA Team",
|
|
4
|
-
"version": "4.3.114
|
|
4
|
+
"version": "4.3.114",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"homepage": "https://docs.across.to/reference/sdk",
|
|
7
7
|
"repository": {
|
|
@@ -119,7 +119,6 @@
|
|
|
119
119
|
"@solana-program/token-2022": "^0.4.0",
|
|
120
120
|
"@solana-program/compute-budget": "^0.8.0",
|
|
121
121
|
"@solana/kit": "^2.3.0",
|
|
122
|
-
"@uma/contracts-node": "^0.4.26",
|
|
123
122
|
"arweave": "^1.14.4",
|
|
124
123
|
"async": "^3.2.5",
|
|
125
124
|
"axios": "^0.27.2",
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * as arch from "./arch";
|
|
2
2
|
export * as addressAggregator from "./addressAggregator";
|
|
3
3
|
export * as lpFeeCalculator from "./lpFeeCalculator";
|
|
4
|
-
export * as pool from "./pool";
|
|
5
4
|
export * as relayFeeCalculator from "./relayFeeCalculator";
|
|
6
5
|
export * as utils from "./utils";
|
|
7
6
|
export * as contracts from "./contracts";
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Signer } from "ethers";
|
|
2
|
-
import { TransactionRequest, TransactionReceipt } from "@ethersproject/abstract-provider";
|
|
3
|
-
type Config = {
|
|
4
|
-
confirmations?: number;
|
|
5
|
-
};
|
|
6
|
-
export type Emit = (event: string, key: string, data: TransactionReceipt | string | TransactionRequest | Error) => void;
|
|
7
|
-
declare const _default: (config: Config, signer: Signer, emit?: Emit) => {
|
|
8
|
-
request: (unsignedTx: TransactionRequest) => string;
|
|
9
|
-
isMined: (key: string) => TransactionReceipt | undefined;
|
|
10
|
-
update: () => Promise<void>;
|
|
11
|
-
};
|
|
12
|
-
export default _default;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var tslib_1 = require("tslib");
|
|
4
|
-
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
5
|
-
function makeKey(tx) {
|
|
6
|
-
return JSON.stringify(Object.entries(tx).map(function (_a) {
|
|
7
|
-
var key = _a[0], value = _a[1];
|
|
8
|
-
return [key, (value || "").toString()];
|
|
9
|
-
}));
|
|
10
|
-
}
|
|
11
|
-
exports.default = (function (config, signer, emit) {
|
|
12
|
-
if (emit === void 0) { emit = function () { return null; }; }
|
|
13
|
-
(0, assert_1.default)(signer.provider, "signer requires a provider, use signer.connect(provider)");
|
|
14
|
-
var _a = config.confirmations, confirmations = _a === void 0 ? 3 : _a;
|
|
15
|
-
var requests = new Map();
|
|
16
|
-
var submissions = new Map();
|
|
17
|
-
var mined = new Map();
|
|
18
|
-
function request(unsignedTx) {
|
|
19
|
-
var populated = unsignedTx;
|
|
20
|
-
var key = makeKey(populated);
|
|
21
|
-
(0, assert_1.default)(!requests.has(key), "Transaction already in progress");
|
|
22
|
-
requests.set(key, populated);
|
|
23
|
-
return key;
|
|
24
|
-
}
|
|
25
|
-
function processRequest(key) {
|
|
26
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
27
|
-
var request, sent, err_1;
|
|
28
|
-
return tslib_1.__generator(this, function (_a) {
|
|
29
|
-
switch (_a.label) {
|
|
30
|
-
case 0:
|
|
31
|
-
request = requests.get(key);
|
|
32
|
-
(0, assert_1.default)(request, "invalid request");
|
|
33
|
-
requests.delete(key);
|
|
34
|
-
_a.label = 1;
|
|
35
|
-
case 1:
|
|
36
|
-
_a.trys.push([1, 3, , 4]);
|
|
37
|
-
return [4, signer.sendTransaction(request)];
|
|
38
|
-
case 2:
|
|
39
|
-
sent = _a.sent();
|
|
40
|
-
submissions.set(key, sent.hash);
|
|
41
|
-
emit("submitted", key, sent.hash);
|
|
42
|
-
return [3, 4];
|
|
43
|
-
case 3:
|
|
44
|
-
err_1 = _a.sent();
|
|
45
|
-
emit("error", key, err_1);
|
|
46
|
-
return [3, 4];
|
|
47
|
-
case 4: return [2];
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
function processSubmission(key) {
|
|
53
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
54
|
-
var hash, receipt;
|
|
55
|
-
return tslib_1.__generator(this, function (_a) {
|
|
56
|
-
switch (_a.label) {
|
|
57
|
-
case 0:
|
|
58
|
-
hash = submissions.get(key);
|
|
59
|
-
(0, assert_1.default)(hash, "invalid submission");
|
|
60
|
-
(0, assert_1.default)(signer.provider, "signer requires a provider, use signer.connect(provider)");
|
|
61
|
-
return [4, signer.provider.getTransactionReceipt(hash).catch(function () { return undefined; })];
|
|
62
|
-
case 1:
|
|
63
|
-
receipt = _a.sent();
|
|
64
|
-
if (receipt == null)
|
|
65
|
-
return [2];
|
|
66
|
-
if (receipt.confirmations < confirmations)
|
|
67
|
-
return [2];
|
|
68
|
-
submissions.delete(key);
|
|
69
|
-
mined.set(key, receipt);
|
|
70
|
-
emit("mined", key, receipt);
|
|
71
|
-
return [2];
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
function isMined(key) {
|
|
77
|
-
return mined.get(key);
|
|
78
|
-
}
|
|
79
|
-
function update() {
|
|
80
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
81
|
-
var _i, _a, key, _b, _c, key;
|
|
82
|
-
return tslib_1.__generator(this, function (_d) {
|
|
83
|
-
switch (_d.label) {
|
|
84
|
-
case 0:
|
|
85
|
-
_i = 0, _a = Object.keys(requests);
|
|
86
|
-
_d.label = 1;
|
|
87
|
-
case 1:
|
|
88
|
-
if (!(_i < _a.length)) return [3, 4];
|
|
89
|
-
key = _a[_i];
|
|
90
|
-
return [4, processRequest(key)];
|
|
91
|
-
case 2:
|
|
92
|
-
_d.sent();
|
|
93
|
-
_d.label = 3;
|
|
94
|
-
case 3:
|
|
95
|
-
_i++;
|
|
96
|
-
return [3, 1];
|
|
97
|
-
case 4:
|
|
98
|
-
_b = 0, _c = Object.keys(submissions);
|
|
99
|
-
_d.label = 5;
|
|
100
|
-
case 5:
|
|
101
|
-
if (!(_b < _c.length)) return [3, 8];
|
|
102
|
-
key = _c[_b];
|
|
103
|
-
return [4, processSubmission(key)];
|
|
104
|
-
case 6:
|
|
105
|
-
_d.sent();
|
|
106
|
-
_d.label = 7;
|
|
107
|
-
case 7:
|
|
108
|
-
_b++;
|
|
109
|
-
return [3, 5];
|
|
110
|
-
case 8: return [2];
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
return {
|
|
116
|
-
request: request,
|
|
117
|
-
isMined: isMined,
|
|
118
|
-
update: update,
|
|
119
|
-
};
|
|
120
|
-
});
|
|
121
|
-
//# sourceMappingURL=TransactionManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionManager.js","sourceRoot":"","sources":["../../../src/pool/TransactionManager.ts"],"names":[],"mappings":";;;AAAA,0DAA4B;AAI5B,SAAS,OAAO,CAAC,EAAsB;IACrC,OAAO,IAAI,CAAC,SAAS,CACnB,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,UAAC,EAAY;YAAX,GAAG,QAAA,EAAE,KAAK,QAAA;QACjC,OAAO,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IACzC,CAAC,CAAC,CAC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SAAA;QACP,OAAO,SAAA;QACP,MAAM,QAAA;KACP,CAAC;AACJ,CAAC,EAAC"}
|
package/dist/cjs/pool/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./poolClient";
|
package/dist/cjs/pool/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/pool/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B"}
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import * as uma from "./uma";
|
|
2
|
-
import { BigNumber, BigNumberish } from "../utils";
|
|
3
|
-
import { Signer } from "ethers";
|
|
4
|
-
import type { Overrides } from "@ethersproject/contracts";
|
|
5
|
-
import { TransactionRequest, TransactionReceipt, Log } from "@ethersproject/abstract-provider";
|
|
6
|
-
import { Provider, Block } from "@ethersproject/providers";
|
|
7
|
-
import { hubPool } from "../contracts";
|
|
8
|
-
import { AcceleratingDistributor, MerkleDistributor } from "../typechain";
|
|
9
|
-
export type { Provider };
|
|
10
|
-
export type Awaited<T> = T extends PromiseLike<infer U> ? U : T;
|
|
11
|
-
export type Config = {
|
|
12
|
-
chainId?: number;
|
|
13
|
-
hubPoolAddress: string;
|
|
14
|
-
acceleratingDistributorAddress: string;
|
|
15
|
-
merkleDistributorAddress: string;
|
|
16
|
-
wethAddress: string;
|
|
17
|
-
configStoreAddress: string;
|
|
18
|
-
confirmations?: number;
|
|
19
|
-
blockDelta?: number;
|
|
20
|
-
hasArchive?: boolean;
|
|
21
|
-
hubPoolStartBlock?: number;
|
|
22
|
-
};
|
|
23
|
-
export type Dependencies = {
|
|
24
|
-
provider: Provider;
|
|
25
|
-
};
|
|
26
|
-
export type StakeData = {
|
|
27
|
-
cumulativeBalance: BigNumber;
|
|
28
|
-
amountAirdropped: BigNumber;
|
|
29
|
-
};
|
|
30
|
-
export type Pool = {
|
|
31
|
-
address: string;
|
|
32
|
-
totalPoolSize: string;
|
|
33
|
-
l1Token: string;
|
|
34
|
-
lpToken: string;
|
|
35
|
-
liquidReserves: string;
|
|
36
|
-
exchangeRateCurrent: string;
|
|
37
|
-
exchangeRatePrevious: string;
|
|
38
|
-
estimatedApy: string;
|
|
39
|
-
estimatedApr: string;
|
|
40
|
-
blocksElapsed: number;
|
|
41
|
-
secondsElapsed: number;
|
|
42
|
-
utilizedReserves: string;
|
|
43
|
-
projectedApr: string;
|
|
44
|
-
liquidityUtilizationCurrent: string;
|
|
45
|
-
};
|
|
46
|
-
export type User = {
|
|
47
|
-
address: string;
|
|
48
|
-
poolAddress: string;
|
|
49
|
-
lpTokens: string;
|
|
50
|
-
positionValue: string;
|
|
51
|
-
totalDeposited: string;
|
|
52
|
-
feesEarned: string;
|
|
53
|
-
};
|
|
54
|
-
export type Transaction = {
|
|
55
|
-
id: string;
|
|
56
|
-
state: "requested" | "submitted" | "mined" | "error";
|
|
57
|
-
toAddress: string;
|
|
58
|
-
fromAddress: string;
|
|
59
|
-
type: "Add Liquidity" | "Remove Liquidity";
|
|
60
|
-
description: string;
|
|
61
|
-
request?: TransactionRequest;
|
|
62
|
-
hash?: string;
|
|
63
|
-
receipt?: TransactionReceipt;
|
|
64
|
-
error?: Error;
|
|
65
|
-
};
|
|
66
|
-
export type Token = {
|
|
67
|
-
decimals: string;
|
|
68
|
-
symbol: string;
|
|
69
|
-
name: string;
|
|
70
|
-
};
|
|
71
|
-
export type State = {
|
|
72
|
-
pools: Record<string, Pool>;
|
|
73
|
-
users: Record<string, Record<string, User>>;
|
|
74
|
-
transactions: Record<string, Transaction>;
|
|
75
|
-
error?: Error;
|
|
76
|
-
};
|
|
77
|
-
export type EmitState = (path: string[], data: Pool | User | Transaction | Error) => void;
|
|
78
|
-
export type PooledToken = {
|
|
79
|
-
lpToken: string;
|
|
80
|
-
isEnabled: boolean;
|
|
81
|
-
lastLpFeeUpdate: number;
|
|
82
|
-
utilizedReserves: BigNumber;
|
|
83
|
-
liquidReserves: BigNumber;
|
|
84
|
-
undistributedLpFees: BigNumber;
|
|
85
|
-
};
|
|
86
|
-
type EventIdParams = {
|
|
87
|
-
blockNumber: number;
|
|
88
|
-
transactionIndex: number;
|
|
89
|
-
logIndex: number;
|
|
90
|
-
};
|
|
91
|
-
export declare class PoolEventState {
|
|
92
|
-
private contract;
|
|
93
|
-
private startBlock;
|
|
94
|
-
private seen;
|
|
95
|
-
private iface;
|
|
96
|
-
private events;
|
|
97
|
-
constructor(contract: hubPool.Instance, startBlock?: number);
|
|
98
|
-
private makeId;
|
|
99
|
-
hasEvent(params: EventIdParams): boolean;
|
|
100
|
-
private addEvent;
|
|
101
|
-
private filterSeen;
|
|
102
|
-
private processEvent;
|
|
103
|
-
private processEvents;
|
|
104
|
-
read(endBlock: number, l1TokenAddress?: string, userAddress?: string): Promise<hubPool.EventState>;
|
|
105
|
-
makeEventFromLog: (log: Log) => uma.SerializableEvent;
|
|
106
|
-
getL1TokenFromReceipt(receipt: TransactionReceipt): string;
|
|
107
|
-
readTxReceipt(receipt: TransactionReceipt): hubPool.EventState;
|
|
108
|
-
}
|
|
109
|
-
declare class UserState {
|
|
110
|
-
private contract;
|
|
111
|
-
private userAddress;
|
|
112
|
-
private startBlock;
|
|
113
|
-
private acceleratingDistributorContractAddress;
|
|
114
|
-
private seen;
|
|
115
|
-
private events;
|
|
116
|
-
constructor(contract: uma.clients.erc20.Instance, userAddress: string, startBlock?: number, acceleratingDistributorContractAddress?: string);
|
|
117
|
-
private makeId;
|
|
118
|
-
hasEvent(params: EventIdParams): boolean;
|
|
119
|
-
private addEvent;
|
|
120
|
-
private filterSeen;
|
|
121
|
-
readEvents(endBlock: number): Promise<uma.clients.erc20.Transfer[]>;
|
|
122
|
-
read(endBlock: number): Promise<{
|
|
123
|
-
transferEvents: import("@uma/contracts-node").TypedEventEthers<any>[];
|
|
124
|
-
balanceTransferred: string;
|
|
125
|
-
address: string;
|
|
126
|
-
balanceOf: BigNumber;
|
|
127
|
-
}>;
|
|
128
|
-
}
|
|
129
|
-
export declare function calculateRemoval(amountWei: BigNumber, percentWei: BigNumber): {
|
|
130
|
-
receive: string;
|
|
131
|
-
remain: string;
|
|
132
|
-
};
|
|
133
|
-
export declare function previewRemoval(values: {
|
|
134
|
-
positionValue: BigNumberish;
|
|
135
|
-
feesEarned: BigNumberish;
|
|
136
|
-
totalDeposited: BigNumberish;
|
|
137
|
-
}, percentFloat: number): {
|
|
138
|
-
position: {
|
|
139
|
-
receive: string;
|
|
140
|
-
remain: string;
|
|
141
|
-
};
|
|
142
|
-
fees: {
|
|
143
|
-
receive: string;
|
|
144
|
-
remain: string;
|
|
145
|
-
};
|
|
146
|
-
total: {
|
|
147
|
-
receive: string;
|
|
148
|
-
remain: string;
|
|
149
|
-
};
|
|
150
|
-
};
|
|
151
|
-
export declare class ReadPoolClient {
|
|
152
|
-
private address;
|
|
153
|
-
private provider;
|
|
154
|
-
private poolState;
|
|
155
|
-
private contract;
|
|
156
|
-
constructor(address: string, provider: Provider);
|
|
157
|
-
read(tokenAddress: string, latestBlock: number): Promise<{
|
|
158
|
-
lpToken: string;
|
|
159
|
-
isEnabled: boolean;
|
|
160
|
-
lastLpFeeUpdate: number;
|
|
161
|
-
utilizedReserves: BigNumber;
|
|
162
|
-
liquidReserves: BigNumber;
|
|
163
|
-
undistributedLpFees: BigNumber;
|
|
164
|
-
address: string;
|
|
165
|
-
l1Token: string;
|
|
166
|
-
latestBlock: number;
|
|
167
|
-
previousBlock: number | undefined;
|
|
168
|
-
exchangeRatePrevious: BigNumber;
|
|
169
|
-
exchangeRateCurrent: BigNumber;
|
|
170
|
-
liquidityUtilizationCurrent: BigNumber;
|
|
171
|
-
}>;
|
|
172
|
-
}
|
|
173
|
-
export declare function validateWithdraw(pool: Pool, user: User, lpTokenAmount: BigNumberish): {
|
|
174
|
-
lpTokenAmount: BigNumberish;
|
|
175
|
-
l1TokensToReturn: string;
|
|
176
|
-
};
|
|
177
|
-
export declare class Client {
|
|
178
|
-
readonly config: Config;
|
|
179
|
-
readonly deps: Dependencies;
|
|
180
|
-
private emit;
|
|
181
|
-
private transactionManagers;
|
|
182
|
-
private hubPool;
|
|
183
|
-
private acceleratingDistributor;
|
|
184
|
-
private merkleDistributor;
|
|
185
|
-
readonly state: State;
|
|
186
|
-
private poolEvents;
|
|
187
|
-
private erc20s;
|
|
188
|
-
private intervalStarted;
|
|
189
|
-
private configStoreClient;
|
|
190
|
-
private exchangeRateTable;
|
|
191
|
-
private userServices;
|
|
192
|
-
constructor(config: Config, deps: Dependencies, emit: EmitState);
|
|
193
|
-
getOrCreateErc20Contract(address: string): uma.clients.erc20.Instance;
|
|
194
|
-
getOrCreatePoolContract(): hubPool.Instance;
|
|
195
|
-
createHubPoolContract(signerOrProvider: Signer | Provider): hubPool.Instance;
|
|
196
|
-
private getOrCreatePoolEvents;
|
|
197
|
-
createAcceleratingDistributorContract(signerOrProvider: Signer | Provider): AcceleratingDistributor;
|
|
198
|
-
createMerkleDistributorContract(signerOrProvider: Signer | Provider): MerkleDistributor;
|
|
199
|
-
getOrCreateAcceleratingDistributorContract(): AcceleratingDistributor;
|
|
200
|
-
getOrCreateMerkleDistributorContract(): MerkleDistributor;
|
|
201
|
-
private getOrCreateUserService;
|
|
202
|
-
private updateExchangeRateTable;
|
|
203
|
-
resolveStakingData(lpToken: string, l1TokenAddress: string, userState: Awaited<ReturnType<UserState["read"]>>): Promise<StakeData>;
|
|
204
|
-
calculateLpTransferValue(l1TokenAddress: string, userState: Awaited<ReturnType<UserState["read"]>>): Promise<BigNumber>;
|
|
205
|
-
private getOrCreateTransactionManager;
|
|
206
|
-
addEthLiquidity(signer: Signer, l1TokenAmount: BigNumberish, overrides?: Overrides): Promise<string>;
|
|
207
|
-
addTokenLiquidity(signer: Signer, l1Token: string, l1TokenAmount: BigNumberish, overrides?: Overrides): Promise<string>;
|
|
208
|
-
validateWithdraw(l1Token: string, userAddress: string, lpAmount: BigNumberish): Promise<{
|
|
209
|
-
lpTokenAmount: BigNumberish;
|
|
210
|
-
l1TokensToReturn: string;
|
|
211
|
-
}>;
|
|
212
|
-
removeTokenLiquidity(signer: Signer, l1Token: string, lpTokenAmount: BigNumberish, overrides?: Overrides): Promise<string>;
|
|
213
|
-
removeEthliquidity(signer: Signer, lpTokenAmount: BigNumberish, overrides?: Overrides): Promise<string>;
|
|
214
|
-
getPoolState(l1TokenAddress: string): Pool;
|
|
215
|
-
hasPoolState(l1TokenAddress: string): boolean;
|
|
216
|
-
setUserState(l1TokenAddress: string, userAddress: string, state: User): User;
|
|
217
|
-
getUserState(l1TokenAddress: string, userAddress: string): User;
|
|
218
|
-
hasUserState(l1TokenAddress: string, userAddress: string): boolean;
|
|
219
|
-
hasTxState(id: string): boolean;
|
|
220
|
-
getTxState(id: string): Transaction;
|
|
221
|
-
private updateAndEmitUser;
|
|
222
|
-
private updateUserWithTransaction;
|
|
223
|
-
updateUser(userAddress: string, l1TokenAddress: string): Promise<void>;
|
|
224
|
-
updatePool(l1TokenAddress: string, overrideLatestBlock?: Block): Promise<void>;
|
|
225
|
-
updateTransactions(): Promise<void>;
|
|
226
|
-
startInterval(delayMs?: number): void;
|
|
227
|
-
stopInterval(): void;
|
|
228
|
-
}
|