@sentio/sdk 1.31.5 → 1.32.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.
- package/lib/aptos/aptos-processor.d.ts +5 -5
- package/lib/aptos/aptos-processor.js +7 -4
- package/lib/aptos/aptos-processor.js.map +1 -1
- package/lib/cli/commands/login-server.js +4 -5
- package/lib/cli/commands/login-server.js.map +1 -1
- package/lib/cli/commands/run-login.js +12 -3
- package/lib/cli/commands/run-login.js.map +1 -1
- package/lib/cli/config.js +13 -18
- package/lib/cli/config.js.map +1 -1
- package/lib/core/base-processor-template.d.ts +6 -5
- package/lib/core/base-processor-template.js +7 -4
- package/lib/core/base-processor-template.js.map +1 -1
- package/lib/core/base-processor.d.ts +6 -6
- package/lib/core/base-processor.js +7 -4
- package/lib/core/base-processor.js.map +1 -1
- package/lib/core/logger.js +1 -1
- package/lib/core/logger.js.map +1 -1
- package/lib/gen/chainquery/protos/chainquery.d.ts +106 -0
- package/lib/gen/chainquery/protos/chainquery.js +377 -2
- package/lib/gen/chainquery/protos/chainquery.js.map +1 -1
- package/lib/gen/processor/protos/processor.d.ts +13 -0
- package/lib/gen/processor/protos/processor.js +101 -3
- package/lib/gen/processor/protos/processor.js.map +1 -1
- package/lib/service.js +8 -4
- package/lib/service.js.map +1 -1
- package/lib/utils/chain.d.ts +2 -2
- package/lib/utils/chain.js +6 -4
- package/lib/utils/chain.js.map +1 -1
- package/package.json +2 -1
- package/src/aptos/aptos-processor.ts +22 -7
- package/src/cli/commands/login-server.ts +4 -5
- package/src/cli/commands/run-login.ts +13 -3
- package/src/cli/config.ts +14 -18
- package/src/core/base-processor-template.ts +18 -9
- package/src/core/base-processor.ts +18 -9
- package/src/core/logger.ts +1 -1
- package/src/gen/chainquery/protos/chainquery.ts +479 -1
- package/src/gen/processor/protos/processor.ts +124 -1
- package/src/service.ts +8 -5
- package/src/utils/chain.ts +8 -6
|
@@ -315,10 +315,17 @@ export interface AccountConfig {
|
|
|
315
315
|
logConfigs: LogHandlerConfig[];
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
+
export interface HandleInterval {
|
|
319
|
+
recentInterval: number;
|
|
320
|
+
backfillInterval: number;
|
|
321
|
+
}
|
|
322
|
+
|
|
318
323
|
export interface OnIntervalConfig {
|
|
319
324
|
handlerId: number;
|
|
320
325
|
minutes: number;
|
|
326
|
+
minutesInterval?: HandleInterval | undefined;
|
|
321
327
|
slot: number;
|
|
328
|
+
slotInterval?: HandleInterval | undefined;
|
|
322
329
|
}
|
|
323
330
|
|
|
324
331
|
export interface AptosOnIntervalConfig {
|
|
@@ -1803,8 +1810,81 @@ export const AccountConfig = {
|
|
|
1803
1810
|
},
|
|
1804
1811
|
};
|
|
1805
1812
|
|
|
1813
|
+
function createBaseHandleInterval(): HandleInterval {
|
|
1814
|
+
return { recentInterval: 0, backfillInterval: 0 };
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1817
|
+
export const HandleInterval = {
|
|
1818
|
+
encode(
|
|
1819
|
+
message: HandleInterval,
|
|
1820
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
1821
|
+
): _m0.Writer {
|
|
1822
|
+
if (message.recentInterval !== 0) {
|
|
1823
|
+
writer.uint32(8).int32(message.recentInterval);
|
|
1824
|
+
}
|
|
1825
|
+
if (message.backfillInterval !== 0) {
|
|
1826
|
+
writer.uint32(16).int32(message.backfillInterval);
|
|
1827
|
+
}
|
|
1828
|
+
return writer;
|
|
1829
|
+
},
|
|
1830
|
+
|
|
1831
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): HandleInterval {
|
|
1832
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
1833
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1834
|
+
const message = createBaseHandleInterval();
|
|
1835
|
+
while (reader.pos < end) {
|
|
1836
|
+
const tag = reader.uint32();
|
|
1837
|
+
switch (tag >>> 3) {
|
|
1838
|
+
case 1:
|
|
1839
|
+
message.recentInterval = reader.int32();
|
|
1840
|
+
break;
|
|
1841
|
+
case 2:
|
|
1842
|
+
message.backfillInterval = reader.int32();
|
|
1843
|
+
break;
|
|
1844
|
+
default:
|
|
1845
|
+
reader.skipType(tag & 7);
|
|
1846
|
+
break;
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
return message;
|
|
1850
|
+
},
|
|
1851
|
+
|
|
1852
|
+
fromJSON(object: any): HandleInterval {
|
|
1853
|
+
return {
|
|
1854
|
+
recentInterval: isSet(object.recentInterval)
|
|
1855
|
+
? Number(object.recentInterval)
|
|
1856
|
+
: 0,
|
|
1857
|
+
backfillInterval: isSet(object.backfillInterval)
|
|
1858
|
+
? Number(object.backfillInterval)
|
|
1859
|
+
: 0,
|
|
1860
|
+
};
|
|
1861
|
+
},
|
|
1862
|
+
|
|
1863
|
+
toJSON(message: HandleInterval): unknown {
|
|
1864
|
+
const obj: any = {};
|
|
1865
|
+
message.recentInterval !== undefined &&
|
|
1866
|
+
(obj.recentInterval = Math.round(message.recentInterval));
|
|
1867
|
+
message.backfillInterval !== undefined &&
|
|
1868
|
+
(obj.backfillInterval = Math.round(message.backfillInterval));
|
|
1869
|
+
return obj;
|
|
1870
|
+
},
|
|
1871
|
+
|
|
1872
|
+
fromPartial(object: DeepPartial<HandleInterval>): HandleInterval {
|
|
1873
|
+
const message = createBaseHandleInterval();
|
|
1874
|
+
message.recentInterval = object.recentInterval ?? 0;
|
|
1875
|
+
message.backfillInterval = object.backfillInterval ?? 0;
|
|
1876
|
+
return message;
|
|
1877
|
+
},
|
|
1878
|
+
};
|
|
1879
|
+
|
|
1806
1880
|
function createBaseOnIntervalConfig(): OnIntervalConfig {
|
|
1807
|
-
return {
|
|
1881
|
+
return {
|
|
1882
|
+
handlerId: 0,
|
|
1883
|
+
minutes: 0,
|
|
1884
|
+
minutesInterval: undefined,
|
|
1885
|
+
slot: 0,
|
|
1886
|
+
slotInterval: undefined,
|
|
1887
|
+
};
|
|
1808
1888
|
}
|
|
1809
1889
|
|
|
1810
1890
|
export const OnIntervalConfig = {
|
|
@@ -1818,9 +1898,21 @@ export const OnIntervalConfig = {
|
|
|
1818
1898
|
if (message.minutes !== 0) {
|
|
1819
1899
|
writer.uint32(16).int32(message.minutes);
|
|
1820
1900
|
}
|
|
1901
|
+
if (message.minutesInterval !== undefined) {
|
|
1902
|
+
HandleInterval.encode(
|
|
1903
|
+
message.minutesInterval,
|
|
1904
|
+
writer.uint32(34).fork()
|
|
1905
|
+
).ldelim();
|
|
1906
|
+
}
|
|
1821
1907
|
if (message.slot !== 0) {
|
|
1822
1908
|
writer.uint32(24).int32(message.slot);
|
|
1823
1909
|
}
|
|
1910
|
+
if (message.slotInterval !== undefined) {
|
|
1911
|
+
HandleInterval.encode(
|
|
1912
|
+
message.slotInterval,
|
|
1913
|
+
writer.uint32(42).fork()
|
|
1914
|
+
).ldelim();
|
|
1915
|
+
}
|
|
1824
1916
|
return writer;
|
|
1825
1917
|
},
|
|
1826
1918
|
|
|
@@ -1837,9 +1929,18 @@ export const OnIntervalConfig = {
|
|
|
1837
1929
|
case 2:
|
|
1838
1930
|
message.minutes = reader.int32();
|
|
1839
1931
|
break;
|
|
1932
|
+
case 4:
|
|
1933
|
+
message.minutesInterval = HandleInterval.decode(
|
|
1934
|
+
reader,
|
|
1935
|
+
reader.uint32()
|
|
1936
|
+
);
|
|
1937
|
+
break;
|
|
1840
1938
|
case 3:
|
|
1841
1939
|
message.slot = reader.int32();
|
|
1842
1940
|
break;
|
|
1941
|
+
case 5:
|
|
1942
|
+
message.slotInterval = HandleInterval.decode(reader, reader.uint32());
|
|
1943
|
+
break;
|
|
1843
1944
|
default:
|
|
1844
1945
|
reader.skipType(tag & 7);
|
|
1845
1946
|
break;
|
|
@@ -1852,7 +1953,13 @@ export const OnIntervalConfig = {
|
|
|
1852
1953
|
return {
|
|
1853
1954
|
handlerId: isSet(object.handlerId) ? Number(object.handlerId) : 0,
|
|
1854
1955
|
minutes: isSet(object.minutes) ? Number(object.minutes) : 0,
|
|
1956
|
+
minutesInterval: isSet(object.minutesInterval)
|
|
1957
|
+
? HandleInterval.fromJSON(object.minutesInterval)
|
|
1958
|
+
: undefined,
|
|
1855
1959
|
slot: isSet(object.slot) ? Number(object.slot) : 0,
|
|
1960
|
+
slotInterval: isSet(object.slotInterval)
|
|
1961
|
+
? HandleInterval.fromJSON(object.slotInterval)
|
|
1962
|
+
: undefined,
|
|
1856
1963
|
};
|
|
1857
1964
|
},
|
|
1858
1965
|
|
|
@@ -1862,7 +1969,15 @@ export const OnIntervalConfig = {
|
|
|
1862
1969
|
(obj.handlerId = Math.round(message.handlerId));
|
|
1863
1970
|
message.minutes !== undefined &&
|
|
1864
1971
|
(obj.minutes = Math.round(message.minutes));
|
|
1972
|
+
message.minutesInterval !== undefined &&
|
|
1973
|
+
(obj.minutesInterval = message.minutesInterval
|
|
1974
|
+
? HandleInterval.toJSON(message.minutesInterval)
|
|
1975
|
+
: undefined);
|
|
1865
1976
|
message.slot !== undefined && (obj.slot = Math.round(message.slot));
|
|
1977
|
+
message.slotInterval !== undefined &&
|
|
1978
|
+
(obj.slotInterval = message.slotInterval
|
|
1979
|
+
? HandleInterval.toJSON(message.slotInterval)
|
|
1980
|
+
: undefined);
|
|
1866
1981
|
return obj;
|
|
1867
1982
|
},
|
|
1868
1983
|
|
|
@@ -1870,7 +1985,15 @@ export const OnIntervalConfig = {
|
|
|
1870
1985
|
const message = createBaseOnIntervalConfig();
|
|
1871
1986
|
message.handlerId = object.handlerId ?? 0;
|
|
1872
1987
|
message.minutes = object.minutes ?? 0;
|
|
1988
|
+
message.minutesInterval =
|
|
1989
|
+
object.minutesInterval !== undefined && object.minutesInterval !== null
|
|
1990
|
+
? HandleInterval.fromPartial(object.minutesInterval)
|
|
1991
|
+
: undefined;
|
|
1873
1992
|
message.slot = object.slot ?? 0;
|
|
1993
|
+
message.slotInterval =
|
|
1994
|
+
object.slotInterval !== undefined && object.slotInterval !== null
|
|
1995
|
+
? HandleInterval.fromPartial(object.slotInterval)
|
|
1996
|
+
: undefined;
|
|
1874
1997
|
return message;
|
|
1875
1998
|
},
|
|
1876
1999
|
};
|
package/src/service.ts
CHANGED
|
@@ -45,7 +45,6 @@ import { AccountProcessorState } from './core/account-processor'
|
|
|
45
45
|
import { SuiProcessorState } from './core/sui-processor'
|
|
46
46
|
import { SolanaProcessorState } from './core/solana-processor'
|
|
47
47
|
import { ProcessorState } from './binds'
|
|
48
|
-
|
|
49
48
|
;(BigInt.prototype as any).toJSON = function () {
|
|
50
49
|
return this.toString()
|
|
51
50
|
}
|
|
@@ -171,8 +170,10 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
171
170
|
// TODO wrap the block handler into one
|
|
172
171
|
|
|
173
172
|
contractConfig.intervalConfigs.push({
|
|
174
|
-
slot:
|
|
175
|
-
|
|
173
|
+
slot: 0,
|
|
174
|
+
slotInterval: blockHandler.blockInterval,
|
|
175
|
+
minutes: 0,
|
|
176
|
+
minutesInterval: blockHandler.timeIntervalInMinutes,
|
|
176
177
|
handlerId: handlerId,
|
|
177
178
|
})
|
|
178
179
|
}
|
|
@@ -387,8 +388,10 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
387
388
|
accountConfig.aptosIntervalConfigs.push({
|
|
388
389
|
intervalConfig: {
|
|
389
390
|
handlerId: handlerId,
|
|
390
|
-
minutes:
|
|
391
|
-
|
|
391
|
+
minutes: 0,
|
|
392
|
+
minutesInterval: handler.timeIntervalInMinutes,
|
|
393
|
+
slot: 0,
|
|
394
|
+
slotInterval: handler.versionInterval,
|
|
392
395
|
},
|
|
393
396
|
type: handler.type || '',
|
|
394
397
|
})
|
package/src/utils/chain.ts
CHANGED
|
@@ -95,18 +95,20 @@ export const APTOS_MAINNET_ID = 'aptos_mainnet'
|
|
|
95
95
|
CHAIN_MAP[APTOS_TESTNET_ID] = 'aptos-test'
|
|
96
96
|
CHAIN_MAP[APTOS_MAINNET_ID] = 'aptos-mainnet'
|
|
97
97
|
|
|
98
|
-
export function getChainName(chainId: string | number): string {
|
|
98
|
+
export function getChainName(chainId: string | number | null | undefined): string {
|
|
99
99
|
if (typeof chainId === 'number') {
|
|
100
100
|
chainId = chainId.toString()
|
|
101
101
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
if (chainId) {
|
|
103
|
+
const name = CHAIN_MAP[chainId]
|
|
104
|
+
if (name) {
|
|
105
|
+
return name
|
|
106
|
+
}
|
|
105
107
|
}
|
|
106
|
-
return chainId
|
|
108
|
+
return chainId || ''
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
export function getChainType(chainId
|
|
111
|
+
export function getChainType(chainId?: string | number): string {
|
|
110
112
|
const id = String(chainId).toLowerCase()
|
|
111
113
|
if (id.startsWith('sol')) {
|
|
112
114
|
return 'solana'
|