@openocean.finance/openocean-sdk 0.4.0 → 0.4.3

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.
@@ -4,11 +4,27 @@ object-assign
4
4
  @license MIT
5
5
  */
6
6
 
7
+ /*!
8
+ * decimal.js v10.4.3
9
+ * An arbitrary-precision Decimal type for JavaScript.
10
+ * https://github.com/MikeMcl/decimal.js
11
+ * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
12
+ * MIT Licence
13
+ */
14
+
7
15
  /*!
8
16
  * mustache.js - Logic-less {{mustache}} templates with JavaScript
9
17
  * http://github.com/janl/mustache.js
10
18
  */
11
19
 
20
+ /*!
21
+ * @overview es6-promise - a tiny implementation of Promises/A+.
22
+ * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
23
+ * @license Licensed under MIT license
24
+ * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
25
+ * @version v4.2.8+1e68dce6
26
+ */
27
+
12
28
  /*!
13
29
  * Fast "async" scrypt implementation in JavaScript.
14
30
  * Copyright (c) 2013-2016 Dmitry Chestnykh | BSD License
@@ -22,6 +38,13 @@ object-assign
22
38
  * @license MIT
23
39
  */
24
40
 
41
+ /*!
42
+ * The buffer module from node.js, for the browser.
43
+ *
44
+ * @author Feross Aboukhadijeh <http://feross.org>
45
+ * @license MIT
46
+ */
47
+
25
48
  /*!
26
49
  * The buffer module from node.js, for the browser.
27
50
  *
@@ -75,18 +98,39 @@ See the Apache Version 2.0 License for specific language governing permissions
75
98
  and limitations under the License.
76
99
  ***************************************************************************** */
77
100
 
101
+ /*! *****************************************************************************
102
+ Copyright (c) Microsoft Corporation.
103
+
104
+ Permission to use, copy, modify, and/or distribute this software for any
105
+ purpose with or without fee is hereby granted.
106
+
107
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
108
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
109
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
110
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
111
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
112
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
113
+ PERFORMANCE OF THIS SOFTWARE.
114
+ ***************************************************************************** */
115
+
78
116
  /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */
79
117
 
80
118
  /*! @ont-community/window-post-message-proxy v0.2.14 | (c) 2016 Microsoft Corporation MIT */
81
119
 
82
- /*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */
83
-
84
120
  /*! https://mths.be/punycode v1.3.2 by @mathias */
85
121
 
122
+ /*! https://mths.be/utf8js v3.0.0 by @mathias */
123
+
86
124
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
87
125
 
126
+ /*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */
127
+
88
128
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
89
129
 
130
+ /*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */
131
+
132
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
133
+
90
134
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
91
135
 
92
136
  /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
@@ -95,6 +139,115 @@ and limitations under the License.
95
139
 
96
140
  /*! websocket-as-promised v0.7.0 */
97
141
 
