@clober/v2-sdk 0.0.2-b → 0.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.
Files changed (43) hide show
  1. package/dist/cjs/.graphclient/index.js +243 -0
  2. package/dist/cjs/.graphclient/index.js.map +1 -0
  3. package/dist/cjs/.graphclient/sources/clober-v2/introspectionSchema.js +14485 -0
  4. package/dist/cjs/.graphclient/sources/clober-v2/introspectionSchema.js.map +1 -0
  5. package/dist/cjs/.graphclient/sources/clober-v2/types.js +4 -0
  6. package/dist/cjs/.graphclient/sources/clober-v2/types.js.map +1 -0
  7. package/dist/cjs/apis/market.js +16 -10
  8. package/dist/cjs/apis/market.js.map +1 -1
  9. package/dist/cjs/apis/open-order.js +12 -12
  10. package/dist/cjs/apis/open-order.js.map +1 -1
  11. package/dist/cjs/model/book.js.map +1 -1
  12. package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
  13. package/dist/esm/.graphclient/index.js +233 -0
  14. package/dist/esm/.graphclient/index.js.map +1 -0
  15. package/dist/esm/.graphclient/sources/clober-v2/introspectionSchema.js +14483 -0
  16. package/dist/esm/.graphclient/sources/clober-v2/introspectionSchema.js.map +1 -0
  17. package/dist/esm/.graphclient/sources/clober-v2/types.js +3 -0
  18. package/dist/esm/.graphclient/sources/clober-v2/types.js.map +1 -0
  19. package/dist/esm/apis/market.js +16 -10
  20. package/dist/esm/apis/market.js.map +1 -1
  21. package/dist/esm/apis/open-order.js +12 -12
  22. package/dist/esm/apis/open-order.js.map +1 -1
  23. package/dist/esm/model/book.js.map +1 -1
  24. package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
  25. package/dist/types/.graphclient/index.d.ts +1281 -0
  26. package/dist/types/.graphclient/index.d.ts.map +1 -0
  27. package/dist/types/.graphclient/sources/clober-v2/introspectionSchema.d.ts +3 -0
  28. package/dist/types/.graphclient/sources/clober-v2/introspectionSchema.d.ts.map +1 -0
  29. package/dist/types/.graphclient/sources/clober-v2/types.d.ts +984 -0
  30. package/dist/types/.graphclient/sources/clober-v2/types.d.ts.map +1 -0
  31. package/dist/types/apis/market.d.ts.map +1 -1
  32. package/dist/types/apis/open-order.d.ts.map +1 -1
  33. package/dist/types/model/book.d.ts +0 -21
  34. package/dist/types/model/book.d.ts.map +1 -1
  35. package/dist/types/model/open-order.d.ts +0 -26
  36. package/dist/types/model/open-order.d.ts.map +1 -1
  37. package/package.json +12 -4
  38. package/dist/cjs/apis/subgraph.js +0 -26
  39. package/dist/cjs/apis/subgraph.js.map +0 -1
  40. package/dist/esm/apis/subgraph.js +0 -22
  41. package/dist/esm/apis/subgraph.js.map +0 -1
  42. package/dist/types/apis/subgraph.d.ts +0 -3
  43. package/dist/types/apis/subgraph.d.ts.map +0 -1
