@sentio/sdk 1.14.4 → 1.15.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/lib/builtin/internal/erc20_processor.js.map +1 -1
- package/lib/builtin/internal/erc20bytes_processor.js.map +1 -1
- package/lib/builtin/internal/weth9_processor.js.map +1 -1
- package/lib/cli/upload.js +78 -42
- package/lib/cli/upload.js.map +1 -1
- package/lib/gen/processor/protos/processor.d.ts +3 -2
- package/lib/gen/processor/protos/processor.js +34 -17
- package/lib/gen/processor/protos/processor.js.map +1 -1
- package/lib/service.js +14 -11
- package/lib/service.js.map +1 -1
- package/lib/target-ethers-sentio/codegen.js +11 -2
- package/lib/target-ethers-sentio/codegen.js.map +1 -1
- package/lib/test/erc20.js +5 -0
- package/lib/test/erc20.js.map +1 -1
- package/lib/test/erc20.test.js +13 -0
- package/lib/test/erc20.test.js.map +1 -1
- package/lib/test/sui.test.js +2 -1
- package/lib/test/sui.test.js.map +1 -1
- package/package.json +1 -1
- package/src/builtin/internal/erc20_processor.ts +22 -16
- package/src/builtin/internal/erc20bytes_processor.ts +18 -12
- package/src/builtin/internal/weth9_processor.ts +18 -12
- package/src/cli/upload.ts +76 -38
- package/src/gen/processor/protos/processor.ts +37 -19
- package/src/service.ts +15 -11
- package/src/target-ethers-sentio/codegen.ts +13 -3
- package/src/test/erc20.test.ts +15 -1
- package/src/test/erc20.ts +5 -1
- package/src/test/sui.test.ts +2 -1
|
@@ -171,7 +171,7 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
|
171
171
|
owner: PromiseOrValue<string>,
|
|
172
172
|
spender: PromiseOrValue<string>,
|
|
173
173
|
overrides?: CallOverrides
|
|
174
|
-
) {
|
|
174
|
+
): Promise<BigNumber> {
|
|
175
175
|
try {
|
|
176
176
|
if (overrides) {
|
|
177
177
|
return await this.contract.allowance(owner, spender, overrides);
|
|
@@ -183,7 +183,10 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
async balanceOf(
|
|
186
|
+
async balanceOf(
|
|
187
|
+
account: PromiseOrValue<string>,
|
|
188
|
+
overrides?: CallOverrides
|
|
189
|
+
): Promise<BigNumber> {
|
|
187
190
|
try {
|
|
188
191
|
if (overrides) {
|
|
189
192
|
return await this.contract.balanceOf(account, overrides);
|
|
@@ -195,7 +198,7 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
|
195
198
|
}
|
|
196
199
|
}
|
|
197
200
|
|
|
198
|
-
async decimals(overrides?: CallOverrides) {
|
|
201
|
+
async decimals(overrides?: CallOverrides): Promise<number> {
|
|
199
202
|
try {
|
|
200
203
|
if (overrides) {
|
|
201
204
|
return await this.contract.decimals(overrides);
|
|
@@ -207,7 +210,7 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
|
207
210
|
}
|
|
208
211
|
}
|
|
209
212
|
|
|
210
|
-
async locker(overrides?: CallOverrides) {
|
|
213
|
+
async locker(overrides?: CallOverrides): Promise<string> {
|
|
211
214
|
try {
|
|
212
215
|
if (overrides) {
|
|
213
216
|
return await this.contract.locker(overrides);
|
|
@@ -219,7 +222,7 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
|
219
222
|
}
|
|
220
223
|
}
|
|
221
224
|
|
|
222
|
-
async name(overrides?: CallOverrides) {
|
|
225
|
+
async name(overrides?: CallOverrides): Promise<string> {
|
|
223
226
|
try {
|
|
224
227
|
if (overrides) {
|
|
225
228
|
return await this.contract.name(overrides);
|
|
@@ -231,7 +234,7 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
|
231
234
|
}
|
|
232
235
|
}
|
|
233
236
|
|
|
234
|
-
async owner(overrides?: CallOverrides) {
|
|
237
|
+
async owner(overrides?: CallOverrides): Promise<string> {
|
|
235
238
|
try {
|
|
236
239
|
if (overrides) {
|
|
237
240
|
return await this.contract.owner(overrides);
|
|
@@ -243,7 +246,7 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
|
243
246
|
}
|
|
244
247
|
}
|
|
245
248
|
|
|
246
|
-
async symbol(overrides?: CallOverrides) {
|
|
249
|
+
async symbol(overrides?: CallOverrides): Promise<string> {
|
|
247
250
|
try {
|
|
248
251
|
if (overrides) {
|
|
249
252
|
return await this.contract.symbol(overrides);
|
|
@@ -255,7 +258,7 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
|
255
258
|
}
|
|
256
259
|
}
|
|
257
260
|
|
|
258
|
-
async totalSupply(overrides?: CallOverrides) {
|
|
261
|
+
async totalSupply(overrides?: CallOverrides): Promise<BigNumber> {
|
|
259
262
|
try {
|
|
260
263
|
if (overrides) {
|
|
261
264
|
return await this.contract.totalSupply(overrides);
|
|
@@ -280,7 +283,7 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
|
280
283
|
owner: PromiseOrValue<string>,
|
|
281
284
|
spender: PromiseOrValue<string>,
|
|
282
285
|
overrides?: CallOverrides
|
|
283
|
-
) {
|
|
286
|
+
): Promise<BigNumber> {
|
|
284
287
|
try {
|
|
285
288
|
if (!overrides && this.context) {
|
|
286
289
|
overrides = {
|
|
@@ -297,7 +300,10 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
|
297
300
|
}
|
|
298
301
|
}
|
|
299
302
|
|
|
300
|
-
async balanceOf(
|
|
303
|
+
async balanceOf(
|
|
304
|
+
account: PromiseOrValue<string>,
|
|
305
|
+
overrides?: CallOverrides
|
|
306
|
+
): Promise<BigNumber> {
|
|
301
307
|
try {
|
|
302
308
|
if (!overrides && this.context) {
|
|
303
309
|
overrides = {
|
|
@@ -314,7 +320,7 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
|
314
320
|
}
|
|
315
321
|
}
|
|
316
322
|
|
|
317
|
-
async decimals(overrides?: CallOverrides) {
|
|
323
|
+
async decimals(overrides?: CallOverrides): Promise<number> {
|
|
318
324
|
try {
|
|
319
325
|
if (!overrides && this.context) {
|
|
320
326
|
overrides = {
|
|
@@ -331,7 +337,7 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
|
331
337
|
}
|
|
332
338
|
}
|
|
333
339
|
|
|
334
|
-
async locker(overrides?: CallOverrides) {
|
|
340
|
+
async locker(overrides?: CallOverrides): Promise<string> {
|
|
335
341
|
try {
|
|
336
342
|
if (!overrides && this.context) {
|
|
337
343
|
overrides = {
|
|
@@ -348,7 +354,7 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
|
348
354
|
}
|
|
349
355
|
}
|
|
350
356
|
|
|
351
|
-
async name(overrides?: CallOverrides) {
|
|
357
|
+
async name(overrides?: CallOverrides): Promise<string> {
|
|
352
358
|
try {
|
|
353
359
|
if (!overrides && this.context) {
|
|
354
360
|
overrides = {
|
|
@@ -365,7 +371,7 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
|
365
371
|
}
|
|
366
372
|
}
|
|
367
373
|
|
|
368
|
-
async owner(overrides?: CallOverrides) {
|
|
374
|
+
async owner(overrides?: CallOverrides): Promise<string> {
|
|
369
375
|
try {
|
|
370
376
|
if (!overrides && this.context) {
|
|
371
377
|
overrides = {
|
|
@@ -382,7 +388,7 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
|
382
388
|
}
|
|
383
389
|
}
|
|
384
390
|
|
|
385
|
-
async symbol(overrides?: CallOverrides) {
|
|
391
|
+
async symbol(overrides?: CallOverrides): Promise<string> {
|
|
386
392
|
try {
|
|
387
393
|
if (!overrides && this.context) {
|
|
388
394
|
overrides = {
|
|
@@ -399,7 +405,7 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
|
399
405
|
}
|
|
400
406
|
}
|
|
401
407
|
|
|
402
|
-
async totalSupply(overrides?: CallOverrides) {
|
|
408
|
+
async totalSupply(overrides?: CallOverrides): Promise<BigNumber> {
|
|
403
409
|
try {
|
|
404
410
|
if (!overrides && this.context) {
|
|
405
411
|
overrides = {
|
|
@@ -99,7 +99,7 @@ export class ERC20BytesContractView extends ContractView<ERC20Bytes> {
|
|
|
99
99
|
super(contract);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
async name(overrides?: CallOverrides) {
|
|
102
|
+
async name(overrides?: CallOverrides): Promise<string> {
|
|
103
103
|
try {
|
|
104
104
|
if (overrides) {
|
|
105
105
|
return await this.contract.name(overrides);
|
|
@@ -111,7 +111,7 @@ export class ERC20BytesContractView extends ContractView<ERC20Bytes> {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
async totalSupply(overrides?: CallOverrides) {
|
|
114
|
+
async totalSupply(overrides?: CallOverrides): Promise<BigNumber> {
|
|
115
115
|
try {
|
|
116
116
|
if (overrides) {
|
|
117
117
|
return await this.contract.totalSupply(overrides);
|
|
@@ -123,7 +123,7 @@ export class ERC20BytesContractView extends ContractView<ERC20Bytes> {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
async decimals(overrides?: CallOverrides) {
|
|
126
|
+
async decimals(overrides?: CallOverrides): Promise<number> {
|
|
127
127
|
try {
|
|
128
128
|
if (overrides) {
|
|
129
129
|
return await this.contract.decimals(overrides);
|
|
@@ -135,7 +135,10 @@ export class ERC20BytesContractView extends ContractView<ERC20Bytes> {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
async balanceOf(
|
|
138
|
+
async balanceOf(
|
|
139
|
+
who: PromiseOrValue<string>,
|
|
140
|
+
overrides?: CallOverrides
|
|
141
|
+
): Promise<BigNumber> {
|
|
139
142
|
try {
|
|
140
143
|
if (overrides) {
|
|
141
144
|
return await this.contract.balanceOf(who, overrides);
|
|
@@ -147,7 +150,7 @@ export class ERC20BytesContractView extends ContractView<ERC20Bytes> {
|
|
|
147
150
|
}
|
|
148
151
|
}
|
|
149
152
|
|
|
150
|
-
async symbol(overrides?: CallOverrides) {
|
|
153
|
+
async symbol(overrides?: CallOverrides): Promise<string> {
|
|
151
154
|
try {
|
|
152
155
|
if (overrides) {
|
|
153
156
|
return await this.contract.symbol(overrides);
|
|
@@ -163,7 +166,7 @@ export class ERC20BytesContractView extends ContractView<ERC20Bytes> {
|
|
|
163
166
|
owner: PromiseOrValue<string>,
|
|
164
167
|
spender: PromiseOrValue<string>,
|
|
165
168
|
overrides?: CallOverrides
|
|
166
|
-
) {
|
|
169
|
+
): Promise<BigNumber> {
|
|
167
170
|
try {
|
|
168
171
|
if (overrides) {
|
|
169
172
|
return await this.contract.allowance(owner, spender, overrides);
|
|
@@ -184,7 +187,7 @@ export class ERC20BytesBoundContractView extends BoundContractView<
|
|
|
184
187
|
// super(contract);
|
|
185
188
|
// }
|
|
186
189
|
|
|
187
|
-
async name(overrides?: CallOverrides) {
|
|
190
|
+
async name(overrides?: CallOverrides): Promise<string> {
|
|
188
191
|
try {
|
|
189
192
|
if (!overrides && this.context) {
|
|
190
193
|
overrides = {
|
|
@@ -201,7 +204,7 @@ export class ERC20BytesBoundContractView extends BoundContractView<
|
|
|
201
204
|
}
|
|
202
205
|
}
|
|
203
206
|
|
|
204
|
-
async totalSupply(overrides?: CallOverrides) {
|
|
207
|
+
async totalSupply(overrides?: CallOverrides): Promise<BigNumber> {
|
|
205
208
|
try {
|
|
206
209
|
if (!overrides && this.context) {
|
|
207
210
|
overrides = {
|
|
@@ -218,7 +221,7 @@ export class ERC20BytesBoundContractView extends BoundContractView<
|
|
|
218
221
|
}
|
|
219
222
|
}
|
|
220
223
|
|
|
221
|
-
async decimals(overrides?: CallOverrides) {
|
|
224
|
+
async decimals(overrides?: CallOverrides): Promise<number> {
|
|
222
225
|
try {
|
|
223
226
|
if (!overrides && this.context) {
|
|
224
227
|
overrides = {
|
|
@@ -235,7 +238,10 @@ export class ERC20BytesBoundContractView extends BoundContractView<
|
|
|
235
238
|
}
|
|
236
239
|
}
|
|
237
240
|
|
|
238
|
-
async balanceOf(
|
|
241
|
+
async balanceOf(
|
|
242
|
+
who: PromiseOrValue<string>,
|
|
243
|
+
overrides?: CallOverrides
|
|
244
|
+
): Promise<BigNumber> {
|
|
239
245
|
try {
|
|
240
246
|
if (!overrides && this.context) {
|
|
241
247
|
overrides = {
|
|
@@ -252,7 +258,7 @@ export class ERC20BytesBoundContractView extends BoundContractView<
|
|
|
252
258
|
}
|
|
253
259
|
}
|
|
254
260
|
|
|
255
|
-
async symbol(overrides?: CallOverrides) {
|
|
261
|
+
async symbol(overrides?: CallOverrides): Promise<string> {
|
|
256
262
|
try {
|
|
257
263
|
if (!overrides && this.context) {
|
|
258
264
|
overrides = {
|
|
@@ -273,7 +279,7 @@ export class ERC20BytesBoundContractView extends BoundContractView<
|
|
|
273
279
|
owner: PromiseOrValue<string>,
|
|
274
280
|
spender: PromiseOrValue<string>,
|
|
275
281
|
overrides?: CallOverrides
|
|
276
|
-
) {
|
|
282
|
+
): Promise<BigNumber> {
|
|
277
283
|
try {
|
|
278
284
|
if (!overrides && this.context) {
|
|
279
285
|
overrides = {
|
|
@@ -108,7 +108,7 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
|
108
108
|
super(contract);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
async name(overrides?: CallOverrides) {
|
|
111
|
+
async name(overrides?: CallOverrides): Promise<string> {
|
|
112
112
|
try {
|
|
113
113
|
if (overrides) {
|
|
114
114
|
return await this.contract.name(overrides);
|
|
@@ -120,7 +120,7 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
async totalSupply(overrides?: CallOverrides) {
|
|
123
|
+
async totalSupply(overrides?: CallOverrides): Promise<BigNumber> {
|
|
124
124
|
try {
|
|
125
125
|
if (overrides) {
|
|
126
126
|
return await this.contract.totalSupply(overrides);
|
|
@@ -132,7 +132,7 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
async decimals(overrides?: CallOverrides) {
|
|
135
|
+
async decimals(overrides?: CallOverrides): Promise<number> {
|
|
136
136
|
try {
|
|
137
137
|
if (overrides) {
|
|
138
138
|
return await this.contract.decimals(overrides);
|
|
@@ -144,7 +144,10 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
async balanceOf(
|
|
147
|
+
async balanceOf(
|
|
148
|
+
arg0: PromiseOrValue<string>,
|
|
149
|
+
overrides?: CallOverrides
|
|
150
|
+
): Promise<BigNumber> {
|
|
148
151
|
try {
|
|
149
152
|
if (overrides) {
|
|
150
153
|
return await this.contract.balanceOf(arg0, overrides);
|
|
@@ -156,7 +159,7 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
|
156
159
|
}
|
|
157
160
|
}
|
|
158
161
|
|
|
159
|
-
async symbol(overrides?: CallOverrides) {
|
|
162
|
+
async symbol(overrides?: CallOverrides): Promise<string> {
|
|
160
163
|
try {
|
|
161
164
|
if (overrides) {
|
|
162
165
|
return await this.contract.symbol(overrides);
|
|
@@ -172,7 +175,7 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
|
172
175
|
arg0: PromiseOrValue<string>,
|
|
173
176
|
arg1: PromiseOrValue<string>,
|
|
174
177
|
overrides?: CallOverrides
|
|
175
|
-
) {
|
|
178
|
+
): Promise<BigNumber> {
|
|
176
179
|
try {
|
|
177
180
|
if (overrides) {
|
|
178
181
|
return await this.contract.allowance(arg0, arg1, overrides);
|
|
@@ -193,7 +196,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
|
193
196
|
// super(contract);
|
|
194
197
|
// }
|
|
195
198
|
|
|
196
|
-
async name(overrides?: CallOverrides) {
|
|
199
|
+
async name(overrides?: CallOverrides): Promise<string> {
|
|
197
200
|
try {
|
|
198
201
|
if (!overrides && this.context) {
|
|
199
202
|
overrides = {
|
|
@@ -210,7 +213,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
|
210
213
|
}
|
|
211
214
|
}
|
|
212
215
|
|
|
213
|
-
async totalSupply(overrides?: CallOverrides) {
|
|
216
|
+
async totalSupply(overrides?: CallOverrides): Promise<BigNumber> {
|
|
214
217
|
try {
|
|
215
218
|
if (!overrides && this.context) {
|
|
216
219
|
overrides = {
|
|
@@ -227,7 +230,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
|
227
230
|
}
|
|
228
231
|
}
|
|
229
232
|
|
|
230
|
-
async decimals(overrides?: CallOverrides) {
|
|
233
|
+
async decimals(overrides?: CallOverrides): Promise<number> {
|
|
231
234
|
try {
|
|
232
235
|
if (!overrides && this.context) {
|
|
233
236
|
overrides = {
|
|
@@ -244,7 +247,10 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
|
244
247
|
}
|
|
245
248
|
}
|
|
246
249
|
|
|
247
|
-
async balanceOf(
|
|
250
|
+
async balanceOf(
|
|
251
|
+
arg0: PromiseOrValue<string>,
|
|
252
|
+
overrides?: CallOverrides
|
|
253
|
+
): Promise<BigNumber> {
|
|
248
254
|
try {
|
|
249
255
|
if (!overrides && this.context) {
|
|
250
256
|
overrides = {
|
|
@@ -261,7 +267,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
|
261
267
|
}
|
|
262
268
|
}
|
|
263
269
|
|
|
264
|
-
async symbol(overrides?: CallOverrides) {
|
|
270
|
+
async symbol(overrides?: CallOverrides): Promise<string> {
|
|
265
271
|
try {
|
|
266
272
|
if (!overrides && this.context) {
|
|
267
273
|
overrides = {
|
|
@@ -282,7 +288,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
|
282
288
|
arg0: PromiseOrValue<string>,
|
|
283
289
|
arg1: PromiseOrValue<string>,
|
|
284
290
|
overrides?: CallOverrides
|
|
285
|
-
) {
|
|
291
|
+
): Promise<BigNumber> {
|
|
286
292
|
try {
|
|
287
293
|
if (!overrides && this.context) {
|
|
288
294
|
overrides = {
|
package/src/cli/upload.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { execSync } from 'child_process'
|
|
|
2
2
|
import { createHash } from 'crypto'
|
|
3
3
|
import FormData from 'form-data'
|
|
4
4
|
import fs from 'fs'
|
|
5
|
+
import readline from 'readline'
|
|
5
6
|
import { SentioProjectConfig } from './config'
|
|
6
7
|
import { ReadKey } from './key'
|
|
7
8
|
import path from 'path'
|
|
@@ -10,16 +11,27 @@ import { buildProcessor } from './build'
|
|
|
10
11
|
import fetch from 'node-fetch'
|
|
11
12
|
import { getCliVersion } from './utils'
|
|
12
13
|
|
|
14
|
+
async function createProject(options: SentioProjectConfig, apiKey: string) {
|
|
15
|
+
const url = new URL('/api/v1/projects', options.host)
|
|
16
|
+
return fetch(url, {
|
|
17
|
+
method: 'POST',
|
|
18
|
+
headers: {
|
|
19
|
+
'api-key': apiKey,
|
|
20
|
+
},
|
|
21
|
+
body: JSON.stringify({ slug: options.project, visibility: 'PRIVATE' }),
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
|
|
13
25
|
export async function uploadFile(options: SentioProjectConfig, apiKeyOverride: string) {
|
|
14
26
|
if (options.build) {
|
|
15
27
|
await buildProcessor(false, options.targets)
|
|
16
28
|
}
|
|
17
29
|
|
|
18
|
-
console.log(chalk.blue('
|
|
30
|
+
console.log(chalk.blue('Prepare to upload'))
|
|
19
31
|
|
|
20
32
|
const PROCESSOR_FILE = path.join(process.cwd(), 'dist/lib.js')
|
|
21
33
|
|
|
22
|
-
const url = new URL(options.host)
|
|
34
|
+
const url = new URL('/api/v1/processors', options.host)
|
|
23
35
|
const apiKey = apiKeyOverride || ReadKey(options.host)
|
|
24
36
|
|
|
25
37
|
const isProd = options.host === 'https://app.sentio.xyz'
|
|
@@ -41,46 +53,72 @@ export async function uploadFile(options: SentioProjectConfig, apiKeyOverride: s
|
|
|
41
53
|
hash.update(content)
|
|
42
54
|
const digest = hash.digest('hex')
|
|
43
55
|
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
56
|
+
const upload = async () => {
|
|
57
|
+
const data = new FormData()
|
|
58
|
+
data.append('attachment', fs.createReadStream(PROCESSOR_FILE))
|
|
59
|
+
data.append('sha256', digest)
|
|
47
60
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
let commitSha = ''
|
|
62
|
+
try {
|
|
63
|
+
commitSha = execSync('git rev-parse HEAD').toString().trim()
|
|
64
|
+
data.append('commitSha', commitSha)
|
|
65
|
+
} catch (e) {
|
|
66
|
+
chalk.yellow(e)
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
const gitUrl = execSync('git remote get-url origin').toString().trim()
|
|
70
|
+
data.append('gitUrl', gitUrl)
|
|
71
|
+
} catch (e) {
|
|
72
|
+
// skip errors
|
|
73
|
+
}
|
|
74
|
+
console.log(chalk.blue('Uploading'))
|
|
75
|
+
const res = await fetch(url, {
|
|
76
|
+
method: 'POST',
|
|
77
|
+
headers: {
|
|
78
|
+
'api-key': apiKey,
|
|
79
|
+
project: options.project,
|
|
80
|
+
version: getCliVersion(),
|
|
81
|
+
},
|
|
82
|
+
body: data,
|
|
83
|
+
})
|
|
61
84
|
|
|
62
|
-
|
|
85
|
+
if (res.ok) {
|
|
86
|
+
console.log(chalk.green('Upload success: '))
|
|
87
|
+
console.log('\t', chalk.blue('sha256:'), digest)
|
|
88
|
+
if (commitSha) {
|
|
89
|
+
console.log('\t', chalk.blue('Git commit SHA:'), commitSha)
|
|
90
|
+
}
|
|
91
|
+
const { ProjectSlug } = await res.json()
|
|
92
|
+
console.log('\t', chalk.blue('Check status:'), `${options.host}/${ProjectSlug}/datasource`)
|
|
93
|
+
} else {
|
|
94
|
+
console.error(chalk.red('Upload Failed'))
|
|
95
|
+
console.error(chalk.red(await res.text()))
|
|
63
96
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
version: getCliVersion(),
|
|
70
|
-
},
|
|
71
|
-
body: data,
|
|
72
|
-
})
|
|
97
|
+
if (res.status === 404) {
|
|
98
|
+
const rl = readline.createInterface({
|
|
99
|
+
input: process.stdin,
|
|
100
|
+
output: process.stdout,
|
|
101
|
+
})
|
|
73
102
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
103
|
+
const prompt = async () => {
|
|
104
|
+
const answer: string = await new Promise((resolve) =>
|
|
105
|
+
rl.question(`Do you want to create it and continue the uploading process? (yes/no) `, resolve)
|
|
106
|
+
)
|
|
107
|
+
if (['y', 'yes'].includes(answer.toLowerCase())) {
|
|
108
|
+
rl.close()
|
|
109
|
+
await createProject(options, apiKey)
|
|
110
|
+
console.log(chalk.green('Project created'))
|
|
111
|
+
await upload()
|
|
112
|
+
} else if (['n', 'no'].includes(answer.toLowerCase())) {
|
|
113
|
+
rl.close()
|
|
114
|
+
} else {
|
|
115
|
+
await prompt()
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
await prompt()
|
|
119
|
+
}
|
|
79
120
|
}
|
|
80
|
-
const { ProjectSlug } = await res.json()
|
|
81
|
-
console.log('\t', chalk.blue('Check status:'), `${options.host}/${ProjectSlug}/datasource`)
|
|
82
|
-
} else {
|
|
83
|
-
console.error(chalk.red('Upload Failed'))
|
|
84
|
-
console.error(chalk.red(await res.text()))
|
|
85
121
|
}
|
|
122
|
+
|
|
123
|
+
await upload()
|
|
86
124
|
}
|
|
@@ -194,6 +194,7 @@ export interface ProcessTracesResponse {
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
export interface ProcessTransactionsRequest {
|
|
197
|
+
chainId: string;
|
|
197
198
|
transactions: RawTransaction[];
|
|
198
199
|
}
|
|
199
200
|
|
|
@@ -236,9 +237,9 @@ export interface RawTrace {
|
|
|
236
237
|
}
|
|
237
238
|
|
|
238
239
|
export interface RawTransaction {
|
|
239
|
-
txHash: string;
|
|
240
240
|
raw: Uint8Array;
|
|
241
|
-
programAccountId
|
|
241
|
+
programAccountId?: string | undefined;
|
|
242
|
+
slot?: Long | undefined;
|
|
242
243
|
}
|
|
243
244
|
|
|
244
245
|
export interface Instruction {
|
|
@@ -1627,7 +1628,7 @@ export const ProcessTracesResponse = {
|
|
|
1627
1628
|
};
|
|
1628
1629
|
|
|
1629
1630
|
function createBaseProcessTransactionsRequest(): ProcessTransactionsRequest {
|
|
1630
|
-
return { transactions: [] };
|
|
1631
|
+
return { chainId: "", transactions: [] };
|
|
1631
1632
|
}
|
|
1632
1633
|
|
|
1633
1634
|
export const ProcessTransactionsRequest = {
|
|
@@ -1635,8 +1636,11 @@ export const ProcessTransactionsRequest = {
|
|
|
1635
1636
|
message: ProcessTransactionsRequest,
|
|
1636
1637
|
writer: _m0.Writer = _m0.Writer.create()
|
|
1637
1638
|
): _m0.Writer {
|
|
1639
|
+
if (message.chainId !== "") {
|
|
1640
|
+
writer.uint32(10).string(message.chainId);
|
|
1641
|
+
}
|
|
1638
1642
|
for (const v of message.transactions) {
|
|
1639
|
-
RawTransaction.encode(v!, writer.uint32(
|
|
1643
|
+
RawTransaction.encode(v!, writer.uint32(18).fork()).ldelim();
|
|
1640
1644
|
}
|
|
1641
1645
|
return writer;
|
|
1642
1646
|
},
|
|
@@ -1652,6 +1656,9 @@ export const ProcessTransactionsRequest = {
|
|
|
1652
1656
|
const tag = reader.uint32();
|
|
1653
1657
|
switch (tag >>> 3) {
|
|
1654
1658
|
case 1:
|
|
1659
|
+
message.chainId = reader.string();
|
|
1660
|
+
break;
|
|
1661
|
+
case 2:
|
|
1655
1662
|
message.transactions.push(
|
|
1656
1663
|
RawTransaction.decode(reader, reader.uint32())
|
|
1657
1664
|
);
|
|
@@ -1666,6 +1673,7 @@ export const ProcessTransactionsRequest = {
|
|
|
1666
1673
|
|
|
1667
1674
|
fromJSON(object: any): ProcessTransactionsRequest {
|
|
1668
1675
|
return {
|
|
1676
|
+
chainId: isSet(object.chainId) ? String(object.chainId) : "",
|
|
1669
1677
|
transactions: Array.isArray(object?.transactions)
|
|
1670
1678
|
? object.transactions.map((e: any) => RawTransaction.fromJSON(e))
|
|
1671
1679
|
: [],
|
|
@@ -1674,6 +1682,7 @@ export const ProcessTransactionsRequest = {
|
|
|
1674
1682
|
|
|
1675
1683
|
toJSON(message: ProcessTransactionsRequest): unknown {
|
|
1676
1684
|
const obj: any = {};
|
|
1685
|
+
message.chainId !== undefined && (obj.chainId = message.chainId);
|
|
1677
1686
|
if (message.transactions) {
|
|
1678
1687
|
obj.transactions = message.transactions.map((e) =>
|
|
1679
1688
|
e ? RawTransaction.toJSON(e) : undefined
|
|
@@ -1688,6 +1697,7 @@ export const ProcessTransactionsRequest = {
|
|
|
1688
1697
|
object: DeepPartial<ProcessTransactionsRequest>
|
|
1689
1698
|
): ProcessTransactionsRequest {
|
|
1690
1699
|
const message = createBaseProcessTransactionsRequest();
|
|
1700
|
+
message.chainId = object.chainId ?? "";
|
|
1691
1701
|
message.transactions =
|
|
1692
1702
|
object.transactions?.map((e) => RawTransaction.fromPartial(e)) || [];
|
|
1693
1703
|
return message;
|
|
@@ -2266,7 +2276,11 @@ export const RawTrace = {
|
|
|
2266
2276
|
};
|
|
2267
2277
|
|
|
2268
2278
|
function createBaseRawTransaction(): RawTransaction {
|
|
2269
|
-
return {
|
|
2279
|
+
return {
|
|
2280
|
+
raw: new Uint8Array(),
|
|
2281
|
+
programAccountId: undefined,
|
|
2282
|
+
slot: undefined,
|
|
2283
|
+
};
|
|
2270
2284
|
}
|
|
2271
2285
|
|
|
2272
2286
|
export const RawTransaction = {
|
|
@@ -2274,14 +2288,14 @@ export const RawTransaction = {
|
|
|
2274
2288
|
message: RawTransaction,
|
|
2275
2289
|
writer: _m0.Writer = _m0.Writer.create()
|
|
2276
2290
|
): _m0.Writer {
|
|
2277
|
-
if (message.txHash !== "") {
|
|
2278
|
-
writer.uint32(10).string(message.txHash);
|
|
2279
|
-
}
|
|
2280
2291
|
if (message.raw.length !== 0) {
|
|
2281
|
-
writer.uint32(
|
|
2292
|
+
writer.uint32(10).bytes(message.raw);
|
|
2282
2293
|
}
|
|
2283
|
-
if (message.programAccountId !==
|
|
2284
|
-
writer.uint32(
|
|
2294
|
+
if (message.programAccountId !== undefined) {
|
|
2295
|
+
writer.uint32(18).string(message.programAccountId);
|
|
2296
|
+
}
|
|
2297
|
+
if (message.slot !== undefined) {
|
|
2298
|
+
writer.uint32(24).uint64(message.slot);
|
|
2285
2299
|
}
|
|
2286
2300
|
return writer;
|
|
2287
2301
|
},
|
|
@@ -2294,13 +2308,13 @@ export const RawTransaction = {
|
|
|
2294
2308
|
const tag = reader.uint32();
|
|
2295
2309
|
switch (tag >>> 3) {
|
|
2296
2310
|
case 1:
|
|
2297
|
-
message.
|
|
2311
|
+
message.raw = reader.bytes();
|
|
2298
2312
|
break;
|
|
2299
2313
|
case 2:
|
|
2300
|
-
message.
|
|
2314
|
+
message.programAccountId = reader.string();
|
|
2301
2315
|
break;
|
|
2302
2316
|
case 3:
|
|
2303
|
-
message.
|
|
2317
|
+
message.slot = reader.uint64() as Long;
|
|
2304
2318
|
break;
|
|
2305
2319
|
default:
|
|
2306
2320
|
reader.skipType(tag & 7);
|
|
@@ -2312,31 +2326,35 @@ export const RawTransaction = {
|
|
|
2312
2326
|
|
|
2313
2327
|
fromJSON(object: any): RawTransaction {
|
|
2314
2328
|
return {
|
|
2315
|
-
txHash: isSet(object.txHash) ? String(object.txHash) : "",
|
|
2316
2329
|
raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(),
|
|
2317
2330
|
programAccountId: isSet(object.programAccountId)
|
|
2318
2331
|
? String(object.programAccountId)
|
|
2319
|
-
:
|
|
2332
|
+
: undefined,
|
|
2333
|
+
slot: isSet(object.slot) ? Long.fromValue(object.slot) : undefined,
|
|
2320
2334
|
};
|
|
2321
2335
|
},
|
|
2322
2336
|
|
|
2323
2337
|
toJSON(message: RawTransaction): unknown {
|
|
2324
2338
|
const obj: any = {};
|
|
2325
|
-
message.txHash !== undefined && (obj.txHash = message.txHash);
|
|
2326
2339
|
message.raw !== undefined &&
|
|
2327
2340
|
(obj.raw = base64FromBytes(
|
|
2328
2341
|
message.raw !== undefined ? message.raw : new Uint8Array()
|
|
2329
2342
|
));
|
|
2330
2343
|
message.programAccountId !== undefined &&
|
|
2331
2344
|
(obj.programAccountId = message.programAccountId);
|
|
2345
|
+
message.slot !== undefined &&
|
|
2346
|
+
(obj.slot = (message.slot || undefined).toString());
|
|
2332
2347
|
return obj;
|
|
2333
2348
|
},
|
|
2334
2349
|
|
|
2335
2350
|
fromPartial(object: DeepPartial<RawTransaction>): RawTransaction {
|
|
2336
2351
|
const message = createBaseRawTransaction();
|
|
2337
|
-
message.txHash = object.txHash ?? "";
|
|
2338
2352
|
message.raw = object.raw ?? new Uint8Array();
|
|
2339
|
-
message.programAccountId = object.programAccountId ??
|
|
2353
|
+
message.programAccountId = object.programAccountId ?? undefined;
|
|
2354
|
+
message.slot =
|
|
2355
|
+
object.slot !== undefined && object.slot !== null
|
|
2356
|
+
? Long.fromValue(object.slot)
|
|
2357
|
+
: undefined;
|
|
2340
2358
|
return message;
|
|
2341
2359
|
},
|
|
2342
2360
|
};
|