@openocean.finance/openocean-sdk 1.0.0 → 1.0.2

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.
@@ -94,8 +94,6 @@ PERFORMANCE OF THIS SOFTWARE.
94
94
 
95
95
  /*! @ont-community/window-post-message-proxy v0.2.14 | (c) 2016 Microsoft Corporation MIT */
96
96
 
97
- /*! MIT License. Copyright 2015-2018 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */
98
-
99
97
  /*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */
100
98
 
101
99
  /*! https://mths.be/punycode v1.3.2 by @mathias */
@@ -118,6 +116,115 @@ PERFORMANCE OF THIS SOFTWARE.
118
116
 
119
117
  /*! websocket-as-promised v0.7.0 */
120
118
 
119
+ /**
120
+ * Support for translating between Uint8Array instances and JavaScript
121
+ * native types.
122
+ *
123
+ * {@link module:Layout~Layout|Layout} is the basis of a class
124
+ * hierarchy that associates property names with sequences of encoded
125
+ * bytes.
126
+ *
127
+ * Layouts are supported for these scalar (numeric) types:
128
+ * * {@link module:Layout~UInt|Unsigned integers in little-endian
129
+ * format} with {@link module:Layout.u8|8-bit}, {@link
130
+ * module:Layout.u16|16-bit}, {@link module:Layout.u24|24-bit},
131
+ * {@link module:Layout.u32|32-bit}, {@link
132
+ * module:Layout.u40|40-bit}, and {@link module:Layout.u48|48-bit}
133
+ * representation ranges;
134
+ * * {@link module:Layout~UIntBE|Unsigned integers in big-endian
135
+ * format} with {@link module:Layout.u16be|16-bit}, {@link
136
+ * module:Layout.u24be|24-bit}, {@link module:Layout.u32be|32-bit},
137
+ * {@link module:Layout.u40be|40-bit}, and {@link
138
+ * module:Layout.u48be|48-bit} representation ranges;
139
+ * * {@link module:Layout~Int|Signed integers in little-endian
140
+ * format} with {@link module:Layout.s8|8-bit}, {@link
141
+ * module:Layout.s16|16-bit}, {@link module:Layout.s24|24-bit},
142
+ * {@link module:Layout.s32|32-bit}, {@link
143
+ * module:Layout.s40|40-bit}, and {@link module:Layout.s48|48-bit}
144
+ * representation ranges;
145
+ * * {@link module:Layout~IntBE|Signed integers in big-endian format}
146
+ * with {@link module:Layout.s16be|16-bit}, {@link
147
+ * module:Layout.s24be|24-bit}, {@link module:Layout.s32be|32-bit},
148
+ * {@link module:Layout.s40be|40-bit}, and {@link
149
+ * module:Layout.s48be|48-bit} representation ranges;
150
+ * * 64-bit integral values that decode to an exact (if magnitude is
151
+ * less than 2^53) or nearby integral Number in {@link
152
+ * module:Layout.nu64|unsigned little-endian}, {@link
153
+ * module:Layout.nu64be|unsigned big-endian}, {@link
154
+ * module:Layout.ns64|signed little-endian}, and {@link
155
+ * module:Layout.ns64be|unsigned big-endian} encodings;
156
+ * * 32-bit floating point values with {@link
157
+ * module:Layout.f32|little-endian} and {@link
158
+ * module:Layout.f32be|big-endian} representations;
159
+ * * 64-bit floating point values with {@link
160
+ * module:Layout.f64|little-endian} and {@link
161
+ * module:Layout.f64be|big-endian} representations;
162
+ * * {@link module:Layout.const|Constants} that take no space in the
163
+ * encoded expression.
164
+ *
165
+ * and for these aggregate types:
166
+ * * {@link module:Layout.seq|Sequence}s of instances of a {@link
167
+ * module:Layout~Layout|Layout}, with JavaScript representation as
168
+ * an Array and constant or data-dependent {@link
169
+ * module:Layout~Sequence#count|length};
170
+ * * {@link module:Layout.struct|Structure}s that aggregate a
171
+ * heterogeneous sequence of {@link module:Layout~Layout|Layout}
172
+ * instances, with JavaScript representation as an Object;
173
+ * * {@link module:Layout.union|Union}s that support multiple {@link
174
+ * module:Layout~VariantLayout|variant layouts} over a fixed
175
+ * (padded) or variable (not padded) span of bytes, using an
176
+ * unsigned integer at the start of the data or a separate {@link
177
+ * module:Layout.unionLayoutDiscriminator|layout element} to
178
+ * determine which layout to use when interpreting the buffer
179
+ * contents;
180
+ * * {@link module:Layout.bits|BitStructure}s that contain a sequence
181
+ * of individual {@link
182
+ * module:Layout~BitStructure#addField|BitField}s packed into an 8,
183
+ * 16, 24, or 32-bit unsigned integer starting at the least- or
184
+ * most-significant bit;
185
+ * * {@link module:Layout.cstr|C strings} of varying length;
186
+ * * {@link module:Layout.blob|Blobs} of fixed- or variable-{@link
187
+ * module:Layout~Blob#length|length} raw data.
188
+ *
189
+ * All {@link module:Layout~Layout|Layout} instances are immutable
190
+ * after construction, to prevent internal state from becoming
191
+ * inconsistent.
192
+ *
193
+ * @local Layout
194
+ * @local ExternalLayout
195
+ * @local GreedyCount
196
+ * @local OffsetLayout
197
+ * @local UInt
198
+ * @local UIntBE
199
+ * @local Int
200
+ * @local IntBE
201
+ * @local NearUInt64
202
+ * @local NearUInt64BE
203
+ * @local NearInt64
204
+ * @local NearInt64BE
205
+ * @local Float
206
+ * @local FloatBE
207
+ * @local Double
208
+ * @local DoubleBE
209
+ * @local Sequence
210
+ * @local Structure
211
+ * @local UnionDiscriminator
212
+ * @local UnionLayoutDiscriminator
213
+ * @local Union
214
+ * @local VariantLayout
215
+ * @local BitStructure
216
+ * @local BitField
217
+ * @local Boolean
218
+ * @local Blob
219
+ * @local CString
220
+ * @local Constant
221
+ * @local bindConstructorLayout
222
+ * @module Layout
223
+ * @license MIT
224
+ * @author Peter A. Bigot
225
+ * @see {@link https://github.com/pabigot/buffer-layout|buffer-layout on GitHub}
226
+ */
227
+
121
228
  /**
122
229
  * [js-sha256]{@link https://github.com/emn178/js-sha256}
123
230
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openocean.finance/openocean-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Openocean sdk",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -48,7 +48,7 @@
48
48
  "@ethersproject/bignumber": "^5.1.1",
49
49
  "@jup-ag/core": "^1.0.0-beta.27",
50
50
  "@looksrare/sdk": "^0.12.1",
51
- "@openocean.finance/wallet": "^1.0.0",
51
+ "@openocean.finance/wallet": "^1.0.2",
52
52
  "@solana/buffer-layout": "^4.0.0",
53
53
  "@walletconnect/web3-provider": "^1.7.8",
54
54
  "aptos": "^1.3.17",
package/lib/api/index.js DELETED
@@ -1,139 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- 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;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.Api = void 0;
10
- var ajx_1 = require("../utils/ajx");
11
- var config_1 = require("../config");
12
- var RequestVo_1 = require("./vo/RequestVo");
13
- var axios = require('axios');
14
- var Api = /** @class */ (function () {
15
- function Api(baseUrl) {
16
- this.baseUrl = 'https://open-api.openocean.finance/v3';
17
- this.baseUrlNft = 'http://10.17.130.161:7104/v1';
18
- this.baseUrlV1 = 'https://open-api.openocean.finance/v1';
19
- if (baseUrl)
20
- this.baseUrl = baseUrl;
21
- }
22
- Api.prototype.collections = function (option) {
23
- return (0, ajx_1.get)("".concat(this.baseUrlNft, "/").concat(option.chain, "/").concat(option.market, "/collections"), option, RequestVo_1.CollectionsVo);
24
- };
25
- Api.prototype.assets = function (option) {
26
- return (0, ajx_1.get)("".concat(this.baseUrlNft, "/").concat(option.chain, "/").concat(option.market, "/assets"), option, RequestVo_1.AssetsVo);
27
- };
28
- Api.prototype.buy = function (option) {
29
- return (0, ajx_1.post)("".concat(this.baseUrlNft, "/").concat(option.chain, "/").concat(option.market, "/buy"), option, RequestVo_1.NftBuyVo);
30
- };
31
- Api.prototype.sell = function (option) {
32
- return (0, ajx_1.post)("".concat(this.baseUrlNft, "/").concat(option.chain, "/").concat(option.market, "/sell"), option, RequestVo_1.NftSellVo);
33
- };
34
- Api.prototype.sign = function (option) {
35
- return (0, ajx_1.post)("".concat(this.baseUrlNft, "/").concat(option.chain, "/").concat(option.market, "/sign"), option, RequestVo_1.NftSignVo);
36
- };
37
- Api.prototype.quote = function (option) {
38
- return (0, ajx_1.get)("".concat(this.baseUrl, "/").concat(option.chain, "/quote"), option, RequestVo_1.ReqQuoteVo);
39
- };
40
- Api.prototype.swapQuote = function (option) {
41
- return (0, ajx_1.get)("".concat(this.baseUrl, "/").concat(option.chain, "/swap_quote"), option, RequestVo_1.ReqSwapVo);
42
- };
43
- Api.prototype.getGasPrice = function (option) {
44
- return (0, ajx_1.get)("".concat(this.baseUrl, "/").concat(option.chain, "/gasPrice"), option, RequestVo_1.ChainName);
45
- };
46
- Api.prototype.getTransaction = function (option) {
47
- return (0, ajx_1.get)("".concat(this.baseUrl, "/").concat(option.chain, "/getTransaction"), option, RequestVo_1.TransactionVo);
48
- };
49
- Api.prototype.getTokenList = function (option) {
50
- return (0, ajx_1.get)("".concat(this.baseUrl, "/").concat(option.chain, "/tokenList"), option, RequestVo_1.ChainName);
51
- };
52
- Api.prototype.dexList = function (option) {
53
- return (0, ajx_1.get)("".concat(this.baseUrl, "/").concat(option.chain, "/dexList"), option, RequestVo_1.ChainName);
54
- };
55
- Api.prototype.getTxs = function (option) {
56
- return (0, ajx_1.get)("".concat(this.baseUrl, "/").concat(option.chain, "/getTxs"), option, RequestVo_1.TxsVo);
57
- };
58
- Api.prototype.getTokenPrice = function (id) {
59
- return axios.get("https://api.coingecko.com/api/v3/simple/price?vs_currencies=usd&ids=".concat(id));
60
- };
61
- Api.prototype.getBalance = function (option) {
62
- return (0, ajx_1.get)("".concat(this.baseUrl, "/cross/getBalance"), option, RequestVo_1.ReqBanlanceVo);
63
- };
64
- Api.prototype.getAllowance = function (option) {
65
- return (0, ajx_1.get)("".concat(this.baseUrlV1, "/cross/getAllowance"), option, RequestVo_1.ReqAllowanceVo);
66
- };
67
- Api.prototype.createWallet = function (option) {
68
- return (0, ajx_1.get)("".concat(this.baseUrl, "/").concat(option.chain, "/createWallet"), option, RequestVo_1.ChainName);
69
- };
70
- Api.prototype.solanaScan = function (option) {
71
- return (0, ajx_1.post)("https://market-api.openocean.finance/v1/solana/scan", option, RequestVo_1.SolanaScanVo);
72
- };
73
- __decorate([
74
- setChainId
75
- ], Api.prototype, "collections", null);
76
- __decorate([
77
- setChainId
78
- ], Api.prototype, "assets", null);
79
- __decorate([
80
- setChainId
81
- ], Api.prototype, "buy", null);
82
- __decorate([
83
- setChainId
84
- ], Api.prototype, "sell", null);
85
- __decorate([
86
- setChainId
87
- ], Api.prototype, "sign", null);
88
- __decorate([
89
- setChainId
90
- ], Api.prototype, "quote", null);
91
- __decorate([
92
- setChainId
93
- ], Api.prototype, "swapQuote", null);
94
- __decorate([
95
- setChainId
96
- ], Api.prototype, "getGasPrice", null);
97
- __decorate([
98
- setChainId
99
- ], Api.prototype, "getTransaction", null);
100
- __decorate([
101
- setChainId
102
- ], Api.prototype, "getTokenList", null);
103
- __decorate([
104
- setChainId
105
- ], Api.prototype, "dexList", null);
106
- __decorate([
107
- setChainId
108
- ], Api.prototype, "getTxs", null);
109
- __decorate([
110
- setChainId
111
- ], Api.prototype, "getBalance", null);
112
- __decorate([
113
- setChainId
114
- ], Api.prototype, "getAllowance", null);
115
- __decorate([
116
- setChainId
117
- ], Api.prototype, "createWallet", null);
118
- return Api;
119
- }());
120
- exports.Api = Api;
121
- function setChainId(target, method, descriptor) {
122
- var oldMethod = descriptor.value;
123
- descriptor.value = function () {
124
- var args = [];
125
- for (var _i = 0; _i < arguments.length; _i++) {
126
- args[_i] = arguments[_i];
127
- }
128
- args = args.map(function (item, i) {
129
- if (item && item.chain) {
130
- item.chain = item.chain.toLowerCase();
131
- if (config_1.config.chains.chainObj[item.chain] && config_1.config.chains.chainObj[item.chain].chainId) {
132
- item.chainId = config_1.config.chains.chainObj[item.chain].chainId + '';
133
- }
134
- }
135
- return item;
136
- });
137
- return oldMethod.apply(this, args);
138
- };
139
- }