@sentio/sdk 2.39.4-rc.1 → 2.39.4-rc.11
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/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc1155-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc20-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc20bytes-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc721-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/weth9-processor.d.ts.map +1 -1
- package/lib/eth/provider.d.ts.map +1 -1
- package/lib/eth/provider.js +3 -3
- package/lib/eth/provider.js.map +1 -1
- package/lib/fuel/context.d.ts.map +1 -1
- package/lib/solana/solana-processor.d.ts +0 -1
- package/lib/solana/solana-processor.d.ts.map +1 -1
- package/lib/store/codegen.d.ts +0 -2
- package/lib/store/codegen.d.ts.map +1 -1
- package/lib/store/codegen.js +137 -170
- package/lib/store/codegen.js.map +1 -1
- package/lib/store/convert.d.ts +10 -10
- package/lib/store/convert.d.ts.map +1 -1
- package/lib/store/convert.js +75 -31
- package/lib/store/convert.js.map +1 -1
- package/lib/store/convert.test.js.map +1 -1
- package/lib/store/decorators.d.ts +24 -7
- package/lib/store/decorators.d.ts.map +1 -1
- package/lib/store/decorators.js +160 -16
- package/lib/store/decorators.js.map +1 -1
- package/lib/store/index.d.ts +0 -1
- package/lib/store/index.d.ts.map +1 -1
- package/lib/store/index.js +0 -1
- package/lib/store/index.js.map +1 -1
- package/lib/store/schema.d.ts.map +1 -1
- package/lib/store/schema.js +39 -1
- package/lib/store/schema.js.map +1 -1
- package/lib/store/store.d.ts +11 -5
- package/lib/store/store.d.ts.map +1 -1
- package/lib/store/store.js +41 -19
- package/lib/store/store.js.map +1 -1
- package/lib/store/types.d.ts +22 -3
- package/lib/store/types.d.ts.map +1 -1
- package/lib/store/types.js +14 -1
- package/lib/store/types.js.map +1 -1
- package/lib/utils/price.d.ts +30 -30
- package/lib/utils/price.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/eth/provider.ts +8 -3
- package/src/store/codegen.ts +171 -196
- package/src/store/convert.ts +84 -34
- package/src/store/decorators.ts +185 -16
- package/src/store/index.ts +0 -1
- package/src/store/schema.ts +41 -1
- package/src/store/store.ts +56 -25
- package/src/store/types.ts +25 -3
- package/lib/store/entity.d.ts +0 -23
- package/lib/store/entity.d.ts.map +0 -1
- package/lib/store/entity.js +0 -70
- package/lib/store/entity.js.map +0 -1
- package/src/store/entity.ts +0 -84
package/lib/store/store.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
import { Entity } from './entity.js';
|
2
1
|
import { DatabaseSchema } from '../core/index.js';
|
3
2
|
import { BigDecimal } from '@sentio/bigdecimal';
|
4
3
|
import { DBRequest_DBOperator } from '@sentio/protos';
|
5
4
|
import { toBigInteger } from './convert.js';
|
5
|
+
import { PluginManager } from '@sentio/runtime';
|
6
6
|
export class Store {
|
7
7
|
context;
|
8
8
|
constructor(context) {
|
@@ -12,31 +12,43 @@ export class Store {
|
|
12
12
|
const promise = this.context.sendRequest({
|
13
13
|
get: {
|
14
14
|
entity: typeof entity == 'string' ? entity : entity.prototype.entityName,
|
15
|
-
id
|
15
|
+
id: id.toString()
|
16
16
|
}
|
17
17
|
});
|
18
18
|
const data = (await promise);
|
19
|
-
if (data.
|
20
|
-
const entityData = data.entities
|
19
|
+
if (data.entityList?.entities[0]) {
|
20
|
+
const entityData = data.entityList?.entities[0];
|
21
21
|
return this.newEntity(entity, entityData);
|
22
22
|
}
|
23
23
|
return undefined;
|
24
24
|
}
|
25
25
|
async delete(entity, id) {
|
26
|
-
const
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
const request = {
|
27
|
+
entity: [],
|
28
|
+
id: []
|
29
|
+
};
|
30
|
+
if (id) {
|
31
|
+
if (Array.isArray(id)) {
|
32
|
+
for (const i of id) {
|
33
|
+
const items = entity.prototype.entityName;
|
34
|
+
request.entity.push(items);
|
35
|
+
request.id.push(i.toString());
|
36
|
+
}
|
37
|
+
}
|
38
|
+
else {
|
39
|
+
request.entity.push(entity.prototype.entityName);
|
40
|
+
request.id.push(id);
|
30
41
|
}
|
31
42
|
}
|
32
43
|
else {
|
33
|
-
|
44
|
+
const entities = Array.isArray(entity) ? entity : [entity];
|
45
|
+
for (const e of entities) {
|
46
|
+
request.entity.push(e.constructor.prototype.entityName);
|
47
|
+
request.id.push(e.id.toString());
|
48
|
+
}
|
34
49
|
}
|
35
50
|
await this.context.sendRequest({
|
36
|
-
delete:
|
37
|
-
entity: toBeDeleted.map((e) => e.entity),
|
38
|
-
id: toBeDeleted.map((e) => e.id)
|
39
|
-
}
|
51
|
+
delete: request
|
40
52
|
});
|
41
53
|
}
|
42
54
|
async upsert(entity) {
|
@@ -45,8 +57,8 @@ export class Store {
|
|
45
57
|
upsert: {
|
46
58
|
entity: entities.map((e) => e.constructor.prototype.entityName),
|
47
59
|
// data: entities.map((e) => serialize(e.data)),
|
48
|
-
id: entities.map((e) => e.id),
|
49
|
-
entityData: entities.map((e) => e.
|
60
|
+
id: entities.map((e) => e.id.toString()),
|
61
|
+
entityData: entities.map((e) => e._data)
|
50
62
|
}
|
51
63
|
});
|
52
64
|
await promise;
|
@@ -66,7 +78,7 @@ export class Store {
|
|
66
78
|
}
|
67
79
|
});
|
68
80
|
const response = (await promise);
|
69
|
-
for (const data of response.
|
81
|
+
for (const data of response.entityList?.entities || []) {
|
70
82
|
yield this.newEntity(entity, data);
|
71
83
|
}
|
72
84
|
if (!response.nextCursor) {
|
@@ -77,15 +89,18 @@ export class Store {
|
|
77
89
|
}
|
78
90
|
newEntity(entity, data) {
|
79
91
|
if (typeof entity == 'string') {
|
80
|
-
|
92
|
+
let en = DatabaseSchema.findEntity(entity);
|
81
93
|
if (!en) {
|
82
94
|
// it is an interface
|
83
|
-
|
95
|
+
en = DatabaseSchema.findEntity(data.entity);
|
96
|
+
if (!en) {
|
97
|
+
throw new Error(`Entity ${entity} not found`);
|
98
|
+
}
|
84
99
|
}
|
85
100
|
entity = en;
|
86
101
|
}
|
87
102
|
const res = new entity({});
|
88
|
-
res.
|
103
|
+
res._data = data.data;
|
89
104
|
return res;
|
90
105
|
}
|
91
106
|
}
|
@@ -142,4 +157,11 @@ function serializeBigDecimal(v) {
|
|
142
157
|
bigdecimalValue: undefined
|
143
158
|
};
|
144
159
|
}
|
160
|
+
export function getStore() {
|
161
|
+
const dbContext = PluginManager.INSTANCE.dbContextLocalStorage.getStore();
|
162
|
+
if (dbContext) {
|
163
|
+
return new Store(dbContext);
|
164
|
+
}
|
165
|
+
return undefined;
|
166
|
+
}
|
145
167
|
//# sourceMappingURL=store.js.map
|
package/lib/store/store.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/store/store.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/store/store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAG/C,OAAO,EAAE,oBAAoB,EAAc,MAAM,gBAAgB,CAAA;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAY/C,MAAM,OAAO,KAAK;IACa;IAA7B,YAA6B,OAAqB;QAArB,YAAO,GAAP,OAAO,CAAc;IAAG,CAAC;IAEtD,KAAK,CAAC,GAAG,CAAmB,MAA+B,EAAE,EAAM;QACjE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;YACvC,GAAG,EAAE;gBACH,MAAM,EAAE,OAAO,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,U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AAU,EAAE,CAAC;QAC5B,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAA;IAC/B,CAAC;IAED,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC;QACtB,OAAO;YACL,cAAc,EAAE,CAAC;SAClB,CAAA;IACH,CAAC;IAED,IAAI,CAAC,YAAY,UAAU,EAAE,CAAC;QAC5B,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,CAAA;IAC1B,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QACrB,OAAO;YACL,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE;SAClD,CAAA;IACH,CAAC;IACD,OAAO;QACL,SAAS,EAAE,CAAC;KACb,CAAA;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,CAAa;IACxC,OAAO;QACL,eAAe,EAAE,SAAS;KAC3B,CAAA;AACH,CAAC;AAED,MAAM,UAAU,QAAQ;IACtB,MAAM,SAAS,GAAG,aAAa,CAAC,QAAQ,CAAC,qBAAqB,CAAC,QAAQ,EAAE,CAAA;IACzE,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,IAAI,KAAK,CAAC,SAAS,CAAC,CAAA;IAC7B,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
package/lib/store/types.d.ts
CHANGED
@@ -1,8 +1,27 @@
|
|
1
|
-
export type ID = string
|
1
|
+
export type ID = (string | Uint8Array) & {
|
2
|
+
__id__?: void;
|
3
|
+
};
|
2
4
|
export type String = string;
|
3
|
-
export type Int = number
|
5
|
+
export type Int = number & {
|
6
|
+
__int__?: void;
|
7
|
+
};
|
4
8
|
export type Float = number;
|
5
9
|
export type Boolean = boolean;
|
6
|
-
export type
|
10
|
+
export type Timestamp = Date;
|
7
11
|
export type Bytes = Uint8Array;
|
12
|
+
export type BigInt = bigint;
|
13
|
+
export declare class Struct<T = unknown, S = unknown> {
|
14
|
+
readonly schema: S;
|
15
|
+
readonly TYPE: T;
|
16
|
+
constructor(schema: S);
|
17
|
+
}
|
18
|
+
export type Infer<T extends Struct<any>> = T['TYPE'];
|
19
|
+
export type ObjectSchema = Record<string, Struct<any, any>>;
|
20
|
+
export declare function object<S extends ObjectSchema>(schema: S): Struct<ObjectType<S>, S>;
|
21
|
+
export type Simplify<T> = T extends any[] | Date ? T : {
|
22
|
+
[K in keyof T]: T[K];
|
23
|
+
} & NonNullable<unknown>;
|
24
|
+
export type ObjectType<S extends ObjectSchema> = Simplify<{
|
25
|
+
[K in keyof S]: Infer<S[K]>;
|
26
|
+
}>;
|
8
27
|
//# sourceMappingURL=types.d.ts.map
|
package/lib/store/types.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/store/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,EAAE,GAAG,MAAM,CAAA;
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/store/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,UAAU,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,IAAI,CAAA;CAAE,CAAA;AAC1D,MAAM,MAAM,MAAM,GAAG,MAAM,CAAA;AAC3B,MAAM,MAAM,GAAG,GAAG,MAAM,GAAG;IAAE,OAAO,CAAC,EAAE,IAAI,CAAA;CAAE,CAAA;AAC7C,MAAM,MAAM,KAAK,GAAG,MAAM,CAAA;AAC1B,MAAM,MAAM,OAAO,GAAG,OAAO,CAAA;AAC7B,MAAM,MAAM,SAAS,GAAG,IAAI,CAAA;AAC5B,MAAM,MAAM,KAAK,GAAG,UAAU,CAAA;AAC9B,MAAM,MAAM,MAAM,GAAG,MAAM,CAAA;AAE3B,qBAAa,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO;IAE9B,QAAQ,CAAC,MAAM,EAAE,CAAC;IAD9B,QAAQ,CAAC,IAAI,EAAG,CAAC,CAAA;gBACI,MAAM,EAAE,CAAC;CAC/B;AACD,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAA;AACpD,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;AAE3D,wBAAgB,MAAM,CAAC,CAAC,SAAS,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAElF;AAED,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,GAAG,EAAE,GAAG,IAAI,GAAG,CAAC,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;AAEtG,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,YAAY,IAAI,QAAQ,CAAC;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC,CAAA"}
|
package/lib/store/types.js
CHANGED
@@ -1,2 +1,15 @@
|
|
1
|
-
export {
|
1
|
+
export class Struct {
|
2
|
+
schema;
|
3
|
+
TYPE;
|
4
|
+
constructor(schema) {
|
5
|
+
this.schema = schema;
|
6
|
+
}
|
7
|
+
}
|
8
|
+
export function object(schema) {
|
9
|
+
return new Struct(schema ?? null);
|
10
|
+
}
|
11
|
+
const StringStruct = new Struct(null);
|
12
|
+
const UU = object({
|
13
|
+
test: StringStruct
|
14
|
+
});
|
2
15
|
//# sourceMappingURL=types.js.map
|
package/lib/store/types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/store/types.ts"],"names":[],"mappings":""}
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/store/types.ts"],"names":[],"mappings":"AASA,MAAM,OAAO,MAAM;IAEI;IADZ,IAAI,CAAI;IACjB,YAAqB,MAAS;QAAT,WAAM,GAAN,MAAM,CAAG;IAAG,CAAC;CACnC;AAID,MAAM,UAAU,MAAM,CAAyB,MAAS;IACtD,OAAO,IAAI,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,CAAA;AACnC,CAAC;AAMD,MAAM,YAAY,GAAG,IAAI,MAAM,CAAe,IAAI,CAAC,CAAA;AAEnD,MAAM,EAAE,GAAG,MAAM,CAAC;IAChB,IAAI,EAAE,YAAY;CACnB,CAAC,CAAA"}
|
package/lib/utils/price.d.ts
CHANGED
@@ -9,8 +9,8 @@ export declare function getPriceClient(address?: string): import("nice-grpc").Ra
|
|
9
9
|
readonly getPrice: {
|
10
10
|
readonly name: "GetPrice";
|
11
11
|
readonly requestType: {
|
12
|
-
encode(message: import("@sentio/protos/price").GetPriceRequest, writer?: import("protobufjs").Writer
|
13
|
-
decode(input:
|
12
|
+
encode(message: import("@sentio/protos/price").GetPriceRequest, writer?: import("protobufjs").Writer): import("protobufjs").Writer;
|
13
|
+
decode(input: import("protobufjs").Reader | Uint8Array, length?: number): import("@sentio/protos/price").GetPriceRequest;
|
14
14
|
fromJSON(object: any): import("@sentio/protos/price").GetPriceRequest;
|
15
15
|
toJSON(message: import("@sentio/protos/price").GetPriceRequest): unknown;
|
16
16
|
create(base?: {
|
@@ -23,7 +23,7 @@ export declare function getPriceClient(address?: string): import("nice-grpc").Ra
|
|
23
23
|
} | undefined;
|
24
24
|
} | undefined;
|
25
25
|
source?: string | undefined;
|
26
|
-
}
|
26
|
+
}): import("@sentio/protos/price").GetPriceRequest;
|
27
27
|
fromPartial(object: {
|
28
28
|
timestamp?: Date | undefined;
|
29
29
|
coinId?: {
|
@@ -38,14 +38,14 @@ export declare function getPriceClient(address?: string): import("nice-grpc").Ra
|
|
38
38
|
};
|
39
39
|
readonly requestStream: false;
|
40
40
|
readonly responseType: {
|
41
|
-
encode(message: import("@sentio/protos/price").GetPriceResponse, writer?: import("protobufjs").Writer
|
42
|
-
decode(input:
|
41
|
+
encode(message: import("@sentio/protos/price").GetPriceResponse, writer?: import("protobufjs").Writer): import("protobufjs").Writer;
|
42
|
+
decode(input: import("protobufjs").Reader | Uint8Array, length?: number): import("@sentio/protos/price").GetPriceResponse;
|
43
43
|
fromJSON(object: any): import("@sentio/protos/price").GetPriceResponse;
|
44
44
|
toJSON(message: import("@sentio/protos/price").GetPriceResponse): unknown;
|
45
45
|
create(base?: {
|
46
46
|
price?: number | undefined;
|
47
47
|
timestamp?: Date | undefined;
|
48
|
-
}
|
48
|
+
}): import("@sentio/protos/price").GetPriceResponse;
|
49
49
|
fromPartial(object: {
|
50
50
|
price?: number | undefined;
|
51
51
|
timestamp?: Date | undefined;
|
@@ -61,8 +61,8 @@ export declare function getPriceClient(address?: string): import("nice-grpc").Ra
|
|
61
61
|
readonly batchGetPrices: {
|
62
62
|
readonly name: "BatchGetPrices";
|
63
63
|
readonly requestType: {
|
64
|
-
encode(message: import("@sentio/protos/price").BatchGetPricesRequest, writer?: import("protobufjs").Writer
|
65
|
-
decode(input:
|
64
|
+
encode(message: import("@sentio/protos/price").BatchGetPricesRequest, writer?: import("protobufjs").Writer): import("protobufjs").Writer;
|
65
|
+
decode(input: import("protobufjs").Reader | Uint8Array, length?: number): import("@sentio/protos/price").BatchGetPricesRequest;
|
66
66
|
fromJSON(object: any): import("@sentio/protos/price").BatchGetPricesRequest;
|
67
67
|
toJSON(message: import("@sentio/protos/price").BatchGetPricesRequest): unknown;
|
68
68
|
create(base?: {
|
@@ -74,7 +74,7 @@ export declare function getPriceClient(address?: string): import("nice-grpc").Ra
|
|
74
74
|
chain?: string | undefined;
|
75
75
|
} | undefined;
|
76
76
|
}[] | undefined;
|
77
|
-
}
|
77
|
+
}): import("@sentio/protos/price").BatchGetPricesRequest;
|
78
78
|
fromPartial(object: {
|
79
79
|
timestamps?: Date[] | undefined;
|
80
80
|
coinIds?: {
|
@@ -88,8 +88,8 @@ export declare function getPriceClient(address?: string): import("nice-grpc").Ra
|
|
88
88
|
};
|
89
89
|
readonly requestStream: false;
|
90
90
|
readonly responseType: {
|
91
|
-
encode(message: import("@sentio/protos/price").BatchGetPricesResponse, writer?: import("protobufjs").Writer
|
92
|
-
decode(input:
|
91
|
+
encode(message: import("@sentio/protos/price").BatchGetPricesResponse, writer?: import("protobufjs").Writer): import("protobufjs").Writer;
|
92
|
+
decode(input: import("protobufjs").Reader | Uint8Array, length?: number): import("@sentio/protos/price").BatchGetPricesResponse;
|
93
93
|
fromJSON(object: any): import("@sentio/protos/price").BatchGetPricesResponse;
|
94
94
|
toJSON(message: import("@sentio/protos/price").BatchGetPricesResponse): unknown;
|
95
95
|
create(base?: {
|
@@ -109,7 +109,7 @@ export declare function getPriceClient(address?: string): import("nice-grpc").Ra
|
|
109
109
|
} | undefined;
|
110
110
|
error?: string | undefined;
|
111
111
|
}[] | undefined;
|
112
|
-
}
|
112
|
+
}): import("@sentio/protos/price").BatchGetPricesResponse;
|
113
113
|
fromPartial(object: {
|
114
114
|
prices?: {
|
115
115
|
coinId?: {
|
@@ -139,8 +139,8 @@ export declare function getPriceClient(address?: string): import("nice-grpc").Ra
|
|
139
139
|
readonly listCoins: {
|
140
140
|
readonly name: "ListCoins";
|
141
141
|
readonly requestType: {
|
142
|
-
encode(message: import("@sentio/protos/price").ListCoinsRequest, writer?: import("protobufjs").Writer
|
143
|
-
decode(input:
|
142
|
+
encode(message: import("@sentio/protos/price").ListCoinsRequest, writer?: import("protobufjs").Writer): import("protobufjs").Writer;
|
143
|
+
decode(input: import("protobufjs").Reader | Uint8Array, length?: number): import("@sentio/protos/price").ListCoinsRequest;
|
144
144
|
fromJSON(object: any): import("@sentio/protos/price").ListCoinsRequest;
|
145
145
|
toJSON(message: import("@sentio/protos/price").ListCoinsRequest): unknown;
|
146
146
|
create(base?: {
|
@@ -148,7 +148,7 @@ export declare function getPriceClient(address?: string): import("nice-grpc").Ra
|
|
148
148
|
offset?: number | undefined;
|
149
149
|
searchQuery?: string | undefined;
|
150
150
|
chain?: string | undefined;
|
151
|
-
}
|
151
|
+
}): import("@sentio/protos/price").ListCoinsRequest;
|
152
152
|
fromPartial(object: {
|
153
153
|
limit?: number | undefined;
|
154
154
|
offset?: number | undefined;
|
@@ -158,8 +158,8 @@ export declare function getPriceClient(address?: string): import("nice-grpc").Ra
|
|
158
158
|
};
|
159
159
|
readonly requestStream: false;
|
160
160
|
readonly responseType: {
|
161
|
-
encode(message: import("@sentio/protos/price").ListCoinsResponse, writer?: import("protobufjs").Writer
|
162
|
-
decode(input:
|
161
|
+
encode(message: import("@sentio/protos/price").ListCoinsResponse, writer?: import("protobufjs").Writer): import("protobufjs").Writer;
|
162
|
+
decode(input: import("protobufjs").Reader | Uint8Array, length?: number): import("@sentio/protos/price").ListCoinsResponse;
|
163
163
|
fromJSON(object: any): import("@sentio/protos/price").ListCoinsResponse;
|
164
164
|
toJSON(message: import("@sentio/protos/price").ListCoinsResponse): unknown;
|
165
165
|
create(base?: {
|
@@ -179,7 +179,7 @@ export declare function getPriceClient(address?: string): import("nice-grpc").Ra
|
|
179
179
|
} | undefined;
|
180
180
|
} | undefined;
|
181
181
|
} | undefined;
|
182
|
-
}
|
182
|
+
}): import("@sentio/protos/price").ListCoinsResponse;
|
183
183
|
fromPartial(object: {
|
184
184
|
coins?: {
|
185
185
|
symbol?: string | undefined;
|
@@ -209,17 +209,17 @@ export declare function getPriceClient(address?: string): import("nice-grpc").Ra
|
|
209
209
|
readonly checkLatestPrice: {
|
210
210
|
readonly name: "CheckLatestPrice";
|
211
211
|
readonly requestType: {
|
212
|
-
encode(_: import("@sentio/protos").Empty, writer?: import("protobufjs").Writer
|
213
|
-
decode(input:
|
212
|
+
encode(_: import("@sentio/protos").Empty, writer?: import("protobufjs").Writer): import("protobufjs").Writer;
|
213
|
+
decode(input: import("protobufjs").Reader | Uint8Array, length?: number): import("@sentio/protos").Empty;
|
214
214
|
fromJSON(_: any): import("@sentio/protos").Empty;
|
215
215
|
toJSON(_: import("@sentio/protos").Empty): unknown;
|
216
|
-
create(base?: {}
|
216
|
+
create(base?: {}): import("@sentio/protos").Empty;
|
217
217
|
fromPartial(_: {}): import("@sentio/protos").Empty;
|
218
218
|
};
|
219
219
|
readonly requestStream: false;
|
220
220
|
readonly responseType: {
|
221
|
-
encode(message: import("@sentio/protos/price").CheckLatestPriceResponse, writer?: import("protobufjs").Writer
|
222
|
-
decode(input:
|
221
|
+
encode(message: import("@sentio/protos/price").CheckLatestPriceResponse, writer?: import("protobufjs").Writer): import("protobufjs").Writer;
|
222
|
+
decode(input: import("protobufjs").Reader | Uint8Array, length?: number): import("@sentio/protos/price").CheckLatestPriceResponse;
|
223
223
|
fromJSON(object: any): import("@sentio/protos/price").CheckLatestPriceResponse;
|
224
224
|
toJSON(message: import("@sentio/protos/price").CheckLatestPriceResponse): unknown;
|
225
225
|
create(base?: {
|
@@ -245,7 +245,7 @@ export declare function getPriceClient(address?: string): import("nice-grpc").Ra
|
|
245
245
|
price?: number | undefined;
|
246
246
|
timestamp?: Date | undefined;
|
247
247
|
} | undefined;
|
248
|
-
}
|
248
|
+
}): import("@sentio/protos/price").CheckLatestPriceResponse;
|
249
249
|
fromPartial(object: {
|
250
250
|
prices?: {
|
251
251
|
coinId?: {
|
@@ -281,8 +281,8 @@ export declare function getPriceClient(address?: string): import("nice-grpc").Ra
|
|
281
281
|
readonly backfillCoin: {
|
282
282
|
readonly name: "BackfillCoin";
|
283
283
|
readonly requestType: {
|
284
|
-
encode(message: import("@sentio/protos/price").BackfillCoinRequest, writer?: import("protobufjs").Writer
|
285
|
-
decode(input:
|
284
|
+
encode(message: import("@sentio/protos/price").BackfillCoinRequest, writer?: import("protobufjs").Writer): import("protobufjs").Writer;
|
285
|
+
decode(input: import("protobufjs").Reader | Uint8Array, length?: number): import("@sentio/protos/price").BackfillCoinRequest;
|
286
286
|
fromJSON(object: any): import("@sentio/protos/price").BackfillCoinRequest;
|
287
287
|
toJSON(message: import("@sentio/protos/price").BackfillCoinRequest): unknown;
|
288
288
|
create(base?: {
|
@@ -297,7 +297,7 @@ export declare function getPriceClient(address?: string): import("nice-grpc").Ra
|
|
297
297
|
accountAddress?: string | undefined;
|
298
298
|
moduleName?: string | undefined;
|
299
299
|
structName?: string | undefined;
|
300
|
-
}
|
300
|
+
}): import("@sentio/protos/price").BackfillCoinRequest;
|
301
301
|
fromPartial(object: {
|
302
302
|
name?: string | undefined;
|
303
303
|
symbol?: string | undefined;
|
@@ -314,14 +314,14 @@ export declare function getPriceClient(address?: string): import("nice-grpc").Ra
|
|
314
314
|
};
|
315
315
|
readonly requestStream: false;
|
316
316
|
readonly responseType: {
|
317
|
-
encode(message: import("@sentio/protos/price").BackfillCoinResponse, writer?: import("protobufjs").Writer
|
318
|
-
decode(input:
|
317
|
+
encode(message: import("@sentio/protos/price").BackfillCoinResponse, writer?: import("protobufjs").Writer): import("protobufjs").Writer;
|
318
|
+
decode(input: import("protobufjs").Reader | Uint8Array, length?: number): import("@sentio/protos/price").BackfillCoinResponse;
|
319
319
|
fromJSON(object: any): import("@sentio/protos/price").BackfillCoinResponse;
|
320
320
|
toJSON(message: import("@sentio/protos/price").BackfillCoinResponse): unknown;
|
321
321
|
create(base?: {
|
322
322
|
symbol?: string | undefined;
|
323
323
|
message?: string | undefined;
|
324
|
-
}
|
324
|
+
}): import("@sentio/protos/price").BackfillCoinResponse;
|
325
325
|
fromPartial(object: {
|
326
326
|
symbol?: string | undefined;
|
327
327
|
message?: string | undefined;
|
package/lib/utils/price.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../src/utils/price.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA0B,MAAM,sBAAsB,CAAA;AACjF,OAAO,E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;;;;;;;;;;;;;;;;;;;;;;;;;;2FAAiT,CAAC;8EAAwF,CAAC;;;2BAAyL,CAAC;;;;;;;;;;;;;;;;;kBAjJ/qX;AASD,UAAU,YAAY;IACpB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAQD,wBAAsB,8BAA8B,CAClD,WAAW,EAAE,kBAAkB,CAAC,YAAY,CAAC,EAC7C,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA2D7B;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,IAAI,EACV,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAW7B;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAE7B;AAMD;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,OAAO,oDAa1D"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sentio/sdk",
|
3
|
-
"version": "2.39.4-rc.
|
3
|
+
"version": "2.39.4-rc.11",
|
4
4
|
"license": "Apache-2.0",
|
5
5
|
"type": "module",
|
6
6
|
"exports": {
|
@@ -77,13 +77,14 @@
|
|
77
77
|
"prettier": "^3.2.4",
|
78
78
|
"prettier2": "npm:prettier@2.8.8",
|
79
79
|
"radash": "^12.0.0",
|
80
|
+
"reflect-metadata": "^0.2.2",
|
80
81
|
"superstruct_solana": "npm:superstruct@^0.14.2",
|
81
82
|
"typechain": "^8.3.2",
|
82
83
|
"typedoc": "^0.25.7",
|
83
84
|
"utility-types": "^3.11.0",
|
84
85
|
"yaml": "^2.3.4",
|
85
|
-
"@sentio/protos": "2.39.4-rc.
|
86
|
-
"@sentio/runtime": "^2.39.4-rc.
|
86
|
+
"@sentio/protos": "2.39.4-rc.11",
|
87
|
+
"@sentio/runtime": "^2.39.4-rc.11"
|
87
88
|
},
|
88
89
|
"peerDependencies": {
|
89
90
|
"tsup": "npm:@sentio/tsup@^6.7.2"
|
package/src/eth/provider.ts
CHANGED
@@ -43,7 +43,12 @@ export function getProvider(chainId?: EthChainId): Provider {
|
|
43
43
|
[...Endpoints.INSTANCE.chainServer.keys()].join(' ')
|
44
44
|
)
|
45
45
|
}
|
46
|
-
provider = new QueuedStaticJsonRpcProvider(
|
46
|
+
provider = new QueuedStaticJsonRpcProvider(
|
47
|
+
address,
|
48
|
+
network,
|
49
|
+
Endpoints.INSTANCE.concurrency,
|
50
|
+
Endpoints.INSTANCE.batchCount
|
51
|
+
)
|
47
52
|
providers.set(key, provider)
|
48
53
|
return provider
|
49
54
|
}
|
@@ -97,9 +102,9 @@ class QueuedStaticJsonRpcProvider extends JsonRpcProvider {
|
|
97
102
|
totalDuration = 0
|
98
103
|
totalQueued = 0
|
99
104
|
|
100
|
-
constructor(url: string, network: Network, concurrency: number) {
|
105
|
+
constructor(url: string, network: Network, concurrency: number, batchCount = 1) {
|
101
106
|
// TODO re-enable match when possible
|
102
|
-
super(url, network, { staticNetwork: network, batchMaxCount:
|
107
|
+
super(url, network, { staticNetwork: network, batchMaxCount: batchCount })
|
103
108
|
this.executor = new PQueue({ concurrency: concurrency })
|
104
109
|
}
|
105
110
|
|