@symbiome-forge/cow-sdk-wasm 0.1.0-alpha.1
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/LICENSE +674 -0
- package/README.md +278 -0
- package/dist/cloudflare/callbacks.cjs +2 -0
- package/dist/cloudflare/callbacks.d.ts +55 -0
- package/dist/cloudflare/callbacks.js +1 -0
- package/dist/cloudflare/envelope.cjs +2 -0
- package/dist/cloudflare/envelope.d.ts +5 -0
- package/dist/cloudflare/envelope.js +1 -0
- package/dist/cloudflare/errors.cjs +150 -0
- package/dist/cloudflare/errors.d.ts +82 -0
- package/dist/cloudflare/errors.js +145 -0
- package/dist/cloudflare/index.cjs +286 -0
- package/dist/cloudflare/index.d.ts +78 -0
- package/dist/cloudflare/index.js +1 -0
- package/dist/cloudflare/index.mjs +223 -0
- package/dist/cloudflare/internal.cjs +127 -0
- package/dist/cloudflare/internal.d.ts +40 -0
- package/dist/cloudflare/internal.js +115 -0
- package/dist/cloudflare/options.cjs +2 -0
- package/dist/cloudflare/options.d.ts +70 -0
- package/dist/cloudflare/options.js +1 -0
- package/dist/cloudflare/raw/cloudflare.cjs +65 -0
- package/dist/cloudflare/raw/cloudflare.d.ts +30 -0
- package/dist/cloudflare/raw/cloudflare.js +29 -0
- package/dist/default/callbacks.cjs +2 -0
- package/dist/default/callbacks.d.ts +55 -0
- package/dist/default/callbacks.js +1 -0
- package/dist/default/envelope.cjs +2 -0
- package/dist/default/envelope.d.ts +5 -0
- package/dist/default/envelope.js +1 -0
- package/dist/default/errors.cjs +150 -0
- package/dist/default/errors.d.ts +82 -0
- package/dist/default/errors.js +145 -0
- package/dist/default/index.cjs +359 -0
- package/dist/default/index.d.ts +94 -0
- package/dist/default/index.js +1 -0
- package/dist/default/index.mjs +295 -0
- package/dist/default/internal.cjs +127 -0
- package/dist/default/internal.d.ts +40 -0
- package/dist/default/internal.js +115 -0
- package/dist/default/options.cjs +2 -0
- package/dist/default/options.d.ts +70 -0
- package/dist/default/options.js +1 -0
- package/dist/default/raw/default.cjs +66 -0
- package/dist/default/raw/default.d.ts +31 -0
- package/dist/default/raw/default.js +30 -0
- package/dist/orderbook/callbacks.cjs +2 -0
- package/dist/orderbook/callbacks.d.ts +55 -0
- package/dist/orderbook/callbacks.js +1 -0
- package/dist/orderbook/envelope.cjs +2 -0
- package/dist/orderbook/envelope.d.ts +5 -0
- package/dist/orderbook/envelope.js +1 -0
- package/dist/orderbook/errors.cjs +150 -0
- package/dist/orderbook/errors.d.ts +82 -0
- package/dist/orderbook/errors.js +145 -0
- package/dist/orderbook/index.cjs +195 -0
- package/dist/orderbook/index.d.ts +57 -0
- package/dist/orderbook/index.js +1 -0
- package/dist/orderbook/index.mjs +139 -0
- package/dist/orderbook/internal.cjs +127 -0
- package/dist/orderbook/internal.d.ts +40 -0
- package/dist/orderbook/internal.js +115 -0
- package/dist/orderbook/options.cjs +2 -0
- package/dist/orderbook/options.d.ts +70 -0
- package/dist/orderbook/options.js +1 -0
- package/dist/orderbook/raw/orderbook.cjs +58 -0
- package/dist/orderbook/raw/orderbook.d.ts +23 -0
- package/dist/orderbook/raw/orderbook.js +22 -0
- package/dist/raw/cloudflare-web/cow_sdk_wasm.d.ts +2870 -0
- package/dist/raw/cloudflare-web/cow_sdk_wasm.js +2183 -0
- package/dist/raw/cloudflare-web/cow_sdk_wasm_bg.wasm +0 -0
- package/dist/raw/cloudflare-web/cow_sdk_wasm_bg.wasm.d.ts +65 -0
- package/dist/raw/default-bundler/cow_sdk_wasm.d.ts +2916 -0
- package/dist/raw/default-bundler/cow_sdk_wasm.js +9 -0
- package/dist/raw/default-bundler/cow_sdk_wasm_bg.js +2297 -0
- package/dist/raw/default-bundler/cow_sdk_wasm_bg.wasm +0 -0
- package/dist/raw/default-bundler/cow_sdk_wasm_bg.wasm.d.ts +75 -0
- package/dist/raw/default-nodejs/cow_sdk_wasm.cjs +2330 -0
- package/dist/raw/default-nodejs/cow_sdk_wasm.d.ts +2916 -0
- package/dist/raw/default-nodejs/cow_sdk_wasm_bg.wasm.d.ts +75 -0
- package/dist/raw/orderbook-bundler/cow_sdk_wasm.d.ts +1876 -0
- package/dist/raw/orderbook-bundler/cow_sdk_wasm.js +9 -0
- package/dist/raw/orderbook-bundler/cow_sdk_wasm_bg.js +1636 -0
- package/dist/raw/orderbook-bundler/cow_sdk_wasm_bg.wasm +0 -0
- package/dist/raw/orderbook-bundler/cow_sdk_wasm_bg.wasm.d.ts +50 -0
- package/dist/raw/orderbook-nodejs/cow_sdk_wasm.cjs +1661 -0
- package/dist/raw/orderbook-nodejs/cow_sdk_wasm.d.ts +1876 -0
- package/dist/raw/orderbook-nodejs/cow_sdk_wasm_bg.wasm.d.ts +50 -0
- package/dist/raw/signing-bundler/cow_sdk_wasm.d.ts +774 -0
- package/dist/raw/signing-bundler/cow_sdk_wasm.js +9 -0
- package/dist/raw/signing-bundler/cow_sdk_wasm_bg.js +1059 -0
- package/dist/raw/signing-bundler/cow_sdk_wasm_bg.wasm +0 -0
- package/dist/raw/signing-bundler/cow_sdk_wasm_bg.wasm.d.ts +27 -0
- package/dist/raw/signing-nodejs/cow_sdk_wasm.cjs +1078 -0
- package/dist/raw/signing-nodejs/cow_sdk_wasm.d.ts +774 -0
- package/dist/raw/signing-nodejs/cow_sdk_wasm_bg.wasm.d.ts +27 -0
- package/dist/signing/callbacks.cjs +2 -0
- package/dist/signing/callbacks.d.ts +55 -0
- package/dist/signing/callbacks.js +1 -0
- package/dist/signing/envelope.cjs +2 -0
- package/dist/signing/envelope.d.ts +5 -0
- package/dist/signing/envelope.js +1 -0
- package/dist/signing/errors.cjs +150 -0
- package/dist/signing/errors.d.ts +82 -0
- package/dist/signing/errors.js +145 -0
- package/dist/signing/index.cjs +93 -0
- package/dist/signing/index.d.ts +23 -0
- package/dist/signing/index.js +1 -0
- package/dist/signing/index.mjs +44 -0
- package/dist/signing/internal.cjs +127 -0
- package/dist/signing/internal.d.ts +40 -0
- package/dist/signing/internal.js +115 -0
- package/dist/signing/options.cjs +2 -0
- package/dist/signing/options.d.ts +70 -0
- package/dist/signing/options.js +1 -0
- package/dist/signing/raw/signing.cjs +52 -0
- package/dist/signing/raw/signing.d.ts +17 -0
- package/dist/signing/raw/signing.js +16 -0
- package/package.json +112 -0
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.TradingClient = exports.SubgraphClient = exports.OrderBookClient = exports.IpfsClient = void 0;
|
|
37
|
+
exports.appDataDoc = appDataDoc;
|
|
38
|
+
exports.appDataHexToCid = appDataHexToCid;
|
|
39
|
+
exports.appDataInfo = appDataInfo;
|
|
40
|
+
exports.buildCancelOrderTx = buildCancelOrderTx;
|
|
41
|
+
exports.buildPresignTx = buildPresignTx;
|
|
42
|
+
exports.cidToAppDataHex = cidToAppDataHex;
|
|
43
|
+
exports.computeOrderUid = computeOrderUid;
|
|
44
|
+
exports.decodeEthFlowLog = decodeEthFlowLog;
|
|
45
|
+
exports.decodeSettlementLog = decodeSettlementLog;
|
|
46
|
+
exports.deploymentAddresses = deploymentAddresses;
|
|
47
|
+
exports.domainSeparator = domainSeparator;
|
|
48
|
+
exports.eip1271SignaturePayload = eip1271SignaturePayload;
|
|
49
|
+
exports.orderTypedData = orderTypedData;
|
|
50
|
+
exports.signCancellationEthSignDigest = signCancellationEthSignDigest;
|
|
51
|
+
exports.signCancellationWithEip1193 = signCancellationWithEip1193;
|
|
52
|
+
exports.signCancellationWithTypedDataSigner = signCancellationWithTypedDataSigner;
|
|
53
|
+
exports.signOrderEthSignDigest = signOrderEthSignDigest;
|
|
54
|
+
exports.signOrderWithCustomEip1271 = signOrderWithCustomEip1271;
|
|
55
|
+
exports.signOrderWithEip1193 = signOrderWithEip1193;
|
|
56
|
+
exports.signOrderWithEip1271 = signOrderWithEip1271;
|
|
57
|
+
exports.signOrderWithTypedDataSigner = signOrderWithTypedDataSigner;
|
|
58
|
+
exports.supportedChainIds = supportedChainIds;
|
|
59
|
+
exports.validateAppDataDoc = validateAppDataDoc;
|
|
60
|
+
exports.wasmVersion = wasmVersion;
|
|
61
|
+
const raw = __importStar(require("./raw/default.cjs"));
|
|
62
|
+
const internal_js_1 = require("./internal.cjs");
|
|
63
|
+
class IpfsClient {
|
|
64
|
+
#inner;
|
|
65
|
+
#defaults;
|
|
66
|
+
#disposed = false;
|
|
67
|
+
constructor(config) {
|
|
68
|
+
try {
|
|
69
|
+
this.#defaults = (0, internal_js_1.defaultsFrom)(config);
|
|
70
|
+
this.#inner = new raw.RawIpfsClient((0, internal_js_1.translateClientConfig)(config));
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
throw (0, internal_js_1.callSync)(() => {
|
|
74
|
+
throw error;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
async fetchAppDataFromCid(cid, options) {
|
|
79
|
+
return this.#call((client, merged) => client.fetchAppDataFromCid(cid, merged), options);
|
|
80
|
+
}
|
|
81
|
+
async fetchAppDataFromHex(appDataHex, options) {
|
|
82
|
+
return this.#call((client, merged) => client.fetchAppDataFromHex(appDataHex, merged), options);
|
|
83
|
+
}
|
|
84
|
+
dispose() {
|
|
85
|
+
if (!this.#disposed) {
|
|
86
|
+
(0, internal_js_1.disposeRaw)(this.#inner);
|
|
87
|
+
this.#disposed = true;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
[Symbol.dispose]() {
|
|
91
|
+
this.dispose();
|
|
92
|
+
}
|
|
93
|
+
#call(operation, options) {
|
|
94
|
+
return (0, internal_js_1.callAsync)(() => {
|
|
95
|
+
(0, internal_js_1.assertActive)(this.#disposed);
|
|
96
|
+
return operation(this.#inner, (0, internal_js_1.mergeOptions)(this.#defaults, options));
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.IpfsClient = IpfsClient;
|
|
101
|
+
class OrderBookClient {
|
|
102
|
+
#inner;
|
|
103
|
+
#defaults;
|
|
104
|
+
#disposed = false;
|
|
105
|
+
constructor(config) {
|
|
106
|
+
try {
|
|
107
|
+
this.#defaults = (0, internal_js_1.defaultsFrom)(config);
|
|
108
|
+
this.#inner = new raw.RawOrderBookClient((0, internal_js_1.translateClientConfig)(config));
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
throw (0, internal_js_1.callSync)(() => {
|
|
112
|
+
throw error;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async cancelOrders(signed, options) {
|
|
117
|
+
return this.#call((client, merged) => client.cancelOrders(signed, merged), options);
|
|
118
|
+
}
|
|
119
|
+
async getNativePrice(token, options) {
|
|
120
|
+
return this.#call((client, merged) => client.getNativePrice(token, merged), options);
|
|
121
|
+
}
|
|
122
|
+
async getOrder(orderUid, options) {
|
|
123
|
+
return this.#call((client, merged) => client.getOrder(orderUid, merged), options);
|
|
124
|
+
}
|
|
125
|
+
async getOrders(owner, pagination, options) {
|
|
126
|
+
return this.#call((client, merged) => client.getOrders(owner, pagination ?? null, merged), options);
|
|
127
|
+
}
|
|
128
|
+
async getOrderMultiEnv(orderUid, options) {
|
|
129
|
+
return this.#call((client, merged) => client.getOrderMultiEnv(orderUid, merged), options);
|
|
130
|
+
}
|
|
131
|
+
async getTxOrders(txHash, options) {
|
|
132
|
+
return this.#call((client, merged) => client.getTxOrders(txHash, merged), options);
|
|
133
|
+
}
|
|
134
|
+
async getVersion(options) {
|
|
135
|
+
return this.#call((client, merged) => client.getVersion(merged), options);
|
|
136
|
+
}
|
|
137
|
+
getOrderLink(orderUid) {
|
|
138
|
+
(0, internal_js_1.assertActive)(this.#disposed);
|
|
139
|
+
return (0, internal_js_1.callSync)(() => this.#inner.getOrderLink(orderUid));
|
|
140
|
+
}
|
|
141
|
+
async getQuote(request, options) {
|
|
142
|
+
return this.#call((client, merged) => client.getQuote(request, merged), options);
|
|
143
|
+
}
|
|
144
|
+
async getTrades(query, options) {
|
|
145
|
+
return this.#call((client, merged) => client.getTrades(query, merged), options);
|
|
146
|
+
}
|
|
147
|
+
async getOrderCompetitionStatus(orderUid, options) {
|
|
148
|
+
return this.#call((client, merged) => client.getOrderCompetitionStatus(orderUid, merged), options);
|
|
149
|
+
}
|
|
150
|
+
async getTotalSurplus(owner, options) {
|
|
151
|
+
return this.#call((client, merged) => client.getTotalSurplus(owner, merged), options);
|
|
152
|
+
}
|
|
153
|
+
async getAppData(appDataHash, options) {
|
|
154
|
+
return this.#call((client, merged) => client.getAppData(appDataHash, merged), options);
|
|
155
|
+
}
|
|
156
|
+
async uploadAppData(appDataHash, fullAppData, options) {
|
|
157
|
+
return this.#call((client, merged) => client.uploadAppData(appDataHash, fullAppData, merged), options);
|
|
158
|
+
}
|
|
159
|
+
async sendOrder(signed, options) {
|
|
160
|
+
return this.#call((client, merged) => client.sendOrder(signed, merged), options);
|
|
161
|
+
}
|
|
162
|
+
async sendOrderCreation(input, options) {
|
|
163
|
+
return this.#call((client, merged) => client.sendOrderCreation(input, merged), options);
|
|
164
|
+
}
|
|
165
|
+
dispose() {
|
|
166
|
+
if (!this.#disposed) {
|
|
167
|
+
(0, internal_js_1.disposeRaw)(this.#inner);
|
|
168
|
+
this.#disposed = true;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
[Symbol.dispose]() {
|
|
172
|
+
this.dispose();
|
|
173
|
+
}
|
|
174
|
+
#call(operation, options) {
|
|
175
|
+
return (0, internal_js_1.callAsync)(() => {
|
|
176
|
+
(0, internal_js_1.assertActive)(this.#disposed);
|
|
177
|
+
return operation(this.#inner, (0, internal_js_1.mergeOptions)(this.#defaults, options));
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
exports.OrderBookClient = OrderBookClient;
|
|
182
|
+
class SubgraphClient {
|
|
183
|
+
#inner;
|
|
184
|
+
#defaults;
|
|
185
|
+
#disposed = false;
|
|
186
|
+
constructor(config) {
|
|
187
|
+
try {
|
|
188
|
+
this.#defaults = (0, internal_js_1.defaultsFrom)(config);
|
|
189
|
+
this.#inner = new raw.RawSubgraphClient((0, internal_js_1.translateClientConfig)(config));
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
throw (0, internal_js_1.callSync)(() => {
|
|
193
|
+
throw error;
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
async getLastDaysVolume(days, options) {
|
|
198
|
+
return this.#call((client, merged) => client.getLastDaysVolume(days, merged), options);
|
|
199
|
+
}
|
|
200
|
+
async getLastHoursVolume(hours, options) {
|
|
201
|
+
return this.#call((client, merged) => client.getLastHoursVolume(hours, merged), options);
|
|
202
|
+
}
|
|
203
|
+
async getTotals(options) {
|
|
204
|
+
return this.#call((client, merged) => client.getTotals(merged), options);
|
|
205
|
+
}
|
|
206
|
+
async runQuery(request, options) {
|
|
207
|
+
return this.#call((client, merged) => client.runQuery(request, merged), options);
|
|
208
|
+
}
|
|
209
|
+
dispose() {
|
|
210
|
+
if (!this.#disposed) {
|
|
211
|
+
(0, internal_js_1.disposeRaw)(this.#inner);
|
|
212
|
+
this.#disposed = true;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
[Symbol.dispose]() {
|
|
216
|
+
this.dispose();
|
|
217
|
+
}
|
|
218
|
+
#call(operation, options) {
|
|
219
|
+
return (0, internal_js_1.callAsync)(() => {
|
|
220
|
+
(0, internal_js_1.assertActive)(this.#disposed);
|
|
221
|
+
return operation(this.#inner, (0, internal_js_1.mergeOptions)(this.#defaults, options));
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
exports.SubgraphClient = SubgraphClient;
|
|
226
|
+
class TradingClient {
|
|
227
|
+
#inner;
|
|
228
|
+
#defaults;
|
|
229
|
+
#disposed = false;
|
|
230
|
+
constructor(config) {
|
|
231
|
+
try {
|
|
232
|
+
this.#defaults = (0, internal_js_1.defaultsFrom)(config);
|
|
233
|
+
this.#inner = new raw.RawTradingClient((0, internal_js_1.translateClientConfig)(config));
|
|
234
|
+
}
|
|
235
|
+
catch (error) {
|
|
236
|
+
throw (0, internal_js_1.callSync)(() => {
|
|
237
|
+
throw error;
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
async buildSellNativeCurrencyTx(order, quoteId, from, options) {
|
|
242
|
+
return this.#call((client, merged) => client.buildSellNativeCurrencyTx(order, quoteId, from, merged), options);
|
|
243
|
+
}
|
|
244
|
+
async getCowProtocolAllowance(params, readContractCallback, options) {
|
|
245
|
+
return this.#call((client, merged) => client.getCowProtocolAllowance(params, readContractCallback, merged), options);
|
|
246
|
+
}
|
|
247
|
+
async buildApprovalTx(params, options) {
|
|
248
|
+
return this.#call((client, merged) => client.buildApprovalTx(params, merged), options);
|
|
249
|
+
}
|
|
250
|
+
async getQuote(params, options) {
|
|
251
|
+
return this.#call((client, merged) => client.getQuote(params, merged), options);
|
|
252
|
+
}
|
|
253
|
+
async postLimitOrder(params, owner, signerCallback, options) {
|
|
254
|
+
return this.#callSigning((client, merged) => client.postLimitOrder(params, owner, signerCallback, merged ?? null), options);
|
|
255
|
+
}
|
|
256
|
+
async postSwapOrder(params, owner, signerCallback, options) {
|
|
257
|
+
return this.#callSigning((client, merged) => client.postSwapOrder(params, owner, signerCallback, merged ?? null), options);
|
|
258
|
+
}
|
|
259
|
+
async postSwapOrderFromQuote(quoteResults, owner, signerCallback, options) {
|
|
260
|
+
return this.#callSigning((client, merged) => client.postSwapOrderFromQuote(quoteResults, owner, signerCallback, merged ?? null), options);
|
|
261
|
+
}
|
|
262
|
+
async postSwapOrderWithEip1271(params, owner, customCallback, options) {
|
|
263
|
+
return this.#callSigning((client, merged) => client.postSwapOrderWithEip1271(params, owner, customCallback, merged ?? null), options);
|
|
264
|
+
}
|
|
265
|
+
dispose() {
|
|
266
|
+
if (!this.#disposed) {
|
|
267
|
+
(0, internal_js_1.disposeRaw)(this.#inner);
|
|
268
|
+
this.#disposed = true;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
[Symbol.dispose]() {
|
|
272
|
+
this.dispose();
|
|
273
|
+
}
|
|
274
|
+
#call(operation, options) {
|
|
275
|
+
return (0, internal_js_1.callAsync)(() => {
|
|
276
|
+
(0, internal_js_1.assertActive)(this.#disposed);
|
|
277
|
+
return operation(this.#inner, (0, internal_js_1.mergeOptions)(this.#defaults, options));
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
#callSigning(operation, options) {
|
|
281
|
+
return (0, internal_js_1.callAsync)(() => {
|
|
282
|
+
(0, internal_js_1.assertActive)(this.#disposed);
|
|
283
|
+
return operation(this.#inner, (0, internal_js_1.mergeSigningOptions)(this.#defaults, options));
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
exports.TradingClient = TradingClient;
|
|
288
|
+
function appDataDoc(doc) {
|
|
289
|
+
return (0, internal_js_1.callSync)(() => raw.appDataDoc(doc));
|
|
290
|
+
}
|
|
291
|
+
function appDataHexToCid(appDataHex) {
|
|
292
|
+
return (0, internal_js_1.callSync)(() => raw.appDataHexToCid(appDataHex));
|
|
293
|
+
}
|
|
294
|
+
function appDataInfo(doc) {
|
|
295
|
+
return (0, internal_js_1.callSync)(() => raw.appDataInfo(doc));
|
|
296
|
+
}
|
|
297
|
+
function buildCancelOrderTx(params) {
|
|
298
|
+
return (0, internal_js_1.callSync)(() => raw.buildCancelOrderTx(params));
|
|
299
|
+
}
|
|
300
|
+
function buildPresignTx(params) {
|
|
301
|
+
return (0, internal_js_1.callSync)(() => raw.buildPresignTx(params));
|
|
302
|
+
}
|
|
303
|
+
function cidToAppDataHex(cid) {
|
|
304
|
+
return (0, internal_js_1.callSync)(() => raw.cidToAppDataHex(cid));
|
|
305
|
+
}
|
|
306
|
+
function computeOrderUid(input, chainId, owner) {
|
|
307
|
+
return (0, internal_js_1.callSync)(() => raw.computeOrderUid(input, chainId, owner));
|
|
308
|
+
}
|
|
309
|
+
function decodeEthFlowLog(log) {
|
|
310
|
+
return (0, internal_js_1.callSync)(() => raw.decodeEthFlowLog(log));
|
|
311
|
+
}
|
|
312
|
+
function decodeSettlementLog(log) {
|
|
313
|
+
return (0, internal_js_1.callSync)(() => raw.decodeSettlementLog(log));
|
|
314
|
+
}
|
|
315
|
+
function deploymentAddresses(chainId, env) {
|
|
316
|
+
return (0, internal_js_1.callSync)(() => raw.deploymentAddresses(chainId, env ?? null));
|
|
317
|
+
}
|
|
318
|
+
function domainSeparator(chainId) {
|
|
319
|
+
return (0, internal_js_1.callSync)(() => raw.domainSeparator(chainId));
|
|
320
|
+
}
|
|
321
|
+
function eip1271SignaturePayload(input, ecdsaSignature) {
|
|
322
|
+
return (0, internal_js_1.callSync)(() => raw.eip1271SignaturePayload(input, ecdsaSignature));
|
|
323
|
+
}
|
|
324
|
+
function orderTypedData(input, chainId) {
|
|
325
|
+
return (0, internal_js_1.callSync)(() => raw.orderTypedData(input, chainId));
|
|
326
|
+
}
|
|
327
|
+
function signCancellationEthSignDigest(orderUids, chainId, digestSigner, options) {
|
|
328
|
+
return (0, internal_js_1.callAsync)(() => raw.signCancellationEthSignDigest(orderUids, chainId, digestSigner, options ?? null));
|
|
329
|
+
}
|
|
330
|
+
function signCancellationWithEip1193(orderUids, chainId, owner, requestCallback, options) {
|
|
331
|
+
return (0, internal_js_1.callAsync)(() => raw.signCancellationWithEip1193(orderUids, chainId, owner, requestCallback, options ?? null));
|
|
332
|
+
}
|
|
333
|
+
function signCancellationWithTypedDataSigner(orderUids, chainId, typedDataSigner, options) {
|
|
334
|
+
return (0, internal_js_1.callAsync)(() => raw.signCancellationWithTypedDataSigner(orderUids, chainId, typedDataSigner, options ?? null));
|
|
335
|
+
}
|
|
336
|
+
function signOrderEthSignDigest(input, chainId, owner, digestSigner, options) {
|
|
337
|
+
return (0, internal_js_1.callAsync)(() => raw.signOrderEthSignDigest(input, chainId, owner, digestSigner, options ?? null));
|
|
338
|
+
}
|
|
339
|
+
function signOrderWithCustomEip1271(input, chainId, owner, customCallback, options) {
|
|
340
|
+
return (0, internal_js_1.callAsync)(() => raw.signOrderWithCustomEip1271(input, chainId, owner, customCallback, options ?? null));
|
|
341
|
+
}
|
|
342
|
+
function signOrderWithEip1193(input, chainId, owner, requestCallback, options) {
|
|
343
|
+
return (0, internal_js_1.callAsync)(() => raw.signOrderWithEip1193(input, chainId, owner, requestCallback, options ?? null));
|
|
344
|
+
}
|
|
345
|
+
function signOrderWithEip1271(input, chainId, owner, typedDataSigner, options) {
|
|
346
|
+
return (0, internal_js_1.callAsync)(() => raw.signOrderWithEip1271(input, chainId, owner, typedDataSigner, options ?? null));
|
|
347
|
+
}
|
|
348
|
+
function signOrderWithTypedDataSigner(input, chainId, owner, typedDataSigner, options) {
|
|
349
|
+
return (0, internal_js_1.callAsync)(() => raw.signOrderWithTypedDataSigner(input, chainId, owner, typedDataSigner, options ?? null));
|
|
350
|
+
}
|
|
351
|
+
function supportedChainIds() {
|
|
352
|
+
return (0, internal_js_1.callSync)(() => raw.supportedChainIds());
|
|
353
|
+
}
|
|
354
|
+
function validateAppDataDoc(doc) {
|
|
355
|
+
return (0, internal_js_1.callSync)(() => raw.validateAppDataDoc(doc));
|
|
356
|
+
}
|
|
357
|
+
function wasmVersion() {
|
|
358
|
+
return (0, internal_js_1.callSync)(() => raw.wasmVersion());
|
|
359
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/// <reference lib="esnext.disposable" />
|
|
2
|
+
import * as raw from "./raw/default.js";
|
|
3
|
+
import type { WasmEnvelope } from "./envelope.js";
|
|
4
|
+
import type { CommonClientConfig, IpfsClientConfig, SdkClientOptions, SigningOptions, SubgraphClientConfig, TradingClientConfig } from "./options.js";
|
|
5
|
+
import type { ContractReadCallback, CustomEip1271Callback, DigestSignerCallback, Eip1193RequestCallback, TypedDataSignerCallback } from "./callbacks.js";
|
|
6
|
+
export interface OrderBookClientConfig extends CommonClientConfig {
|
|
7
|
+
}
|
|
8
|
+
export declare class IpfsClient {
|
|
9
|
+
#private;
|
|
10
|
+
constructor(config: IpfsClientConfig);
|
|
11
|
+
fetchAppDataFromCid(cid: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<raw.AppDataDocDto>>;
|
|
12
|
+
fetchAppDataFromHex(appDataHex: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<raw.AppDataDocDto>>;
|
|
13
|
+
dispose(): void;
|
|
14
|
+
[Symbol.dispose](): void;
|
|
15
|
+
}
|
|
16
|
+
export declare class OrderBookClient {
|
|
17
|
+
#private;
|
|
18
|
+
constructor(config: OrderBookClientConfig);
|
|
19
|
+
cancelOrders(signed: raw.SignedCancellationsInput, options?: SdkClientOptions | null): Promise<WasmEnvelope<{
|
|
20
|
+
cancelled: true;
|
|
21
|
+
}>>;
|
|
22
|
+
getNativePrice(token: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<raw.NativePriceResponseDto>>;
|
|
23
|
+
getOrder(orderUid: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<raw.OrderDto>>;
|
|
24
|
+
getOrders(owner: string, pagination?: raw.PaginationOptions | null, options?: SdkClientOptions | null): Promise<WasmEnvelope<raw.OrderDto[]>>;
|
|
25
|
+
getOrderMultiEnv(orderUid: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<raw.OrderDto>>;
|
|
26
|
+
getTxOrders(txHash: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<raw.OrderDto[]>>;
|
|
27
|
+
getVersion(options?: SdkClientOptions | null): Promise<WasmEnvelope<string>>;
|
|
28
|
+
getOrderLink(orderUid: string): WasmEnvelope<string>;
|
|
29
|
+
getQuote(request: raw.OrderQuoteRequestInput, options?: SdkClientOptions | null): Promise<WasmEnvelope<raw.OrderQuoteResponseDto>>;
|
|
30
|
+
getTrades(query: raw.TradesQueryInput, options?: SdkClientOptions | null): Promise<WasmEnvelope<raw.TradeDto[]>>;
|
|
31
|
+
getOrderCompetitionStatus(orderUid: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<raw.CompetitionOrderStatusDto>>;
|
|
32
|
+
getTotalSurplus(owner: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<raw.TotalSurplusDto>>;
|
|
33
|
+
getAppData(appDataHash: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<raw.AppDataObjectDto>>;
|
|
34
|
+
uploadAppData(appDataHash: string, fullAppData: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<{
|
|
35
|
+
uploaded: true;
|
|
36
|
+
}>>;
|
|
37
|
+
sendOrder(signed: raw.SignedOrderDto, options?: SdkClientOptions | null): Promise<WasmEnvelope<string>>;
|
|
38
|
+
sendOrderCreation(input: raw.OrderCreationInput, options?: SdkClientOptions | null): Promise<WasmEnvelope<string>>;
|
|
39
|
+
dispose(): void;
|
|
40
|
+
[Symbol.dispose](): void;
|
|
41
|
+
}
|
|
42
|
+
export declare class SubgraphClient {
|
|
43
|
+
#private;
|
|
44
|
+
constructor(config: SubgraphClientConfig);
|
|
45
|
+
getLastDaysVolume(days: number, options?: SdkClientOptions | null): Promise<WasmEnvelope<unknown>>;
|
|
46
|
+
getLastHoursVolume(hours: number, options?: SdkClientOptions | null): Promise<WasmEnvelope<unknown>>;
|
|
47
|
+
getTotals(options?: SdkClientOptions | null): Promise<WasmEnvelope<unknown>>;
|
|
48
|
+
runQuery(request: raw.SubgraphQueryInput, options?: SdkClientOptions | null): Promise<WasmEnvelope<unknown>>;
|
|
49
|
+
dispose(): void;
|
|
50
|
+
[Symbol.dispose](): void;
|
|
51
|
+
}
|
|
52
|
+
export declare class TradingClient {
|
|
53
|
+
#private;
|
|
54
|
+
constructor(config: TradingClientConfig);
|
|
55
|
+
buildSellNativeCurrencyTx(order: raw.OrderInput, quoteId: number, from: string, options?: SdkClientOptions | null): Promise<WasmEnvelope<raw.BuiltSellNativeCurrencyTxDto>>;
|
|
56
|
+
getCowProtocolAllowance(params: raw.AllowanceParametersInput, readContractCallback: ContractReadCallback, options?: SdkClientOptions | null): Promise<WasmEnvelope<string>>;
|
|
57
|
+
buildApprovalTx(params: raw.ApprovalParametersInput, options?: SdkClientOptions | null): Promise<WasmEnvelope<raw.TransactionRequestDto>>;
|
|
58
|
+
getQuote(params: raw.SwapParametersInput, options?: SdkClientOptions | null): Promise<WasmEnvelope<raw.QuoteResultsDto>>;
|
|
59
|
+
postLimitOrder(params: raw.LimitTradeParametersInput, owner: string, signerCallback: TypedDataSignerCallback, options?: SigningOptions | null): Promise<WasmEnvelope<raw.OrderPostingResultDto>>;
|
|
60
|
+
postSwapOrder(params: raw.SwapParametersInput, owner: string, signerCallback: TypedDataSignerCallback, options?: SigningOptions | null): Promise<WasmEnvelope<raw.OrderPostingResultDto>>;
|
|
61
|
+
postSwapOrderFromQuote(quoteResults: raw.QuoteResultsDto, owner: string, signerCallback: TypedDataSignerCallback, options?: SigningOptions | null): Promise<WasmEnvelope<raw.OrderPostingResultDto>>;
|
|
62
|
+
postSwapOrderWithEip1271(params: raw.SwapParametersInput, owner: string, customCallback: CustomEip1271Callback, options?: SigningOptions | null): Promise<WasmEnvelope<raw.OrderPostingResultDto>>;
|
|
63
|
+
dispose(): void;
|
|
64
|
+
[Symbol.dispose](): void;
|
|
65
|
+
}
|
|
66
|
+
export declare function appDataDoc(doc: raw.AppDataDocInput): WasmEnvelope<raw.AppDataDocDto>;
|
|
67
|
+
export declare function appDataHexToCid(appDataHex: string): WasmEnvelope<string>;
|
|
68
|
+
export declare function appDataInfo(doc: raw.AppDataDocInput): WasmEnvelope<raw.AppDataInfoDto>;
|
|
69
|
+
export declare function buildCancelOrderTx(params: raw.OrderTraderParametersInput): WasmEnvelope<raw.TransactionRequestDto>;
|
|
70
|
+
export declare function buildPresignTx(params: raw.OrderTraderParametersInput): WasmEnvelope<raw.TransactionRequestDto>;
|
|
71
|
+
export declare function cidToAppDataHex(cid: string): WasmEnvelope<string>;
|
|
72
|
+
export declare function computeOrderUid(input: raw.OrderInput, chainId: number, owner: string): WasmEnvelope<raw.GeneratedOrderUidDto>;
|
|
73
|
+
export declare function decodeEthFlowLog(log: raw.EventLogInput): WasmEnvelope<raw.EthFlowEventDto>;
|
|
74
|
+
export declare function decodeSettlementLog(log: raw.EventLogInput): WasmEnvelope<raw.SettlementEventDto>;
|
|
75
|
+
export declare function deploymentAddresses(chainId: number, env?: string | null): WasmEnvelope<raw.DeploymentAddressesDto>;
|
|
76
|
+
export declare function domainSeparator(chainId: number): string;
|
|
77
|
+
export declare function eip1271SignaturePayload(input: raw.OrderInput, ecdsaSignature: string): WasmEnvelope<string>;
|
|
78
|
+
export declare function orderTypedData(input: raw.OrderInput, chainId: number): WasmEnvelope<raw.TypedDataEnvelopeDto>;
|
|
79
|
+
export declare function signCancellationEthSignDigest(orderUids: string[], chainId: number, digestSigner: DigestSignerCallback, options?: SigningOptions | null): Promise<WasmEnvelope<raw.SignedCancellationsInput>>;
|
|
80
|
+
export declare function signCancellationWithEip1193(orderUids: string[], chainId: number, owner: string, requestCallback: Eip1193RequestCallback, options?: SigningOptions | null): Promise<WasmEnvelope<raw.SignedCancellationsInput>>;
|
|
81
|
+
export declare function signCancellationWithTypedDataSigner(orderUids: string[], chainId: number, typedDataSigner: TypedDataSignerCallback, options?: SigningOptions | null): Promise<WasmEnvelope<raw.SignedCancellationsInput>>;
|
|
82
|
+
export declare function signOrderEthSignDigest(input: raw.OrderInput, chainId: number, owner: string, digestSigner: DigestSignerCallback, options?: SigningOptions | null): Promise<WasmEnvelope<raw.SignedOrderDto>>;
|
|
83
|
+
export declare function signOrderWithCustomEip1271(input: raw.OrderInput, chainId: number, owner: string, customCallback: CustomEip1271Callback, options?: SigningOptions | null): Promise<WasmEnvelope<raw.SignedOrderDto>>;
|
|
84
|
+
export declare function signOrderWithEip1193(input: raw.OrderInput, chainId: number, owner: string, requestCallback: Eip1193RequestCallback, options?: SigningOptions | null): Promise<WasmEnvelope<raw.SignedOrderDto>>;
|
|
85
|
+
export declare function signOrderWithEip1271(input: raw.OrderInput, chainId: number, owner: string, typedDataSigner: TypedDataSignerCallback, options?: SigningOptions | null): Promise<WasmEnvelope<raw.SignedOrderDto>>;
|
|
86
|
+
export declare function signOrderWithTypedDataSigner(input: raw.OrderInput, chainId: number, owner: string, typedDataSigner: TypedDataSignerCallback, options?: SigningOptions | null): Promise<WasmEnvelope<raw.SignedOrderDto>>;
|
|
87
|
+
export declare function supportedChainIds(): Uint32Array;
|
|
88
|
+
export declare function validateAppDataDoc(doc: raw.AppDataDocInput): WasmEnvelope<raw.ValidationResultDto>;
|
|
89
|
+
export declare function wasmVersion(): string;
|
|
90
|
+
export type { AllowanceParametersInput, AmountsDto, AppDataDocDto, AppDataDocInput, AppDataInfoDto, AppDataObjectDto, ApprovalParametersInput, BuiltSellNativeCurrencyTxDto, CompetitionOrderStatusDto, CompetitionOrderStatusKindDto, ContractCallDto, CostsDto, CowEip1271SignRequest, CowEnvDto, DeploymentAddressesDto, Eip1193Request, EthFlowEventDto, EthflowDataDto, EventLogInput, ExecutedAmountsDto, ExecutedProtocolFeeDto, FeeComponentDto, GeneratedOrderUidDto, InteractionDataDto, LimitTradeParametersInput, NativePriceResponseDto, NetworkFeeDto, OnchainOrderDataDto, OrderClassDto, OrderCreationInput, OrderDataDto, OrderDto, OrderInput, OrderInteractionsDto, OrderKindDto, OrderPostingResultDto, OrderQuoteRequestInput, OrderQuoteResponseDto, OrderStatusDto, OrderTraderParametersInput, OrderBookRuntimeBindingDto, PaginationOptions, PartnerFeeDto, PartnerFeeInput, PartnerFeePolicyDto, PartnerFeePolicyInput, QuoteAmountsAndCostsDto, QuoteDataDto, QuoteResultsDto, SettlementEventDto, SignedCancellationsInput, SignedOrderDto, SigningSchemeDto, SolverExecutionDto, StoredOrderQuoteDto, SubgraphQueryInput, SwapParametersInput, TokenBalanceDto, TotalSurplusDto, TradeDto, TradeParametersDto, TradesQueryInput, TradingAppDataInfoDto, TransactionRequestDto, TypedDataDomainDto, TypedDataEnvelopeDto, TypedDataFieldDto, ValidationResultDto } from "./raw/default.js";
|
|
91
|
+
export type { ContractReadCallback, CowEip1271SignCallback, CowEnv, CustomEip1271Callback, DigestSignerCallback, Eip1193RequestCallback, TypedDataSignerCallback } from "./callbacks.js";
|
|
92
|
+
export type { OrderBookRejectionCategory, CowError } from "./errors.js";
|
|
93
|
+
export type { SchemaVersion, WasmEnvelope } from "./envelope.js";
|
|
94
|
+
export type { CowFetchCallback, CowFetchRequest, CowFetchResponse, HttpTransportConfig, IpfsClientConfig, JitterStrategyConfig, LimiterScopeConfig, RequestRateLimiterConfig, RetryPolicyConfig, SdkClientOptions, SigningOptions, SubgraphClientConfig, TradingClientConfig, TransportPolicyConfig, WalletConfig } from "./options.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./default.js";
|