@@ -0,0 +1,233 @@
1
+ import { gql } from '@graphql-mesh/utils';
2
+ import { PubSub } from '@graphql-mesh/utils';
3
+ import { DefaultLogger } from '@graphql-mesh/utils';
4
+ import MeshCache from "@graphql-mesh/cache-localforage";
5
+ import { fetch as fetchFn } from '@whatwg-node/fetch';
6
+ import GraphqlHandler from "@graphql-mesh/graphql";
7
+ import BareMerger from "@graphql-mesh/merger-bare";
8
+ import { printWithCache } from '@graphql-mesh/utils';
9
+ import { createMeshHTTPHandler } from '@graphql-mesh/http';
10
+ import { getMesh } from '@graphql-mesh/runtime';
11
+ import { MeshStore, FsStoreStorageAdapter } from '@graphql-mesh/store';
12
+ import { path as pathModule } from '@graphql-mesh/cross-helpers';
13
+ import * as importedModule$0 from "./sources/clober-v2/introspectionSchema";
14
+ const baseDir = pathModule.join(typeof __dirname === 'string' ? __dirname : '/', '..');
15
+ const importFn = (moduleId) => {
16
+ const relativeModuleId = (pathModule.isAbsolute(moduleId) ? pathModule.relative(baseDir, moduleId) : moduleId).split('\\').join('/').replace(baseDir + '/', '');
17
+ switch (relativeModuleId) {
18
+ case ".graphclient/sources/clober-v2/introspectionSchema":
19
+ return Promise.resolve(importedModule$0);
20
+ default:
21
+ return Promise.reject(new Error(`Cannot find module '${relativeModuleId}'.`));
22
+ }
23
+ };
24
+ const rootStore = new MeshStore('.graphclient', new FsStoreStorageAdapter({
25
+ cwd: baseDir,
26
+ importFn,
27
+ fileType: "ts",
28
+ }), {
29
+ readonly: true,
30
+ validate: false
31
+ });
32
+ export const rawServeConfig = undefined;
33
+ export async function getMeshOptions() {
34
+ const pubsub = new PubSub();
35
+ const sourcesStore = rootStore.child('sources');
36
+ const logger = new DefaultLogger("GraphClient");
37
+ const cache = new MeshCache({
38
+ ...{},
39
+ importFn,
40
+ store: rootStore.child('cache'),
41
+ pubsub,
42
+ logger,
43
+ });
44
+ const sources = [];
45
+ const transforms = [];
46
+ const additionalEnvelopPlugins = [];
47
+ const cloberV2Transforms = [];
48
+ const additionalTypeDefs = [];
49
+ const cloberV2Handler = new GraphqlHandler({
50
+ name: "clober-v2",
51
+ config: { "endpoint": "{context.url:https://subgraph.satsuma-prod.com/f6a8c4889b7b/clober/v2-core-subgraph/api}" },
52
+ baseDir,
53
+ cache,
54
+ pubsub,
55
+ store: sourcesStore.child("clober-v2"),
56
+ logger: logger.child("clober-v2"),
57
+ importFn,
58
+ });
59
+ sources[0] = {
60
+ name: 'clober-v2',
61
+ handler: cloberV2Handler,
62
+ transforms: cloberV2Transforms
63
+ };
64
+ const additionalResolvers = [];
65
+ const merger = new BareMerger({
66
+ cache,
67
+ pubsub,
68
+ logger: logger.child('bareMerger'),
69
+ store: rootStore.child('bareMerger')
70
+ });
71
+ return {
72
+ sources,
73
+ transforms,
74
+ additionalTypeDefs,
75
+ additionalResolvers,
76
+ cache,
77
+ pubsub,
78
+ merger,
79
+ logger,
80
+ additionalEnvelopPlugins,
81
+ get documents() {
82
+ return [
83
+ {
84
+ document: GetBooksDocument,
85
+ get rawSDL() {
86
+ return printWithCache(GetBooksDocument);
87
+ },
88
+ location: 'GetBooksDocument.graphql'
89
+ }, {
90
+ document: GetOpenOrderDocument,
91
+ get rawSDL() {
92
+ return printWithCache(GetOpenOrderDocument);
93
+ },
94
+ location: 'GetOpenOrderDocument.graphql'
95
+ }, {
96
+ document: GetOpenOrdersDocument,
97
+ get rawSDL() {
98
+ return printWithCache(GetOpenOrdersDocument);
99
+ },
100
+ location: 'GetOpenOrdersDocument.graphql'
101
+ }
102
+ ];
103
+ },
104
+ fetchFn,
105
+ };
106
+ }
107
+ export function createBuiltMeshHTTPHandler() {
108
+ return createMeshHTTPHandler({
109
+ baseDir,
110
+ getBuiltMesh: getBuiltGraphClient,
111
+ rawServeConfig: undefined,
112
+ });
113
+ }
114
+ let meshInstance$;
115
+ export function getBuiltGraphClient() {
116
+ if (meshInstance$ == null) {
117
+ meshInstance$ = getMeshOptions().then(meshOptions => getMesh(meshOptions)).then(mesh => {
118
+ const id = mesh.pubsub.subscribe('destroy', () => {
119
+ meshInstance$ = undefined;
120
+ mesh.pubsub.unsubscribe(id);
121
+ });
122
+ return mesh;
123
+ });
124
+ }
125
+ return meshInstance$;
126
+ }
127
+ export const execute = (...args) => getBuiltGraphClient().then(({ execute }) => execute(...args));
128
+ export const subscribe = (...args) => getBuiltGraphClient().then(({ subscribe }) => subscribe(...args));
129
+ export function getBuiltGraphSDK(globalContext) {
130
+ const sdkRequester$ = getBuiltGraphClient().then(({ sdkRequesterFactory }) => sdkRequesterFactory(globalContext));
131
+ return getSdk((...args) => sdkRequester$.then(sdkRequester => sdkRequester(...args)));
132
+ }
133
+ export const getBooksDocument = gql `
134
+ query getBooks($baseTokenAddress: String!, $quoteTokenAddress: String!) {
135
+ books(
136
+ where: {base: $baseTokenAddress, quote: $quoteTokenAddress, makerPolicy: "8888308", takerPolicy: "8889608", hooks: "0x0000000000000000000000000000000000000000"}
137
+ ) {
138
+ id
139
+ base {
140
+ id
141
+ name
142
+ symbol
143
+ decimals
144
+ }
145
+ quote {
146
+ id
147
+ name
148
+ symbol
149
+ decimals
150
+ }
151
+ unit
152
+ depths {
153
+ tick
154
+ price
155
+ rawAmount
156
+ }
157
+ }
158
+ }
159
+ `;
160
+ export const getOpenOrderDocument = gql `
161
+ query getOpenOrder($orderId: ID!) {
162
+ openOrder(id: $orderId) {
163
+ id
164
+ book {
165
+ id
166
+ base {
167
+ id
168
+ name
169
+ symbol
170
+ decimals
171
+ }
172
+ quote {
173
+ id
174
+ name
175
+ symbol
176
+ decimals
177
+ }
178
+ unit
179
+ }
180
+ tick
181
+ txHash
182
+ createdAt
183
+ rawAmount
184
+ rawFilledAmount
185
+ rawClaimedAmount
186
+ rawClaimableAmount
187
+ }
188
+ }
189
+ `;
190
+ export const getOpenOrdersDocument = gql `
191
+ query getOpenOrders($userAddress: String!) {
192
+ openOrders(where: {user: $userAddress}) {
193
+ id
194
+ book {
195
+ id
196
+ base {
197
+ id
198
+ name
199
+ symbol
200
+ decimals
201
+ }
202
+ quote {
203
+ id
204
+ name
205
+ symbol
206
+ decimals
207
+ }
208
+ unit
209
+ }
210
+ tick
211
+ txHash
212
+ createdAt
213
+ rawAmount
214
+ rawFilledAmount
215
+ rawClaimedAmount
216
+ rawClaimableAmount
217
+ }
218
+ }
219
+ `;
220
+ export function getSdk(requester) {
221
+ return {
222
+ getBooks(variables, options) {
223
+ return requester(getBooksDocument, variables, options);
224
+ },
225
+ getOpenOrder(variables, options) {
226
+ return requester(getOpenOrderDocument, variables, options);
227
+ },
228
+ getOpenOrders(variables, options) {
229
+ return requester(getOpenOrdersDocument, variables, options);
230
+ }
231
+ };
232
+ }
233
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/.graphclient/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAI1C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,SAAS,MAAM,iCAAiC,CAAC;AACxD,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,oBAAoB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