142
+ /**
143
+ * Support for translating between Uint8Array instances and JavaScript
144
+ * native types.
145
+ *
146
+ * {@link module:Layout~Layout|Layout} is the basis of a class
147
+ * hierarchy that associates property names with sequences of encoded
148
+ * bytes.
149
+ *
150
+ * Layouts are supported for these scalar (numeric) types:
151
+ * * {@link module:Layout~UInt|Unsigned integers in little-endian
152
+ * format} with {@link module:Layout.u8|8-bit}, {@link
153
+ * module:Layout.u16|16-bit}, {@link module:Layout.u24|24-bit},
154
+ * {@link module:Layout.u32|32-bit}, {@link
155
+ * module:Layout.u40|40-bit}, and {@link module:Layout.u48|48-bit}
156
+ * representation ranges;
157
+ * * {@link module:Layout~UIntBE|Unsigned integers in big-endian
158
+ * format} with {@link module:Layout.u16be|16-bit}, {@link
159
+ * module:Layout.u24be|24-bit}, {@link module:Layout.u32be|32-bit},
160
+ * {@link module:Layout.u40be|40-bit}, and {@link
161
+ * module:Layout.u48be|48-bit} representation ranges;
162
+ * * {@link module:Layout~Int|Signed integers in little-endian
163
+ * format} with {@link module:Layout.s8|8-bit}, {@link
164
+ * module:Layout.s16|16-bit}, {@link module:Layout.s24|24-bit},
165
+ * {@link module:Layout.s32|32-bit}, {@link
166
+ * module:Layout.s40|40-bit}, and {@link module:Layout.s48|48-bit}
167
+ * representation ranges;
168
+ * * {@link module:Layout~IntBE|Signed integers in big-endian format}
169
+ * with {@link module:Layout.s16be|16-bit}, {@link
170
+ * module:Layout.s24be|24-bit}, {@link module:Layout.s32be|32-bit},
171
+ * {@link module:Layout.s40be|40-bit}, and {@link
172
+ * module:Layout.s48be|48-bit} representation ranges;
173
+ * * 64-bit integral values that decode to an exact (if magnitude is
174
+ * less than 2^53) or nearby integral Number in {@link
175
+ * module:Layout.nu64|unsigned little-endian}, {@link
176
+ * module:Layout.nu64be|unsigned big-endian}, {@link
177
+ * module:Layout.ns64|signed little-endian}, and {@link
178
+ * module:Layout.ns64be|unsigned big-endian} encodings;
179
+ * * 32-bit floating point values with {@link
180
+ * module:Layout.f32|little-endian} and {@link
181
+ * module:Layout.f32be|big-endian} representations;
182
+ * * 64-bit floating point values with {@link
183
+ * module:Layout.f64|little-endian} and {@link
184
+ * module:Layout.f64be|big-endian} representations;
185
+ * * {@link module:Layout.const|Constants} that take no space in the
186
+ * encoded expression.
187
+ *
188
+ * and for these aggregate types:
189
+ * * {@link module:Layout.seq|Sequence}s of instances of a {@link
190
+ * module:Layout~Layout|Layout}, with JavaScript representation as
191
+ * an Array and constant or data-dependent {@link
192
+ * module:Layout~Sequence#count|length};
193
+ * * {@link module:Layout.struct|Structure}s that aggregate a
194
+ * heterogeneous sequence of {@link module:Layout~Layout|Layout}
195
+ * instances, with JavaScript representation as an Object;
196
+ * * {@link module:Layout.union|Union}s that support multiple {@link
197
+ * module:Layout~VariantLayout|variant layouts} over a fixed
198
+ * (padded) or variable (not padded) span of bytes, using an
199
+ * unsigned integer at the start of the data or a separate {@link
200
+ * module:Layout.unionLayoutDiscriminator|layout element} to
201
+ * determine which layout to use when interpreting the buffer
202
+ * contents;
203
+ * * {@link module:Layout.bits|BitStructure}s that contain a sequence
204
+ * of individual {@link
205
+ * module:Layout~BitStructure#addField|BitField}s packed into an 8,
206
+ * 16, 24, or 32-bit unsigned integer starting at the least- or
207
+ * most-significant bit;
208
+ * * {@link module:Layout.cstr|C strings} of varying length;
209
+ * * {@link module:Layout.blob|Blobs} of fixed- or variable-{@link
210
+ * module:Layout~Blob#length|length} raw data.
211
+ *
212
+ * All {@link module:Layout~Layout|Layout} instances are immutable
213
+ * after construction, to prevent internal state from becoming
214
+ * inconsistent.
215
+ *
216
+ * @local Layout
217
+ * @local ExternalLayout
218
+ * @local GreedyCount
219
+ * @local OffsetLayout
220
+ * @local UInt
221
+ * @local UIntBE
222
+ * @local Int
223
+ * @local IntBE
224
+ * @local NearUInt64
225
+ * @local NearUInt64BE
226
+ * @local NearInt64
227
+ * @local NearInt64BE
228
+ * @local Float
229
+ * @local FloatBE
230
+ * @local Double
231
+ * @local DoubleBE
232
+ * @local Sequence
233
+ * @local Structure
234
+ * @local UnionDiscriminator
235
+ * @local UnionLayoutDiscriminator
236
+ * @local Union
237
+ * @local VariantLayout
238
+ * @local BitStructure
239
+ * @local BitField
240
+ * @local Boolean
241
+ * @local Blob
242
+ * @local CString
243
+ * @local Constant
244
+ * @local bindConstructorLayout
245
+ * @module Layout
246
+ * @license MIT
247
+ * @author Peter A. Bigot
248
+ * @see {@link https://github.com/pabigot/buffer-layout|buffer-layout on GitHub}
249
+ */
250
+
98
251
  /**
99
252
  * [js-sha256]{@link https://github.com/emn178/js-sha256}
100
253
  *
@@ -8,6 +8,7 @@ export declare class ReqBalanceVo extends ChainName {
8
8
  tokenAddressOrSymbol: string;
9
9
  decimals: number;
10
10
  account: string;
11
+ customAddress: string;
11
12
  }
12
13
  export declare class ReqAllowanceVo extends ChainName {
13
14
  approveContract: string;
@@ -1 +1 @@
1
- export declare function getBalance(account: string, tokenAddressOrSymbol: string, decimals: number, chainName: string, myWallet: any): Promise<any>;
1
+ export declare function getBalance(account: string, tokenAddressOrSymbol: string, decimals: number, chainName: string, myWallet: any, customAddress?: string): Promise<any>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @author davidshimjs
3
+ * @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a>
4
+ * @see <a href="http://jeromeetienne.github.com/jquery-qrcode/" target="_blank">http://jeromeetienne.github.com/jquery-qrcode/</a>
5
+ */
6
+ export var QRCode: any;
@@ -1,3 +1,3 @@
1
- export declare function validateReq<T>(option: T, vo: any): Promise<string | undefined>;
2
- export declare function get<T, V>(url: string, option: T, vo?: V): Promise<any>;
3
- export declare function post<T, V>(url: string, option: T, vo?: V): Promise<any>;
1
+ export declare function validateReq<T extends object>(option: T, vo?: any): Promise<string | undefined>;
2
+ export declare function get<T extends object, V>(url: string, option: T, vo?: V): Promise<any>;
3
+ export declare function post<T extends object, V>(url: string, option: T, vo?: V): Promise<any>;
@@ -0,0 +1,10 @@
1
+ export const __esModule: boolean;
2
+ export class PrivateKeyProviderConnector {
3
+ constructor(privateKey: any, web3Provider: any);
4
+ privateKey: any;
5
+ web3Provider: any;
6
+ contractEncodeABI(abi: any, address: any, methodName: any, methodParams: any): any;
7
+ signTypedData(_walletAddress: any, typedData: any, _typedDataHash?: string): Promise<string>;
8
+ ethCall(contractAddress: any, callData: any): any;
9
+ decodeABIParameter(type: any, hex: any): any;
10
+ }
@@ -0,0 +1 @@
1
+ export const __esModule: boolean;
@@ -0,0 +1,9 @@
1
+ export const __esModule: boolean;
2
+ export class Web3ProviderConnector {
3
+ constructor(web3Provider: any);
4
+ web3Provider: any;
5
+ contractEncodeABI(abi: any, address: any, methodName: any, methodParams: any): any;
6
+ signTypedData(walletAddress: any, typedData: any, _typedDataHash: any): any;
7
+ ethCall(contractAddress: any, callData: any): any;
8
+ decodeABIParameter(type: any, hex: any): any;
9
+ }
@@ -0,0 +1,7 @@
1
+ export const __esModule: boolean;
2
+ export const Erc20Methods: {};
3
+ export class Erc20Facade {
4
+ constructor(providerConnector: any);
5
+ providerConnector: any;
6
+ balanceOf(tokenAddress: any, walletAddress: any): any;
7
+ }
@@ -0,0 +1 @@
1
+ export const __esModule: boolean;
@@ -0,0 +1,12 @@
1
+ export const __esModule: boolean;
2
+ export class LimitOrderPredicateBuilder {
3
+ constructor(facade: any);
4
+ facade: any;
5
+ and: (...predicates: any[]) => any;
6
+ or: (...predicates: any[]) => any;
7
+ eq: (value: any, address: any, callData: any) => any;
8
+ lt: (value: any, address: any, callData: any) => any;
9
+ gt: (value: any, address: any, callData: any) => any;
10
+ nonceEquals: (makerAddress: any, makerNonce: any) => any;
11
+ timestampBelow: (timestamp: any) => any;
12
+ }
@@ -0,0 +1,18 @@
1
+ export const __esModule: boolean;
2
+ export const PROTOCOL_NAME: "1inch Limit Order Protocol";
3
+ export const PROTOCOL_VERSION: "2";
4
+ export const ZX: "0x";
5
+ export const ZERO_ADDRESS: "0x0000000000000000000000000000000000000000";
6
+ export const CALL_RESULTS_PREFIX: "CALL_RESULTS_";
7
+ export const EIP712_DOMAIN: {
8
+ name: string;
9
+ type: string;
10
+ }[];
11
+ export const ORDER_STRUCTURE: {
12
+ name: string;
13
+ type: string;
14
+ }[];
15
+ export const RFQ_ORDER_STRUCTURE: {
16
+ name: string;
17
+ type: string;
18
+ }[];
@@ -0,0 +1,26 @@
1
+ export const __esModule: boolean;
2
+ export class LimitOrderProtocolFacade {
3
+ constructor(contractAddress: any, providerConnector: any);
4
+ contractAddress: any;
5
+ providerConnector: any;
6
+ fillLimitOrder(order: any, signature: any, makerAmount: any, takerAmount: any, thresholdAmount: any): any;
7
+ fillOrderToWithPermit(params: any): any;
8
+ fillRFQOrder(order: any, signature: any, makerAmount: any, takerAmount: any): any;
9
+ cancelLimitOrder(order: any): any;
10
+ cancelRFQOrder(orderInfo: any): any;
11
+ nonce(makerAddress: any): any;
12
+ advanceNonce(count: any): any;
13
+ increaseNonce(): any;
14
+ checkPredicate(order: any): any;
15
+ remaining(orderHash: any): any;
16
+ simulateCalls(tokens: any, data: any): any;
17
+ domainSeparator(): any;
18
+ getContractCallData(methodName: any, methodParams?: any[]): any;
19
+ parseRemainingResponse(response: any): bignumber_1.BigNumber | null;
20
+ parseSimulateTransferResponse(response: any): boolean | null;
21
+ parseSimulateTransferError(error: any): boolean | null;
22
+ parseContractResponse(response: any): any;
23
+ isMsgContainsCorrectCode(message: any): boolean | null;
24
+ stringifyError(error: any): string;
25
+ }
26
+ import bignumber_1 = require("@ethersproject/bignumber");
@@ -0,0 +1,101 @@
1
+ export const __esModule: boolean;
2
+ export function generateOrderSalt(): string;
3
+ export function generateRFQOrderInfo(id: any, expiresInTimestamp: any, wrapEth: any): string;
4
+ export class LimitOrderBuilder {
5
+ constructor(contractAddress: any, chainId: any, providerConnector: any, generateSalt?: typeof generateOrderSalt);
6
+ contractAddress: any;
7
+ chainId: any;
8
+ providerConnector: any;
9
+ generateSalt: typeof generateOrderSalt;
10
+ buildOrderSignature(walletAddress: any, typedData: any): any;
11
+ buildLimitOrderHash(orderTypedData: any): string;
12
+ buildLimitOrderTypedData(order: any, domainName?: string): {
13
+ primaryType: string;
14
+ types: {
15
+ EIP712Domain: {
16
+ name: string;
17
+ type: string;
18
+ }[];
19
+ Order: {
20
+ name: string;
21
+ type: string;
22
+ }[];
23
+ };
24
+ domain: {
25
+ name: string;
26
+ version: string;
27
+ chainId: any;
28
+ verifyingContract: any;
29
+ };
30
+ message: any;
31
+ };
32
+ buildRFQOrderTypedData(order: any, domainName?: string): {
33
+ primaryType: string;
34
+ types: {
35
+ EIP712Domain: {
36
+ name: string;
37
+ type: string;
38
+ }[];
39
+ OrderRFQ: {
40
+ name: string;
41
+ type: string;
42
+ }[];
43
+ };
44
+ domain: {
45
+ name: string;
46
+ version: string;
47
+ chainId: any;
48
+ verifyingContract: any;
49
+ };
50
+ message: any;
51
+ };
52
+ buildRFQOrder({ id, wrapEth, expiresInTimestamp, makerAssetAddress, takerAssetAddress, makerAddress, takerAddress, makerAmount, takerAmount, }: {
53
+ id: any;
54
+ wrapEth?: boolean | undefined;
55
+ expiresInTimestamp: any;
56
+ makerAssetAddress: any;
57
+ takerAssetAddress: any;
58
+ makerAddress: any;
59
+ takerAddress?: string | undefined;
60
+ makerAmount: any;
61
+ takerAmount: any;
62
+ }): {
63
+ info: string;
64
+ makerAsset: any;
65
+ takerAsset: any;
66
+ maker: any;
67
+ allowedSender: string;
68
+ makingAmount: any;
69
+ takingAmount: any;
70
+ };
71
+ buildLimitOrder({ makerAssetAddress, takerAssetAddress, makerAddress, receiver, takerAddress, makerAmount, takerAmount, predicate, permit, interaction, }: {
72
+ makerAssetAddress: any;
73
+ takerAssetAddress: any;
74
+ makerAddress: any;
75
+ receiver?: string | undefined;
76
+ takerAddress?: string | undefined;
77
+ makerAmount: any;
78
+ takerAmount: any;
79
+ predicate?: string | undefined;
80
+ permit?: string | undefined;
81
+ interaction?: string | undefined;
82
+ }): {
83
+ salt: string;
84
+ makerAsset: any;
85
+ takerAsset: any;
86
+ maker: any;
87
+ receiver: string;
88
+ allowedSender: string;
89
+ makingAmount: any;
90
+ takingAmount: any;
91
+ makerAssetData: string;
92
+ takerAssetData: string;
93
+ getMakerAmount: any;
94
+ getTakerAmount: any;
95
+ predicate: string;
96
+ permit: string;
97
+ interaction: string;
98
+ };
99
+ getContractCallData(methodName: any, methodParams?: any[]): any;
100
+ getAmountData(methodName: any, makerAmount: any, takerAmount: any, swapTakerAmount?: string): any;
101
+ }
@@ -0,0 +1 @@
1
+ export const __esModule: boolean;
@@ -0,0 +1 @@
1
+ export const __esModule: boolean;
@@ -0,0 +1,3 @@
1
+ export const __esModule: boolean;
2
+ export const ChainId: {};
3
+ export const LimitOrderProtocolMethods: {};
@@ -0,0 +1,2 @@
1
+ export const __esModule: boolean;
2
+ export function getRPCCode(response: any): any;
@@ -0,0 +1,89 @@
1
+ export const __esModule: boolean;
2
+ export const operationSchema: {
3
+ type: string;
4
+ name: string;
5
+ choices: {
6
+ title: string;
7
+ value: string;
8
+ }[];
9
+ message: string;
10
+ }[];
11
+ export const createOrderSchema: ({
12
+ type: string;
13
+ name: string;
14
+ message: string;
15
+ choices: {
16
+ title: string;
17
+ value: limit_order_protocol_model_1.ChainId;
18
+ }[];
19
+ } | {
20
+ type: string;
21
+ name: string;
22
+ message: string;
23
+ choices?: undefined;
24
+ } | {
25
+ type: string;
26
+ name: string;
27
+ message: string;
28
+ initial: number;
29
+ })[];
30
+ export const fillOrderSchema: ({
31
+ type: string;
32
+ name: string;
33
+ message: string;
34
+ choices: {
35
+ title: string;
36
+ value: limit_order_protocol_model_1.ChainId;
37
+ }[];
38
+ } | {
39
+ type: string;
40
+ name: string;
41
+ message: string;
42
+ choices?: undefined;
43
+ } | {
44
+ type: string;
45
+ name: string;
46
+ message: string;
47
+ initial: number;
48
+ })[];
49
+ export const cancelOrderSchema: ({
50
+ type: string;
51
+ name: string;
52
+ message: string;
53
+ choices: {
54
+ title: string;
55
+ value: limit_order_protocol_model_1.ChainId;
56
+ }[];
57
+ } | {
58
+ type: string;
59
+ name: string;
60
+ message: string;
61
+ choices?: undefined;
62
+ } | {
63
+ type: string;
64
+ name: string;
65
+ message: string;
66
+ initial: number;
67
+ })[];
68
+ export const rpcUrls: {
69
+ 1: string;
70
+ 56: string;
71
+ 137: string;
72
+ 10: string;
73
+ 42161: string;
74
+ };
75
+ export const contractAddresses: {
76
+ 1: string;
77
+ 56: string;
78
+ 137: string;
79
+ 10: string;
80
+ 42161: string;
81
+ };
82
+ export const explorersUrls: {
83
+ 1: string;
84
+ 56: string;
85
+ 137: string;
86
+ 10: string;
87
+ 42161: string;
88
+ };
89
+ import limit_order_protocol_model_1 = require("../model/limit-order-protocol.model");
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ export const __esModule: boolean;
3
+ export function createOrderOperation(isRunningWithArgv: any, params: any): any;
4
+ export function fillOrderOperation(isRunningWithArgv: any, params: any): any;
5
+ export function cancelOrderOperation(isRunningWithArgv: any, params: any): any;
6
+ export function createOrder(params: any): import("..").RFQOrder;
7
+ export function fillOrder(params: any, order: any): any;
8
+ export function cancelOrder(params: any): any;
9
+ export function sendSignedTransaction(web3: any, txConfig: any, privateKey: any): any;
10
+ export function gweiToWei(value: any): string;
@@ -0,0 +1 @@
1
+ export const __esModule: boolean;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export const __esModule: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openocean.finance/openocean-sdk",
3
- "version": "0.4.0",
3
+ "version": "0.4.3",
4
4
  "description": "Openocean sdk",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -48,7 +48,7 @@
48
48
  "dependencies": {
49
49
  "@ethersproject/bignumber": "^5.1.1",
50
50
  "@jup-ag/core": "^1.0.0-beta.27",
51
- "@openocean.finance/wallet": "^0.4.46",
51
+ "@openocean.finance/wallet": "^0.4.47",
52
52
  "@solana/buffer-layout": "^4.0.0",
53
53
  "@walletconnect/web3-provider": "^1.7.8",
54
54
  "aptos": "^1.3.17",