@sentio/sdk 1.37.5-rc.4 → 1.37.5-rc.6
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.
|
@@ -3,7 +3,7 @@ import { NamedResultDescriptor } from './metadata';
|
|
|
3
3
|
import { MapStateStorage } from '@sentio/runtime';
|
|
4
4
|
export interface Event {
|
|
5
5
|
distinctId: string;
|
|
6
|
-
|
|
6
|
+
[key: string]: any;
|
|
7
7
|
}
|
|
8
8
|
export interface TrackerOptions {
|
|
9
9
|
totalByDay?: boolean;
|
|
@@ -23,10 +23,11 @@ class EventTracker extends metadata_1.NamedResultDescriptor {
|
|
|
23
23
|
this.options = options;
|
|
24
24
|
}
|
|
25
25
|
trackEvent(ctx, event) {
|
|
26
|
+
const { distinctId, ...payload } = event;
|
|
26
27
|
const res = {
|
|
27
28
|
metadata: ctx.getMetaData(this.name, {}),
|
|
28
|
-
distinctEntityId:
|
|
29
|
-
attributes:
|
|
29
|
+
distinctEntityId: distinctId,
|
|
30
|
+
attributes: payload,
|
|
30
31
|
runtimeInfo: undefined,
|
|
31
32
|
};
|
|
32
33
|
ctx.res.events.push(res);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-tracker.js","sourceRoot":"","sources":["../../src/core/event-tracker.ts"],"names":[],"mappings":";;;AAEA,yCAAkD;AAClD,6CAAiD;AAgBjD,MAAa,iBAAkB,SAAQ,yBAA6B;IAClE,MAAM,CAAC,QAAQ,GAAG,IAAI,iBAAiB,EAAE,CAAA;;AAD3C,8CAEC;AAED,iDAAiD;AACjD,MAAa,YAAa,SAAQ,gCAAqB;IACrD,MAAM,CAAC,eAAe,GAAmB;QACvC,UAAU,EAAE,IAAI;QAChB,MAAM,EAAE,IAAI;KACb,CAAA;IAED,MAAM,CAAC,QAAQ,CAAC,SAAiB,EAAE,OAAwB;QACzD,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,SAAS,EAAE,EAAE,GAAG,YAAY,C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AAC,GAAgB,EAAE,KAAY;QACvC,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,EAAE,GAAG,KAAK,CAAA;QAExC,MAAM,GAAG,GAAwB;YAC/B,QAAQ,EAAE,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;YACxC,gBAAgB,EAAE,UAAU;YAC5B,UAAU,EAAE,OAAO;YACnB,WAAW,EAAE,SAAS;SACvB,CAAA;QACD,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC1B,CAAC;;AA3BH,oCA4BC;AAED,MAAa,mBAAoB,SAAQ,YAAY;IACnD,MAAM,CAAC,eAAe,GAAmB;QACvC,UAAU,EAAE,IAAI;QAChB,MAAM,EAAE,IAAI;QACZ,cAAc,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;KAC3B,CAAA;IAED,MAAM,CAAC,QAAQ,CAAC,SAAkB,EAAE,OAAwB;QAC1D,IAAI,SAAS,EAAE;YACb,SAAS,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;SAC1C;aAAM;YACL,SAAS,GAAG,MAAM,CAAA;SACnB;QACD,MAAM,OAAO,GAAG,IAAI,mBAAmB,CAAC,SAAS,EAAE,EAAE,GAAG,mBAAmB,CAAC,eAAe,EAAE,GAAG,OAAO,EAAE,CAAC,CAAA;QAC1G,OAAO,iBAAiB,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IACrE,CAAC;;AAfH,kDAgBC","sourcesContent":["import { BaseContext } from './base-context'\nimport { EventTrackingResult } from '@sentio/protos'\nimport { NamedResultDescriptor } from './metadata'\nimport { MapStateStorage } from '@sentio/runtime'\n\nexport interface Event {\n // The unique identifier of main identity associate with an event\n // .e.g user id / toekn address / account address / contract address id\n //\n distinctId: string\n [key: string]: any\n}\n\nexport interface TrackerOptions {\n totalByDay?: boolean\n unique?: boolean\n distinctByDays?: number[]\n}\n\nexport class EventTrackerState extends MapStateStorage<EventTracker> {\n static INSTANCE = new EventTrackerState()\n}\n\n// Track Event with an identity associate with it\nexport class EventTracker extends NamedResultDescriptor {\n static DEFAULT_OPTIONS: TrackerOptions = {\n totalByDay: true,\n unique: true,\n }\n\n static register(eventName: string, options?: TrackerOptions) {\n const tracker = new EventTracker(eventName, { ...EventTracker.DEFAULT_OPTIONS, ...options })\n return EventTrackerState.INSTANCE.getOrSetValue(eventName, tracker)\n }\n\n options: TrackerOptions\n protected constructor(eventName: string, options: TrackerOptions) {\n super(eventName)\n this.options = options\n }\n\n trackEvent(ctx: BaseContext, event: Event) {\n const { distinctId, ...payload } = event\n\n const res: EventTrackingResult = {\n metadata: ctx.getMetaData(this.name, {}),\n distinctEntityId: distinctId,\n attributes: payload,\n runtimeInfo: undefined,\n }\n ctx.res.events.push(res)\n }\n}\n\nexport class AccountEventTracker extends EventTracker {\n static DEFAULT_OPTIONS: TrackerOptions = {\n totalByDay: true,\n unique: true,\n distinctByDays: [1, 7, 30],\n }\n\n static register(eventName?: string, options?: TrackerOptions) {\n if (eventName) {\n eventName = ['user', eventName].join('_')\n } else {\n eventName = 'user'\n }\n const tracker = new AccountEventTracker(eventName, { ...AccountEventTracker.DEFAULT_OPTIONS, ...options })\n return EventTrackerState.INSTANCE.getOrSetValue(eventName, tracker)\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numberish.test.js","sourceRoot":"","sources":["../../src/core/numberish.test.ts"],"names":[],"mappings":";;AAAA,+BAA6B;AAC7B,2CAAyD;AACzD,mCAAkC;AAClC,mCAAkC;AAClC,2CAAwC;
|
|
1
|
+
{"version":3,"file":"numberish.test.js","sourceRoot":"","sources":["../../src/core/numberish.test.ts"],"names":[],"mappings":";;AAAA,+BAA6B;AAC7B,2CAAyD;AACzD,mCAAkC;AAClC,mCAAkC;AAClC,2CAAwC;AACxC,2CAA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AC,IAAI,aAAU,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,IAAI,UAAU,CAAC,CAAA;QAE1E,IAAA,aAAM,EACJ,kBAAkB,CAAC,IAAA,yBAAa,EAAC,IAAI,aAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,IAAI,mBAAU,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,OAAO,CACjH,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,uBAAuB;AACvB,SAAS,eAAe,CAAC,CAAa;IACpC,IAAI,GAAG,GAAG,kBAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IACxD,IAAI,CAAC,CAAC,QAAQ,EAAE;QACd,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;KAChB;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,SAAS,kBAAkB,CAAC,CAAa;IACvC,IAAI,GAAG,GAAG,kBAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAA;IAC3C,IAAI,CAAC,CAAC,QAAQ,EAAE;QACd,GAAG,GAAG,CAAC,GAAG,CAAA;KACX;IACD,OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["import { expect } from 'chai'\nimport { toBigInteger, toMetricValue } from './numberish'\nimport { webcrypto } from 'crypto'\nimport { BigNumber } from 'ethers'\nimport { performance } from 'perf_hooks'\nimport { BigInteger } from '@sentio/protos'\nimport { BigDecimal } from '.'\n\n// TODO add test for type conversion\ndescribe('Numberish tests', () => {\n const values: bigint[] = [0n, -0n, 3815372408723498172304781320847103784n, 2132n, -18708707n, 123n << 100n]\n\n test('big integer conversion correctness ', async () => {\n for (const v of values) {\n const b = toBigInteger(v)\n const hex1 = BigIntegerToHex(b)\n const hex2 = v.toString(16)\n expect(hex1).equals(hex2)\n }\n })\n\n test('random big integer conversion correctness ', async () => {\n for (let i = 0; i < 1000; i++) {\n const random = webcrypto.getRandomValues(new Uint8Array(256))\n const v = BigNumber.from(random).toBigInt()\n const b = toBigInteger(v)\n\n expect(BigNumber.from(b.data).eq(v)).to.equals(true)\n }\n })\n\n test.skip('random big integer performance', async () => {\n jest.setTimeout(100000)\n jest.retryTimes(3)\n\n let timer1 = 0\n let timer2 = 0\n for (let i = 0; i < 1000; i++) {\n // Use higher value for local debugging\n const random = webcrypto.getRandomValues(new Uint8Array(256))\n const v = BigNumber.from(random).toBigInt()\n\n let start = performance.now()\n toBigInteger(v)\n timer1 += performance.now() - start\n\n start = performance.now()\n v.toString(16)\n timer2 += performance.now() - start\n }\n\n console.log(timer1, timer2)\n expect(timer1).to.lessThan(timer2 * 3)\n })\n\n test('metric values', async () => {\n const longDec = '12.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002'\n expect(toMetricValue(new BigDecimal(longDec)).bigDecimal == longDec)\n\n const complexDec = '-7.350918e-428'\n expect(toMetricValue(new BigDecimal(complexDec)).bigDecimal == complexDec)\n\n expect(\n BigIntegerToBigInt(toMetricValue(new BigDecimal('100000')).bigInteger || BigInteger.fromPartial({})) === 100000n\n )\n })\n})\n\n// Performance very bad\nfunction BigIntegerToHex(b: BigInteger): string {\n let res = BigNumber.from(b.data).toBigInt().toString(16)\n if (b.negative) {\n res = '-' + res\n }\n return res\n}\n\nfunction BigIntegerToBigInt(b: BigInteger): bigint {\n let res = BigNumber.from(b.data).toBigInt()\n if (b.negative) {\n res = -res\n }\n return res\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dex-price.test.js","sourceRoot":"","sources":["../../src/utils/dex-price.test.ts"],"names":[],"mappings":";;AAAA,2CAA8D;AAC9D,
|
|
1
|
+
{"version":3,"file":"dex-price.test.js","sourceRoot":"","sources":["../../src/utils/dex-price.test.ts"],"names":[],"mappings":";;AAAA,2CAA8D;AAC9D,6CAAkD;AAClD,4DAAmE;AAEnE,+BAA6B;AAE7B,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,eAAK,CAAC,KAAK,EAAE,CAAA;IACb,mBAAS,CAAC,KAAK,EAAE,CAAA;IAEjB,MAAM,aAAa,GAAG,IAAA,wCAAwB,EAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;IAE1D,MAAM,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAA;IAE/C,MAAM,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;QACxC,MAAM,IAAI,GAAG,MAAM,4BAAgB,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;QAC9D,IAAA,aAAM,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAA;QAEjC,MAAM,QAAQ,GAAG,MAAM,4BAAgB,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;QAClE,IAAA,aAAM,EAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IAClC,CAAC,CAAC,CAAA;IAEF,MAAM,CAAC,qBAAqB,EAAE,KAAK,IAAI,EAAE;QACvC,MAAM,GAAG,GAAG,MAAM,0BAAc,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACzD,IAAA,aAAM,EAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAA;IAClC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { EthereumDexPrice, GoerliDexPrice } from './dex-price'\nimport { State, Endpoints } from '@sentio/runtime'\nimport { loadTestProvidersFromEnv } from '../testing/test-provider'\n\nimport { expect } from 'chai'\n\ndescribe('dex price tests', () => {\n State.reset()\n Endpoints.reset()\n\n const haveProviders = loadTestProvidersFromEnv(['1', '5'])\n\n const testIf = haveProviders ? test : test.skip\n\n testIf('get price at mainnet', async () => {\n const usdc = await EthereumDexPrice.getPrice('usdc', 15677823)\n expect(usdc.price).eq(0.99991649)\n\n const compound = await EthereumDexPrice.getPrice('COMP', 15677823)\n expect(compound.price).eq(60.27)\n })\n\n testIf('get price at goerli', async () => {\n const dai = await GoerliDexPrice.getPrice('DAI', 7712734)\n expect(dai.price).eq(0.99971281)\n })\n})\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentio/sdk",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "1.37.5-rc.
|
|
4
|
+
"version": "1.37.5-rc.6",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"compile_target": "yarn tsc -b src/target-ethers-sentio/tsconfig.json",
|
|
7
7
|
"compile": "tsc -p . && cp src/utils/*.csv lib/utils",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@ethersproject/providers": "~5.7.0",
|
|
21
21
|
"@sentio/cli": "^1.0.0",
|
|
22
|
-
"@sentio/protos": "^1.37.5-rc.
|
|
23
|
-
"@sentio/runtime": "^1.37.5-rc.
|
|
22
|
+
"@sentio/protos": "^1.37.5-rc.6",
|
|
23
|
+
"@sentio/runtime": "^1.37.5-rc.6",
|
|
24
24
|
"@typechain/ethers-v5": "^10.0.0",
|
|
25
25
|
"bignumber.js": "^9.1.0",
|
|
26
26
|
"command-line-args": "^5.2.1",
|
|
@@ -38,10 +38,8 @@
|
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/command-line-args": "^5.2.0",
|
|
40
40
|
"@types/command-line-usage": "^5.0.2",
|
|
41
|
-
"@types/expect": "^24.3.0",
|
|
42
41
|
"@types/fs-extra": "^9.0.13",
|
|
43
|
-
"@types/google-protobuf": "^3.15.6"
|
|
44
|
-
"@types/node": "^18.0.4"
|
|
42
|
+
"@types/google-protobuf": "^3.15.6"
|
|
45
43
|
},
|
|
46
44
|
"main": "./lib/index.js",
|
|
47
45
|
"types": "./lib/index.d.ts",
|
|
@@ -57,5 +55,5 @@
|
|
|
57
55
|
"typedoc": {
|
|
58
56
|
"entryPoint": "./src/index.ts"
|
|
59
57
|
},
|
|
60
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "6ceb74bee81addb7e69bc4875388972cadeceadb"
|
|
61
59
|
}
|
|
@@ -8,7 +8,7 @@ export interface Event {
|
|
|
8
8
|
// .e.g user id / toekn address / account address / contract address id
|
|
9
9
|
//
|
|
10
10
|
distinctId: string
|
|
11
|
-
|
|
11
|
+
[key: string]: any
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export interface TrackerOptions {
|
|
@@ -40,10 +40,12 @@ export class EventTracker extends NamedResultDescriptor {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
trackEvent(ctx: BaseContext, event: Event) {
|
|
43
|
+
const { distinctId, ...payload } = event
|
|
44
|
+
|
|
43
45
|
const res: EventTrackingResult = {
|
|
44
46
|
metadata: ctx.getMetaData(this.name, {}),
|
|
45
|
-
distinctEntityId:
|
|
46
|
-
attributes:
|
|
47
|
+
distinctEntityId: distinctId,
|
|
48
|
+
attributes: payload,
|
|
47
49
|
runtimeInfo: undefined,
|
|
48
50
|
}
|
|
49
51
|
ctx.res.events.push(res)
|