mainnet-js 1.1.34-alpha.1 → 2.0.0

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 (121) hide show
  1. package/dist/index.html +1 -1
  2. package/dist/{mainnet-1.1.34-alpha.1.js → mainnet-2.0.0.js} +26 -338
  3. package/dist/module/db/SqlProvider.d.ts +2 -2
  4. package/dist/module/db/SqlProvider.d.ts.map +1 -1
  5. package/dist/module/db/SqlProvider.js +6 -24
  6. package/dist/module/db/SqlProvider.js.map +1 -1
  7. package/dist/module/index.d.ts +0 -3
  8. package/dist/module/index.d.ts.map +1 -1
  9. package/dist/module/index.js +3 -6
  10. package/dist/module/index.js.map +1 -1
  11. package/dist/module/transaction/Wif.d.ts +4 -8
  12. package/dist/module/transaction/Wif.d.ts.map +1 -1
  13. package/dist/module/transaction/Wif.js +6 -10
  14. package/dist/module/transaction/Wif.js.map +1 -1
  15. package/dist/module/util/deriveCashaddr.d.ts +1 -0
  16. package/dist/module/util/deriveCashaddr.d.ts.map +1 -1
  17. package/dist/module/util/deriveCashaddr.js +8 -1
  18. package/dist/module/util/deriveCashaddr.js.map +1 -1
  19. package/dist/module/wallet/Base.d.ts +1 -1
  20. package/dist/module/wallet/Base.js +1 -1
  21. package/dist/module/wallet/Bcmr.d.ts.map +1 -1
  22. package/dist/module/wallet/Bcmr.js +0 -1
  23. package/dist/module/wallet/Bcmr.js.map +1 -1
  24. package/dist/module/wallet/Util.d.ts +2 -2
  25. package/dist/module/wallet/Util.js +2 -2
  26. package/dist/module/wallet/Wif.d.ts +0 -28
  27. package/dist/module/wallet/Wif.d.ts.map +1 -1
  28. package/dist/module/wallet/Wif.js +2 -109
  29. package/dist/module/wallet/Wif.js.map +1 -1
  30. package/dist/module/wallet/createWallet.d.ts +0 -12
  31. package/dist/module/wallet/createWallet.d.ts.map +1 -1
  32. package/dist/module/wallet/createWallet.js +0 -43
  33. package/dist/module/wallet/createWallet.js.map +1 -1
  34. package/dist/module/wallet/interface.d.ts +0 -2
  35. package/dist/module/wallet/interface.d.ts.map +1 -1
  36. package/dist/module/webhook/Webhook.d.ts +1 -6
  37. package/dist/module/webhook/Webhook.d.ts.map +1 -1
  38. package/dist/module/webhook/Webhook.js +0 -4
  39. package/dist/module/webhook/Webhook.js.map +1 -1
  40. package/dist/module/webhook/index.d.ts +0 -1
  41. package/dist/module/webhook/index.d.ts.map +1 -1
  42. package/dist/module/webhook/index.js +0 -1
  43. package/dist/module/webhook/index.js.map +1 -1
  44. package/dist/module/webhook/interface.d.ts +0 -1
  45. package/dist/module/webhook/interface.d.ts.map +1 -1
  46. package/dist/tsconfig.tsbuildinfo +1 -1
  47. package/package.json +5 -10
  48. package/src/db/SqlProvider.test.ts +2 -18
  49. package/src/db/SqlProvider.ts +5 -26
  50. package/src/index.ts +3 -7
  51. package/src/transaction/Wif.ts +2 -19
  52. package/src/util/deriveCashaddr.test.ts +8 -0
  53. package/src/util/deriveCashaddr.ts +9 -0
  54. package/src/wallet/Base.ts +1 -1
  55. package/src/wallet/Bcmr.ts +0 -1
  56. package/src/wallet/Util.ts +2 -2
  57. package/src/wallet/Wif.test.ts +0 -23
  58. package/src/wallet/Wif.ts +2 -148
  59. package/src/wallet/createWallet.ts +0 -53
  60. package/src/wallet/interface.ts +0 -2
  61. package/src/webhook/Webhook.ts +4 -10
  62. package/src/webhook/index.ts +0 -1
  63. package/src/webhook/interface.ts +0 -1
  64. package/webpack.config.cjs +7 -7
  65. package/dist/module/slp/GsppProvider.d.ts +0 -55
  66. package/dist/module/slp/GsppProvider.d.ts.map +0 -1
  67. package/dist/module/slp/GsppProvider.js +0 -204
  68. package/dist/module/slp/GsppProvider.js.map +0 -1
  69. package/dist/module/slp/SlpDbProvider.d.ts +0 -52
  70. package/dist/module/slp/SlpDbProvider.d.ts.map +0 -1
  71. package/dist/module/slp/SlpDbProvider.js +0 -175
  72. package/dist/module/slp/SlpDbProvider.js.map +0 -1
  73. package/dist/module/slp/SlpDbTemplates.d.ts +0 -313
  74. package/dist/module/slp/SlpDbTemplates.d.ts.map +0 -1
  75. package/dist/module/slp/SlpDbTemplates.js +0 -375
  76. package/dist/module/slp/SlpDbTemplates.js.map +0 -1
  77. package/dist/module/slp/SlpLibAuth.d.ts +0 -210
  78. package/dist/module/slp/SlpLibAuth.d.ts.map +0 -1
  79. package/dist/module/slp/SlpLibAuth.js +0 -451
  80. package/dist/module/slp/SlpLibAuth.js.map +0 -1
  81. package/dist/module/slp/SlpProvider.d.ts +0 -24
  82. package/dist/module/slp/SlpProvider.d.ts.map +0 -1
  83. package/dist/module/slp/SlpProvider.js +0 -29
  84. package/dist/module/slp/SlpProvider.js.map +0 -1
  85. package/dist/module/slp/index.d.ts +0 -6
  86. package/dist/module/slp/index.d.ts.map +0 -1
  87. package/dist/module/slp/index.js +0 -5
  88. package/dist/module/slp/index.js.map +0 -1
  89. package/dist/module/slp/interface.d.ts +0 -114
  90. package/dist/module/slp/interface.d.ts.map +0 -1
  91. package/dist/module/slp/interface.js +0 -7
  92. package/dist/module/slp/interface.js.map +0 -1
  93. package/dist/module/util/bchaddr.d.ts +0 -2
  94. package/dist/module/util/bchaddr.d.ts.map +0 -1
  95. package/dist/module/util/bchaddr.js +0 -16
  96. package/dist/module/util/bchaddr.js.map +0 -1
  97. package/dist/module/wallet/Slp.d.ts +0 -431
  98. package/dist/module/wallet/Slp.d.ts.map +0 -1
  99. package/dist/module/wallet/Slp.js +0 -770
  100. package/dist/module/wallet/Slp.js.map +0 -1
  101. package/dist/module/webhook/WebhookSlp.d.ts +0 -15
  102. package/dist/module/webhook/WebhookSlp.d.ts.map +0 -1
  103. package/dist/module/webhook/WebhookSlp.js +0 -100
  104. package/dist/module/webhook/WebhookSlp.js.map +0 -1
  105. package/src/slp/GsppProvider.test.ts +0 -40
  106. package/src/slp/GsppProvider.ts +0 -329
  107. package/src/slp/SlpDbProvider.test.ts +0 -27
  108. package/src/slp/SlpDbProvider.ts +0 -291
  109. package/src/slp/SlpDbTemplates.ts +0 -400
  110. package/src/slp/SlpLibAuth.test.ts +0 -162
  111. package/src/slp/SlpLibAuth.ts +0 -532
  112. package/src/slp/SlpProvider.ts +0 -100
  113. package/src/slp/index.ts +0 -6
  114. package/src/slp/interface.ts +0 -128
  115. package/src/util/bchaddr.test.ts +0 -27
  116. package/src/util/bchaddr.ts +0 -27
  117. package/src/wallet/Slp.test.headless.js +0 -120
  118. package/src/wallet/Slp.test.ts +0 -1000
  119. package/src/wallet/Slp.ts +0 -1014
  120. package/src/webhook/WebhookSlp.test.ts +0 -288
  121. package/src/webhook/WebhookSlp.ts +0 -123
