@openocean.finance/openocean-sdk 0.1.58 → 0.1.59
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/lib/api/index.js +136 -0
- package/lib/api/vo/RequestVo.js +401 -0
- package/lib/asset/abi/aggregator.js +391 -0
- package/lib/config/Chains.js +508 -0
- package/lib/config/Wallets.d.ts +2 -1
- package/lib/config/Wallets.js +81 -0
- package/lib/config/index.js +11 -0
- package/lib/index.js +21 -2
- package/lib/swapSdk/Approve.js +216 -0
- package/lib/swapSdk/ConnectWallet.js +279 -0
- package/lib/swapSdk/NotoMobile.js +141 -0
- package/lib/swapSdk/RequestVo.js +94 -0
- package/lib/swapSdk/Swap.js +739 -0
- package/lib/swapSdk/getAllowance.js +97 -0
- package/lib/swapSdk/getBalance.js +220 -0
- package/lib/swapSdk/index.js +256 -0
- package/lib/swapSdk/qrcode.d.ts +11 -0
- package/lib/swapSdk/qrcode.js +989 -0
- package/lib/utils/ajx.js +150 -0
- package/lib/utils/index.js +91 -0
- package/lib/utils/web3.js +9 -0
- package/package.json +2 -2
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.ReqApproveVo = exports.ReqAllowanceVo = exports.ReqBalanceVo = exports.ReqConnectWalletVo = void 0;
|
|
25
|
+
var class_validator_1 = require("class-validator");
|
|
26
|
+
var class_transformer_1 = require("class-transformer");
|
|
27
|
+
var RequestVo_1 = require("../api/vo/RequestVo");
|
|
28
|
+
var ReqConnectWalletVo = /** @class */ (function (_super) {
|
|
29
|
+
__extends(ReqConnectWalletVo, _super);
|
|
30
|
+
function ReqConnectWalletVo() {
|
|
31
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
32
|
+
}
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, class_validator_1.IsNotEmpty)({ message: 'Wallet name cannot be empty' })
|
|
35
|
+
// @IsEnum(WalletNames, { message: 'Wallet name error' })
|
|
36
|
+
,
|
|
37
|
+
(0, class_transformer_1.Type)(function () { return String; })
|
|
38
|
+
], ReqConnectWalletVo.prototype, "walletName", void 0);
|
|
39
|
+
return ReqConnectWalletVo;
|
|
40
|
+
}(RequestVo_1.ChainName));
|
|
41
|
+
exports.ReqConnectWalletVo = ReqConnectWalletVo;
|
|
42
|
+
var ReqBalanceVo = /** @class */ (function (_super) {
|
|
43
|
+
__extends(ReqBalanceVo, _super);
|
|
44
|
+
function ReqBalanceVo() {
|
|
45
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
46
|
+
}
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, class_validator_1.IsNotEmpty)({ message: 'TokenAddressOrSymbol cannot be empty' }),
|
|
49
|
+
(0, class_transformer_1.Type)(function () { return String; })
|
|
50
|
+
], ReqBalanceVo.prototype, "tokenAddressOrSymbol", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, class_validator_1.IsNotEmpty)({ message: 'Decimals cannot be empty' }),
|
|
53
|
+
(0, class_transformer_1.Type)(function () { return Number; })
|
|
54
|
+
], ReqBalanceVo.prototype, "decimals", void 0);
|
|
55
|
+
return ReqBalanceVo;
|
|
56
|
+
}(RequestVo_1.ChainName));
|
|
57
|
+
exports.ReqBalanceVo = ReqBalanceVo;
|
|
58
|
+
var ReqAllowanceVo = /** @class */ (function (_super) {
|
|
59
|
+
__extends(ReqAllowanceVo, _super);
|
|
60
|
+
function ReqAllowanceVo() {
|
|
61
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
62
|
+
}
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, class_validator_1.IsNotEmpty)({ message: 'ApproveContract cannot be empty' })
|
|
65
|
+
], ReqAllowanceVo.prototype, "approveContract", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, class_validator_1.IsNotEmpty)({ message: 'TokenAddress cannot be empty' }),
|
|
68
|
+
(0, class_transformer_1.Type)(function () { return String; })
|
|
69
|
+
], ReqAllowanceVo.prototype, "tokenAddress", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, class_validator_1.IsNotEmpty)({ message: 'Decimals cannot be empty' }),
|
|
72
|
+
(0, class_transformer_1.Type)(function () { return Number; })
|
|
73
|
+
], ReqAllowanceVo.prototype, "decimals", void 0);
|
|
74
|
+
return ReqAllowanceVo;
|
|
75
|
+
}(RequestVo_1.ChainName));
|
|
76
|
+
exports.ReqAllowanceVo = ReqAllowanceVo;
|
|
77
|
+
var ReqApproveVo = /** @class */ (function (_super) {
|
|
78
|
+
__extends(ReqApproveVo, _super);
|
|
79
|
+
function ReqApproveVo() {
|
|
80
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
81
|
+
}
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, class_validator_1.IsNotEmpty)({ message: 'Token addresses cannot be empty' }),
|
|
84
|
+
(0, class_validator_1.MinLength)(30, { message: 'Token addresses length error' }),
|
|
85
|
+
(0, class_transformer_1.Type)(function () { return String; })
|
|
86
|
+
], ReqApproveVo.prototype, "tokenAddress", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, class_validator_1.IsNotEmpty)({ message: 'Contract addresses cannot be empty' }),
|
|
89
|
+
(0, class_validator_1.MinLength)(30, { message: 'Contract addresses length error' }),
|
|
90
|
+
(0, class_transformer_1.Type)(function () { return String; })
|
|
91
|
+
], ReqApproveVo.prototype, "contractAddress", void 0);
|
|
92
|
+
return ReqApproveVo;
|
|
93
|
+
}(RequestVo_1.ChainName));
|
|
94
|
+
exports.ReqApproveVo = ReqApproveVo;
|