@@ -1,175 +0,0 @@
1
- import { Network } from "../interface.js";
2
- import { SlpAllUtxosTemplate, SlpAddressTransactionHistoryTemplate, SlpWaitForTransactionTemplate, SlpBatonUtxosTemplate, SlpSpendableUtxosTemplate, SlpTokenInfoTemplate, SlpAllTokenBalancesTemplate, SlpTokenBalanceTemplate, SlpAllOutpointsTemplate, } from "./SlpDbTemplates.js";
3
- import BigNumber from "bignumber.js";
4
- import { _convertBalanceBigNumbers, _convertSlpTokenInfo, _convertUtxoBigNumbers, _emptyTokenBalance, } from "./SlpProvider.js";
5
- import axios from "axios";
6
- import { btoa } from "../util/base64.js";
7
- //import EventSource from "../../polyfill/eventsource.js";
8
- import EventSource from "../util/eventsource.js";
9
- import { getRuntimePlatform, RuntimePlatform, } from "../util/getRuntimePlatform.js";
10
- export class SlpDbProvider {
11
- constructor(network = Network.MAINNET) {
12
- this.network = network;
13
- this.servers = { ...SlpDbProvider.defaultServers };
14
- this.caching = false;
15
- if (getRuntimePlatform() === RuntimePlatform.node) {
16
- if (process.env.SLPDB_MAINNET_DATA)
17
- this.servers.mainnet.dataSource = process.env.SLPDB_MAINNET_DATA;
18
- if (process.env.SLPDB_MAINNET_EVENTS)
19
- this.servers.mainnet.eventSource = process.env.SLPDB_MAINNET_EVENTS;
20
- if (process.env.SLPDB_TESTNET_DATA)
21
- this.servers.testnet.dataSource = process.env.SLPDB_TESTNET_DATA;
22
- if (process.env.SLPDB_TESTNET_EVENTS)
23
- this.servers.testnet.eventSource = process.env.SLPDB_TESTNET_EVENTS;
24
- if (process.env.SLPDB_REGTEST_DATA)
25
- this.servers.regtest.dataSource = process.env.SLPDB_REGTEST_DATA;
26
- if (process.env.SLPDB_REGTEST_EVENTS)
27
- this.servers.regtest.eventSource = process.env.SLPDB_REGTEST_EVENTS;
28
- }
29
- }
30
- // all oupoints, including mint batons
31
- async SlpOutpoints(slpaddr) {
32
- return (await this.SlpDbQuery(SlpAllOutpointsTemplate(slpaddr)))
33
- .g;
34
- }
35
- // all utxos, including mint batons
36
- async SlpUtxos(slpaddr) {
37
- return _convertUtxoBigNumbers((await this.SlpDbQuery(SlpAllUtxosTemplate(slpaddr))).g);
38
- }
39
- // look up the token information
40
- async SlpTokenInfo(tokenId) {
41
- const infos = (await this.SlpDbQuery(SlpTokenInfoTemplate(tokenId)))
42
- .t;
43
- return _convertSlpTokenInfo(infos[0]);
44
- }
45
- // safe-spendable token utxos, without baton
46
- async SlpSpendableUtxos(slpaddr, tokenId) {
47
- return _convertUtxoBigNumbers((await this.SlpDbQuery(SlpSpendableUtxosTemplate(slpaddr, tokenId)))
48
- .g);
49
- }
50
- // token mint baton utxos
51
- async SlpBatonUtxos(slpaddr, tokenId) {
52
- return _convertUtxoBigNumbers((await this.SlpDbQuery(SlpBatonUtxosTemplate(slpaddr, tokenId)))
53
- .g);
54
- }
55
- // get all token balances
56
- async SlpAllTokenBalances(slpaddr) {
57
- return _convertBalanceBigNumbers((await this.SlpDbQuery(SlpAllTokenBalancesTemplate(slpaddr)))
58
- .g);
59
- }
60
- // get specific token balance
61
- async SlpTokenBalance(slpaddr, tokenId) {
62
- const balances = _convertBalanceBigNumbers((await this.SlpDbQuery(SlpTokenBalanceTemplate(slpaddr, tokenId)))
63
- .g);
64
- return balances[0] || _emptyTokenBalance(tokenId);
65
- }
66
- // get all slp transactions of this address
67
- async SlpAddressTransactionHistory(slpaddr, tokenId, limit = 100, skip = 0) {
68
- const response = await this.SlpDbQuery(SlpAddressTransactionHistoryTemplate(slpaddr, tokenId, limit, skip));
69
- return response.c.concat(response.u);
70
- }
71
- // waits for next slp transaction to appear in mempool, code execution is halted
72
- async SlpWaitForTransaction(slpaddr, tokenId) {
73
- return new Promise(async (resolve) => {
74
- const cancelFn = this.SlpWatchTransactions(async (tx) => {
75
- await cancelFn();
76
- resolve(tx);
77
- }, slpaddr, tokenId);
78
- });
79
- }
80
- // waits for a certain slp token balance to be available in this wallet, code execution is halted
81
- async SlpWaitForBalance(value, slpaddr, tokenId) {
82
- return new Promise((resolve) => {
83
- const cancelFn = this.SlpWatchBalance(async (balance) => {
84
- if (balance.value.isGreaterThanOrEqualTo(new BigNumber(value))) {
85
- await cancelFn();
86
- resolve(balance);
87
- }
88
- }, slpaddr, tokenId);
89
- });
90
- }
91
- // set's up a callback to be executed each time the token balance of the wallet is changed
92
- SlpWatchBalance(callback, slpaddr, tokenId) {
93
- return this.SlpWatchTransactions(async () => {
94
- const balance = await this.SlpTokenBalance(slpaddr, tokenId);
95
- callback(balance);
96
- }, slpaddr, tokenId);
97
- }
98
- // sets up a callback to be executed each time a new transaction associated with this wallet's address is entering the mempool
99
- SlpWatchTransactions(callback, slpaddr, tokenId) {
100
- const eventSource = this.SlpSocketEventSource(SlpWaitForTransactionTemplate(slpaddr, tokenId));
101
- const cancelFn = async () => {
102
- eventSource.close();
103
- };
104
- eventSource.addEventListener("message", async (txEvent) => {
105
- const data = JSON.parse(txEvent.data);
106
- if (data.data && data.data.length) {
107
- const tx = {
108
- tx_hash: data.data[0].tx.h,
109
- height: 0,
110
- details: data.data[0],
111
- };
112
- callback(tx);
113
- }
114
- }, false);
115
- return cancelFn;
116
- }
117
- SlpDbQuery(queryObject) {
118
- if (this.caching) {
119
- axiosInstance.defaults.headers = {};
120
- }
121
- else {
122
- axiosInstance.defaults.headers = noCacheHeaders;
123
- }
124
- return new Promise((resolve, reject) => {
125
- const url = `${this.servers[this.network].dataSource}/q/${B64QueryString(queryObject)}`;
126
- fetch_retry(url).then((response) => {
127
- if (response.hasOwnProperty("error")) {
128
- reject(new Error(response["error"]));
129
- }
130
- resolve(response.data);
131
- });
132
- });
133
- }
134
- SlpSocketEventSource(queryObject) {
135
- const url = `${this.servers[this.network].eventSource}/s/${B64QueryString(queryObject)}`;
136
- return new EventSource(url);
137
- }
138
- }
139
- SlpDbProvider.defaultServers = {
140
- mainnet: {
141
- dataSource: "https://slpdb.fountainhead.cash",
142
- eventSource: "https://slpsocket.fountainhead.cash",
143
- },
144
- testnet: {
145
- dataSource: "https://slpdb-testnet.fountainhead.cash",
146
- eventSource: "https://slpsocket-testnet.fountainhead.cash",
147
- },
148
- regtest: {
149
- dataSource: "http://localhost:12300",
150
- eventSource: "http://localhost:12301",
151
- },
152
- };
153
- const noCacheHeaders = {
154
- "Cache-Control": "no-cache",
155
- Pragma: "no-cache",
156
- Expires: "0",
157
- };
158
- const axiosInstance = axios.create({
159
- headers: noCacheHeaders,
160
- });
161
- const fetch_retry = (url, options = {}, n = 5) => axiosInstance.get(url, options).catch(function (error) {
162
- if (n === 0) {
163
- throw error;
164
- }
165
- return new Promise((resolve) => {
166
- setTimeout(() => resolve(fetch_retry(url, options, n - 1)), 1000);
167
- });
168
- });
169
- const B64QueryString = function (queryObject) {
170
- if (!queryObject || !Object.keys(queryObject).length) {
171
- throw new Error("Empty SLPDB query");
172
- }
173
- return btoa(JSON.stringify(queryObject));
174
- };
175
- //# sourceMappingURL=SlpDbProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SlpDbProvider.js","sourceRoot":"","sources":["../../../src/slp/SlpDbProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAO,MAAM,iBAAiB,CAAC;AAS/C,OAAO,EACL,mBAAmB,EACnB,oCAAoC,EACpC,6BAA6B,EAC7B,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,2BAA2B,EAC3B,uBAAuB,EACvB,uBAAuB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AC"}
@@ -1,313 +0,0 @@
1
- export declare const SlpAllUtxosTemplate: (slpaddr: string) => {
2
- v: number;
3
- q: {
4
- db: string[];
5
- aggregate: ({
6
- $match: {
7
- "graphTxn.outputs.address": string;
8
- "graphTxn.outputs.status": {
9
- $in: string[];
10
- };
11
- };
12
- $unwind?: undefined;
13
- } | {
14
- $unwind: string;
15
- $match?: undefined;
16
- })[];
17
- limit: number;
18
- };
19
- r: {
20
- f: string;
21
- };
22
- };
23
- export declare const SlpAllOutpointsTemplate: (slpaddr: string) => {
24
- v: number;
25
- q: {
26
- db: string[];
27
- aggregate: ({
28
- $match: {
29
- "graphTxn.outputs.address": string;
30
- "graphTxn.outputs.status": {
31
- $in: string[];
32
- };
33
- };
34
- $unwind?: undefined;
35
- $project?: undefined;
36
- } | {
37
- $unwind: string;
38
- $match?: undefined;
39
- $project?: undefined;
40
- } | {
41
- $project: {
42
- graphTxn: number;
43
- };
44
- $match?: undefined;
45
- $unwind?: undefined;
46
- })[];
47
- limit: number;
48
- };
49
- r: {
50
- f: string;
51
- };
52
- };
53
- export declare const SlpSpendableUtxosTemplate: (slpaddr: string, tokenId?: string | undefined) => {
54
- v: number;
55
- q: {
56
- db: string[];
57
- aggregate: ({
58
- $match: {
59
- "graphTxn.outputs.address": string;
60
- "graphTxn.outputs.status": string;
61
- };
62
- $unwind?: undefined;
63
- $lookup?: undefined;
64
- } | {
65
- $unwind: string;
66
- $match?: undefined;
67
- $lookup?: undefined;
68
- } | {
69
- $lookup: {
70
- from: string;
71
- localField: string;
72
- foreignField: string;
73
- as: string;
74
- };
75
- $match?: undefined;
76
- $unwind?: undefined;
77
- })[];
78
- };
79
- r: {
80
- f: string;
81
- };
82
- };
83
- export declare const SlpAllTokenBalancesTemplate: (slpaddr: string) => {
84
- v: number;
85
- q: {
86
- db: string[];
87
- aggregate: ({
88
- $match: {
89
- "graphTxn.outputs.status": string;
90
- "graphTxn.outputs.address": string;
91
- slpAmount?: undefined;
92
- };
93
- $unwind?: undefined;
94
- $group?: undefined;
95
- $sort?: undefined;
96
- $lookup?: undefined;
97
- } | {
98
- $unwind: string;
99
- $match?: undefined;
100
- $group?: undefined;
101
- $sort?: undefined;
102
- $lookup?: undefined;
103
- } | {
104
- $group: {
105
- _id: string;
106
- slpAmount: {
107
- $sum: string;
108
- };
109
- };
110
- $match?: undefined;
111
- $unwind?: undefined;
112
- $sort?: undefined;
113
- $lookup?: undefined;
114
- } | {
115
- $sort: {
116
- slpAmount: number;
117
- };
118
- $match?: undefined;
119
- $unwind?: undefined;
120
- $group?: undefined;
121
- $lookup?: undefined;
122
- } | {
123
- $lookup: {
124
- from: string;
125
- localField: string;
126
- foreignField: string;
127
- as: string;
128
- };
129
- $match?: undefined;
130
- $unwind?: undefined;
131
- $group?: undefined;
132
- $sort?: undefined;
133
- } | {
134
- $match: {
135
- slpAmount: {
136
- $gt: number;
137
- };
138
- "graphTxn.outputs.status"?: undefined;
139
- "graphTxn.outputs.address"?: undefined;
140
- };
141
- $unwind?: undefined;
142
- $group?: undefined;
143
- $sort?: undefined;
144
- $lookup?: undefined;
145
- })[];
146
- sort: {
147
- slpAmount: number;
148
- };
149
- };
150
- r: {
151
- f: string;
152
- };
153
- };
154
- export declare const SlpTokenBalanceTemplate: (slpaddr: string, tokenId: string) => {
155
- v: number;
156
- q: {
157
- db: string[];
158
- aggregate: ({
159
- $match: {
160
- "tokenDetails.tokenIdHex": string;
161
- "graphTxn.outputs.status"?: undefined;
162
- "graphTxn.outputs.address"?: undefined;
163
- };
164
- $unwind?: undefined;
165
- $group?: undefined;
166
- $sort?: undefined;
167
- $lookup?: undefined;
168
- } | {
169
- $match: {
170
- "graphTxn.outputs.status": string;
171
- "graphTxn.outputs.address": string;
172
- "tokenDetails.tokenIdHex"?: undefined;
173
- };
174
- $unwind?: undefined;
175
- $group?: undefined;
176
- $sort?: undefined;
177
- $lookup?: undefined;
178
- } | {
179
- $unwind: string;
180
- $match?: undefined;
181
- $group?: undefined;
182
- $sort?: undefined;
183
- $lookup?: undefined;
184
- } | {
185
- $group: {
186
- _id: string;
187
- slpAmount: {
188
- $sum: string;
189
- };
190
- };
191
- $match?: undefined;
192
- $unwind?: undefined;
193
- $sort?: undefined;
194
- $lookup?: undefined;
195
- } | {
196
- $sort: {
197
- slpAmount: number;
198
- };
199
- $match?: undefined;
200
- $unwind?: undefined;
201
- $group?: undefined;
202
- $lookup?: undefined;
203
- } | {
204
- $lookup: {
205
- from: string;
206
- localField: string;
207
- foreignField: string;
208
- as: string;
209
- };
210
- $match?: undefined;
211
- $unwind?: undefined;
212
- $group?: undefined;
213
- $sort?: undefined;
214
- })[];
215
- sort: {
216
- slpAmount: number;
217
- };
218
- };
219
- r: {
220
- f: string;
221
- };
222
- };
223
- export declare const SlpAddressTransactionHistoryTemplate: (address: string, tokenId?: string | undefined, limit?: number, skip?: number) => {
224
- v: number;
225
- q: {
226
- db: string[];
227
- find: {
228
- $query: {
229
- $or: ({
230
- "in.e.a": string;
231
- "out.e.a"?: undefined;
232
- } | {
233
- "out.e.a": string;
234
- "in.e.a"?: undefined;
235
- })[];
236
- $and: {
237
- "slp.valid": boolean;
238
- }[];
239
- };
240
- };
241
- sort: {
242
- "blk.i": number;
243
- };
244
- limit: number;
245
- skip: number;
246
- };
247
- r: {
248
- f: string;
249
- };
250
- };
251
- export declare const SlpWaitForTransactionTemplate: (slpaddr?: string | undefined, tokenId?: string | undefined) => {
252
- v: number;
253
- q: {
254
- db: string[];
255
- find: {};
256
- };
257
- };
258
- export declare const SlpTokenInfoTemplate: (tokenId?: string | undefined, limit?: number, skip?: number) => {
259
- v: number;
260
- q: {
261
- db: string[];
262
- find: {};
263
- sort: {
264
- "tokenStats.approx_txns_since_genesis": number;
265
- };
266
- limit: number;
267
- skip: number;
268
- };
269
- r: {
270
- f: string;
271
- };
272
- };
273
- export declare const SlpBatonUtxosTemplate: (slpaddr: string, tokenId?: string | undefined) => {
274
- v: number;
275
- q: {
276
- db: string[];
277
- aggregate: ({
278
- $match: {
279
- "graphTxn.outputs.address": string;
280
- "graphTxn.outputs.status": string;
281
- };
282
- $unwind?: undefined;
283
- $project?: undefined;
284
- $lookup?: undefined;
285
- } | {
286
- $unwind: string;
287
- $match?: undefined;
288
- $project?: undefined;
289
- $lookup?: undefined;
290
- } | {
291
- $project: {
292
- graphTxn: number;
293
- };
294
- $match?: undefined;
295
- $unwind?: undefined;
296
- $lookup?: undefined;
297
- } | {
298
- $lookup: {
299
- from: string;
300
- localField: string;
301
- foreignField: string;
302
- as: string;
303
- };
304
- $match?: undefined;
305
- $unwind?: undefined;
306
- $project?: undefined;
307
- })[];
308
- };
309
- r: {
310
- f: string;
311
- };
312
- };
313
- //# sourceMappingURL=SlpDbTemplates.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SlpDbTemplates.d.ts","sourceRoot":"","sources":["../../../src/slp/SlpDbTemplates.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,YAAa,MAAM;;;;;;;;;;;;;;;;;;;;;CAoCjD,CAAC;AAIH,eAAO,MAAM,uBAAuB,YAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCrD,CAAC;AAIH,eAAO,MAAM,yBAAyB,YAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CxD,CAAA;AAGD,eAAO,MAAM,2BAA2B,YAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4D1D,CAAA;AAGD,eAAO,MAAM,uBAAuB,YAAa,MAAM,WAAW,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DvE,CAAA;AAGD,eAAO,MAAM,oCAAoC,YAAa,MAAM,wCAA2B,MAAM,SAAc,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCxH,CAAC;AAGF,eAAO,MAAM,6BAA6B;;;;;;CA0BzC,CAAC;AAIF,eAAO,MAAM,oBAAoB,yCAA6B,MAAM,SAAc,MAAM;;;;;;;;;;;;;;CAwBvF,CAAA;AAID,eAAO,MAAM,qBAAqB,YAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+CpD,CAAA"}