diff --git a/packages/protos/processor.proto b/packages/protos/processor.proto index 6d594dabd..32869be50 100644 --- a/packages/protos/processor.proto +++ b/packages/protos/processor.proto @@ -657,10 +657,13 @@ message Data { uint64 slot = 3; } message SuiObject { - repeated google.protobuf.Struct objects = 1; - optional google.protobuf.Struct self = 4; - google.protobuf.Timestamp timestamp = 2; - uint64 slot = 3; + repeated google.protobuf.Struct objects = 1; // just details.content + optional google.protobuf.Struct self = 4; // just details.content + string object_id = 5; // self object property + uint64 object_version = 6; // self object property + string object_digest = 7; // self object property + google.protobuf.Timestamp timestamp = 2; // checkpoint timestamp + uint64 slot = 3; // checkpoint number } message SuiObjectChange { repeated google.protobuf.Struct changes = 1; diff --git a/packages/protos/src/processor/protos/processor.ts b/packages/protos/src/processor/protos/processor.ts index 57aea1836..390864108 100644 --- a/packages/protos/src/processor/protos/processor.ts +++ b/packages/protos/src/processor/protos/processor.ts @@ -1112,6 +1112,9 @@ export interface Data_SuiCall { export interface Data_SuiObject { objects: { [key: string]: any }[]; self?: { [key: string]: any } | undefined; + objectId: string; + objectVersion: bigint; + objectDigest: string; timestamp: Date | undefined; slot: bigint; } @@ -9755,7 +9758,15 @@ export const Data_SuiCall = { }; function createBaseData_SuiObject(): Data_SuiObject { - return { objects: [], self: undefined, timestamp: undefined, slot: BigInt("0") }; + return { + objects: [], + self: undefined, + objectId: "", + objectVersion: BigInt("0"), + objectDigest: "", + timestamp: undefined, + slot: BigInt("0"), + }; } export const Data_SuiObject = { @@ -9766,6 +9777,18 @@ export const Data_SuiObject = { if (message.self !== undefined) { Struct.encode(Struct.wrap(message.self), writer.uint32(34).fork()).ldelim(); } + if (message.objectId !== "") { + writer.uint32(42).string(message.objectId); + } + if (message.objectVersion !== BigInt("0")) { + if (BigInt.asUintN(64, message.objectVersion) !== message.objectVersion) { + throw new globalThis.Error("value provided for field message.objectVersion of type uint64 too large"); + } + writer.uint32(48).uint64(message.objectVersion.toString()); + } + if (message.objectDigest !== "") { + writer.uint32(58).string(message.objectDigest); + } if (message.timestamp !== undefined) { Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(18).fork()).ldelim(); } @@ -9799,6 +9822,27 @@ export const Data_SuiObject = { message.self = Struct.unwrap(Struct.decode(reader, reader.uint32())); continue; + case 5: + if (tag !== 42) { + break; + } + + message.objectId = reader.string(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.objectVersion = longToBigint(reader.uint64() as Long); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.objectDigest = reader.string(); + continue; case 2: if (tag !== 18) { break; @@ -9826,6 +9870,9 @@ export const Data_SuiObject = { return { objects: globalThis.Array.isArray(object?.objects) ? [...object.objects] : [], self: isObject(object.self) ? object.self : undefined, + objectId: isSet(object.objectId) ? globalThis.String(object.objectId) : "", + objectVersion: isSet(object.objectVersion) ? BigInt(object.objectVersion) : BigInt("0"), + objectDigest: isSet(object.objectDigest) ? globalThis.String(object.objectDigest) : "", timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, slot: isSet(object.slot) ? BigInt(object.slot) : BigInt("0"), }; @@ -9839,6 +9886,15 @@ export const Data_SuiObject = { if (message.self !== undefined) { obj.self = message.self; } + if (message.objectId !== "") { + obj.objectId = message.objectId; + } + if (message.objectVersion !== BigInt("0")) { + obj.objectVersion = message.objectVersion.toString(); + } + if (message.objectDigest !== "") { + obj.objectDigest = message.objectDigest; + } if (message.timestamp !== undefined) { obj.timestamp = message.timestamp.toISOString(); } @@ -9855,6 +9911,9 @@ export const Data_SuiObject = { const message = createBaseData_SuiObject(); message.objects = object.objects?.map((e) => e) || []; message.self = object.self ?? undefined; + message.objectId = object.objectId ?? ""; + message.objectVersion = object.objectVersion ?? BigInt("0"); + message.objectDigest = object.objectDigest ?? ""; message.timestamp = object.timestamp ?? undefined; message.slot = object.slot ?? BigInt("0"); return message; diff --git a/packages/protos/src/service/common/protos/common.ts b/packages/protos/src/service/common/protos/common.ts index fc7cf8bcf..932b39fac 100644 --- a/packages/protos/src/service/common/protos/common.ts +++ b/packages/protos/src/service/common/protos/common.ts @@ -383,6 +383,7 @@ export interface Project { enableDisk: boolean; /** @deprecated */ enableMaterializedView: boolean; + defaultTimerange: TimeRangeLite | undefined; } export enum Project_Visibility { @@ -480,6 +481,7 @@ export interface ProjectInfo { enableDisk: boolean; /** @deprecated */ enableMaterializedView: boolean; + defaultTimerange: TimeRangeLite | undefined; } export interface EventLogColumn { @@ -1457,6 +1459,7 @@ export enum TabularData_ColumnType { BOOLEAN = 2, LIST = 3, TIME = 4, + MAP = 5, UNRECOGNIZED = -1, } @@ -1477,6 +1480,9 @@ export function tabularData_ColumnTypeFromJSON(object: any): TabularData_ColumnT case 4: case "TIME": return TabularData_ColumnType.TIME; + case 5: + case "MAP": + return TabularData_ColumnType.MAP; case -1: case "UNRECOGNIZED": default: @@ -1496,6 +1502,8 @@ export function tabularData_ColumnTypeToJSON(object: TabularData_ColumnType): st return "LIST"; case TabularData_ColumnType.TIME: return "TIME"; + case TabularData_ColumnType.MAP: + return "MAP"; case TabularData_ColumnType.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -2739,6 +2747,7 @@ function createBaseProject(): Project { superset: undefined, enableDisk: false, enableMaterializedView: false, + defaultTimerange: undefined, }; } @@ -2807,6 +2816,9 @@ export const Project = { if (message.enableMaterializedView !== false) { writer.uint32(160).bool(message.enableMaterializedView); } + if (message.defaultTimerange !== undefined) { + TimeRangeLite.encode(message.defaultTimerange, writer.uint32(170).fork()).ldelim(); + } return writer; }, @@ -2950,6 +2962,13 @@ export const Project = { message.enableMaterializedView = reader.bool(); continue; + case 21: + if (tag !== 170) { + break; + } + + message.defaultTimerange = TimeRangeLite.decode(reader, reader.uint32()); + continue; } if ((tag & 7) === 4 || tag === 0) { break; @@ -2986,6 +3005,7 @@ export const Project = { enableMaterializedView: isSet(object.enableMaterializedView) ? globalThis.Boolean(object.enableMaterializedView) : false, + defaultTimerange: isSet(object.defaultTimerange) ? TimeRangeLite.fromJSON(object.defaultTimerange) : undefined, }; }, @@ -3048,6 +3068,9 @@ export const Project = { if (message.enableMaterializedView !== false) { obj.enableMaterializedView = message.enableMaterializedView; } + if (message.defaultTimerange !== undefined) { + obj.defaultTimerange = TimeRangeLite.toJSON(message.defaultTimerange); + } return obj; }, @@ -3077,6 +3100,9 @@ export const Project = { : undefined; message.enableDisk = object.enableDisk ?? false; message.enableMaterializedView = object.enableMaterializedView ?? false; + message.defaultTimerange = (object.defaultTimerange !== undefined && object.defaultTimerange !== null) + ? TimeRangeLite.fromPartial(object.defaultTimerange) + : undefined; return message; }, }; @@ -3171,6 +3197,7 @@ function createBaseProjectInfo(): ProjectInfo { superset: undefined, enableDisk: false, enableMaterializedView: false, + defaultTimerange: undefined, }; } @@ -3224,6 +3251,9 @@ export const ProjectInfo = { if (message.enableMaterializedView !== false) { writer.uint32(160).bool(message.enableMaterializedView); } + if (message.defaultTimerange !== undefined) { + TimeRangeLite.encode(message.defaultTimerange, writer.uint32(170).fork()).ldelim(); + } return writer; }, @@ -3332,6 +3362,13 @@ export const ProjectInfo = { message.enableMaterializedView = reader.bool(); continue; + case 21: + if (tag !== 170) { + break; + } + + message.defaultTimerange = TimeRangeLite.decode(reader, reader.uint32()); + continue; } if ((tag & 7) === 4 || tag === 0) { break; @@ -3359,6 +3396,7 @@ export const ProjectInfo = { enableMaterializedView: isSet(object.enableMaterializedView) ? globalThis.Boolean(object.enableMaterializedView) : false, + defaultTimerange: isSet(object.defaultTimerange) ? TimeRangeLite.fromJSON(object.defaultTimerange) : undefined, }; }, @@ -3406,6 +3444,9 @@ export const ProjectInfo = { if (message.enableMaterializedView !== false) { obj.enableMaterializedView = message.enableMaterializedView; } + if (message.defaultTimerange !== undefined) { + obj.defaultTimerange = TimeRangeLite.toJSON(message.defaultTimerange); + } return obj; }, @@ -3430,6 +3471,9 @@ export const ProjectInfo = { : undefined; message.enableDisk = object.enableDisk ?? false; message.enableMaterializedView = object.enableMaterializedView ?? false; + message.defaultTimerange = (object.defaultTimerange !== undefined && object.defaultTimerange !== null) + ? TimeRangeLite.fromPartial(object.defaultTimerange) + : undefined; return message; }, }; diff --git a/packages/runtime/src/gen/processor/protos/processor.ts b/packages/runtime/src/gen/processor/protos/processor.ts index 5f4e6b615..b55ad19a0 100644 --- a/packages/runtime/src/gen/processor/protos/processor.ts +++ b/packages/runtime/src/gen/processor/protos/processor.ts @@ -1120,6 +1120,9 @@ export interface Data_SuiCall { export interface Data_SuiObject { objects: { [key: string]: any }[]; self?: { [key: string]: any } | undefined; + objectId: string; + objectVersion: bigint; + objectDigest: string; timestamp: Date | undefined; slot: bigint; } @@ -9827,7 +9830,15 @@ export const Data_SuiCall = { }; function createBaseData_SuiObject(): Data_SuiObject { - return { objects: [], self: undefined, timestamp: undefined, slot: BigInt("0") }; + return { + objects: [], + self: undefined, + objectId: "", + objectVersion: BigInt("0"), + objectDigest: "", + timestamp: undefined, + slot: BigInt("0"), + }; } export const Data_SuiObject = { @@ -9838,6 +9849,18 @@ export const Data_SuiObject = { if (message.self !== undefined) { Struct.encode(Struct.wrap(message.self), writer.uint32(34).fork()).ldelim(); } + if (message.objectId !== "") { + writer.uint32(42).string(message.objectId); + } + if (message.objectVersion !== BigInt("0")) { + if (BigInt.asUintN(64, message.objectVersion) !== message.objectVersion) { + throw new globalThis.Error("value provided for field message.objectVersion of type uint64 too large"); + } + writer.uint32(48).uint64(message.objectVersion.toString()); + } + if (message.objectDigest !== "") { + writer.uint32(58).string(message.objectDigest); + } if (message.timestamp !== undefined) { Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(18).fork()).ldelim(); } @@ -9871,6 +9894,27 @@ export const Data_SuiObject = { message.self = Struct.unwrap(Struct.decode(reader, reader.uint32())); continue; + case 5: + if (tag !== 42) { + break; + } + + message.objectId = reader.string(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.objectVersion = longToBigint(reader.uint64() as Long); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.objectDigest = reader.string(); + continue; case 2: if (tag !== 18) { break; @@ -9898,6 +9942,9 @@ export const Data_SuiObject = { return { objects: globalThis.Array.isArray(object?.objects) ? [...object.objects] : [], self: isObject(object.self) ? object.self : undefined, + objectId: isSet(object.objectId) ? globalThis.String(object.objectId) : "", + objectVersion: isSet(object.objectVersion) ? BigInt(object.objectVersion) : BigInt("0"), + objectDigest: isSet(object.objectDigest) ? globalThis.String(object.objectDigest) : "", timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, slot: isSet(object.slot) ? BigInt(object.slot) : BigInt("0"), }; @@ -9911,6 +9958,15 @@ export const Data_SuiObject = { if (message.self !== undefined) { obj.self = message.self; } + if (message.objectId !== "") { + obj.objectId = message.objectId; + } + if (message.objectVersion !== BigInt("0")) { + obj.objectVersion = message.objectVersion.toString(); + } + if (message.objectDigest !== "") { + obj.objectDigest = message.objectDigest; + } if (message.timestamp !== undefined) { obj.timestamp = message.timestamp.toISOString(); } @@ -9927,6 +9983,9 @@ export const Data_SuiObject = { const message = createBaseData_SuiObject(); message.objects = object.objects?.map((e) => e) || []; message.self = object.self ?? undefined; + message.objectId = object.objectId ?? ""; + message.objectVersion = object.objectVersion ?? BigInt("0"); + message.objectDigest = object.objectDigest ?? ""; message.timestamp = object.timestamp ?? undefined; message.slot = object.slot ?? BigInt("0"); return message; diff --git a/packages/runtime/src/gen/service/common/protos/common.ts b/packages/runtime/src/gen/service/common/protos/common.ts index fc7cf8bcf..932b39fac 100644 --- a/packages/runtime/src/gen/service/common/protos/common.ts +++ b/packages/runtime/src/gen/service/common/protos/common.ts @@ -383,6 +383,7 @@ export interface Project { enableDisk: boolean; /** @deprecated */ enableMaterializedView: boolean; + defaultTimerange: TimeRangeLite | undefined; } export enum Project_Visibility { @@ -480,6 +481,7 @@ export interface ProjectInfo { enableDisk: boolean; /** @deprecated */ enableMaterializedView: boolean; + defaultTimerange: TimeRangeLite | undefined; } export interface EventLogColumn { @@ -1457,6 +1459,7 @@ export enum TabularData_ColumnType { BOOLEAN = 2, LIST = 3, TIME = 4, + MAP = 5, UNRECOGNIZED = -1, } @@ -1477,6 +1480,9 @@ export function tabularData_ColumnTypeFromJSON(object: any): TabularData_ColumnT case 4: case "TIME": return TabularData_ColumnType.TIME; + case 5: + case "MAP": + return TabularData_ColumnType.MAP; case -1: case "UNRECOGNIZED": default: @@ -1496,6 +1502,8 @@ export function tabularData_ColumnTypeToJSON(object: TabularData_ColumnType): st return "LIST"; case TabularData_ColumnType.TIME: return "TIME"; + case TabularData_ColumnType.MAP: + return "MAP"; case TabularData_ColumnType.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -2739,6 +2747,7 @@ function createBaseProject(): Project { superset: undefined, enableDisk: false, enableMaterializedView: false, + defaultTimerange: undefined, }; } @@ -2807,6 +2816,9 @@ export const Project = { if (message.enableMaterializedView !== false) { writer.uint32(160).bool(message.enableMaterializedView); } + if (message.defaultTimerange !== undefined) { + TimeRangeLite.encode(message.defaultTimerange, writer.uint32(170).fork()).ldelim(); + } return writer; }, @@ -2950,6 +2962,13 @@ export const Project = { message.enableMaterializedView = reader.bool(); continue; + case 21: + if (tag !== 170) { + break; + } + + message.defaultTimerange = TimeRangeLite.decode(reader, reader.uint32()); + continue; } if ((tag & 7) === 4 || tag === 0) { break; @@ -2986,6 +3005,7 @@ export const Project = { enableMaterializedView: isSet(object.enableMaterializedView) ? globalThis.Boolean(object.enableMaterializedView) : false, + defaultTimerange: isSet(object.defaultTimerange) ? TimeRangeLite.fromJSON(object.defaultTimerange) : undefined, }; }, @@ -3048,6 +3068,9 @@ export const Project = { if (message.enableMaterializedView !== false) { obj.enableMaterializedView = message.enableMaterializedView; } + if (message.defaultTimerange !== undefined) { + obj.defaultTimerange = TimeRangeLite.toJSON(message.defaultTimerange); + } return obj; }, @@ -3077,6 +3100,9 @@ export const Project = { : undefined; message.enableDisk = object.enableDisk ?? false; message.enableMaterializedView = object.enableMaterializedView ?? false; + message.defaultTimerange = (object.defaultTimerange !== undefined && object.defaultTimerange !== null) + ? TimeRangeLite.fromPartial(object.defaultTimerange) + : undefined; return message; }, }; @@ -3171,6 +3197,7 @@ function createBaseProjectInfo(): ProjectInfo { superset: undefined, enableDisk: false, enableMaterializedView: false, + defaultTimerange: undefined, }; } @@ -3224,6 +3251,9 @@ export const ProjectInfo = { if (message.enableMaterializedView !== false) { writer.uint32(160).bool(message.enableMaterializedView); } + if (message.defaultTimerange !== undefined) { + TimeRangeLite.encode(message.defaultTimerange, writer.uint32(170).fork()).ldelim(); + } return writer; }, @@ -3332,6 +3362,13 @@ export const ProjectInfo = { message.enableMaterializedView = reader.bool(); continue; + case 21: + if (tag !== 170) { + break; + } + + message.defaultTimerange = TimeRangeLite.decode(reader, reader.uint32()); + continue; } if ((tag & 7) === 4 || tag === 0) { break; @@ -3359,6 +3396,7 @@ export const ProjectInfo = { enableMaterializedView: isSet(object.enableMaterializedView) ? globalThis.Boolean(object.enableMaterializedView) : false, + defaultTimerange: isSet(object.defaultTimerange) ? TimeRangeLite.fromJSON(object.defaultTimerange) : undefined, }; }, @@ -3406,6 +3444,9 @@ export const ProjectInfo = { if (message.enableMaterializedView !== false) { obj.enableMaterializedView = message.enableMaterializedView; } + if (message.defaultTimerange !== undefined) { + obj.defaultTimerange = TimeRangeLite.toJSON(message.defaultTimerange); + } return obj; }, @@ -3430,6 +3471,9 @@ export const ProjectInfo = { : undefined; message.enableDisk = object.enableDisk ?? false; message.enableMaterializedView = object.enableMaterializedView ?? false; + message.defaultTimerange = (object.defaultTimerange !== undefined && object.defaultTimerange !== null) + ? TimeRangeLite.fromPartial(object.defaultTimerange) + : undefined; return message; }, }; diff --git a/packages/sdk/src/aptos/aptos-plugin.ts b/packages/sdk/src/aptos/aptos-plugin.ts index 830387b10..1b80df647 100644 --- a/packages/sdk/src/aptos/aptos-plugin.ts +++ b/packages/sdk/src/aptos/aptos-plugin.ts @@ -137,9 +137,8 @@ export class AptosPlugin extends Plugin { resourceFetchConfig: undefined, type: '' }) - - config.contractConfigs.push(contractConfig) } + config.contractConfigs.push(contractConfig) } // Prepare resource handlers diff --git a/packages/sdk/src/aptos/context.ts b/packages/sdk/src/aptos/context.ts index 35aba1354..275ed6597 100644 --- a/packages/sdk/src/aptos/context.ts +++ b/packages/sdk/src/aptos/context.ts @@ -1,14 +1,7 @@ import { RecordMetaData } from '@sentio/protos' import { type Labels, normalizeLabels } from '../index.js' import { MoveCoder, RichAptosClientWithContext } from './index.js' -import { - Aptos, - Event, - MoveResource, - UserTransactionResponse, - MoveModuleBytecode, - AptosConfig -} from '@aptos-labs/ts-sdk' +import { Event, MoveResource, UserTransactionResponse, MoveModuleBytecode, AptosConfig } from '@aptos-labs/ts-sdk' import { defaultMoveCoder } from './move-coder.js' import { AptosNetwork } from './network.js' import { Endpoints } from '@sentio/runtime' diff --git a/packages/sdk/src/store/tests/generated/schema.ts b/packages/sdk/src/store/tests/generated/schema.ts new file mode 100644 index 000000000..5cf079552 --- /dev/null +++ b/packages/sdk/src/store/tests/generated/schema.ts @@ -0,0 +1,201 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { String, Int, BigInt, Float, ID, Bytes, Timestamp, Boolean } from '@sentio/sdk/store' +import { Entity, Required, One, Many, Column, ListColumn, AbstractEntity } from '@sentio/sdk/store' +import { BigDecimal } from '@sentio/bigdecimal' +import { DatabaseSchema } from '@sentio/sdk' + +export enum TransactionStatus { + SUCCESS = 'SUCCESS', + FAILURE = 'FAILURE' +} + +export interface Owner { + id: ID + name: String +} + +@Entity('Transaction') +export class Transaction extends AbstractEntity { + @Required + @Column('ID') + id: ID + + @Required + @One('Owner') + sender: Promise + + senderID: ID + + @Required + @Column('BigInt') + gas: BigInt + + @Required + @Column('BigDecimal') + gasPrice: BigDecimal + + @Column('Boolean') + isSuccess?: Boolean + + @Column('Bytes') + raw?: Bytes + + @Column('Int') + count?: Int + + @Column('Float') + value?: Float + + @Required + @ListColumn('String') + arrayValue: Array + + @ListColumn('String!') + arrayValue2?: Array + + @Required + @ListColumn() + @ListColumn('String') + arrayOfArrayValue: Array> + + @Column('Timestamp') + dateValue?: Timestamp + + @Required + @Many('TransactionReceipt!') + receipts: Promise> + + receiptsIDs: Array + constructor(data: Partial) { + super() + } +} + +@Entity('TransactionReceipt') +export class TransactionReceipt extends AbstractEntity { + @Required + @Column('ID') + id: ID + + @Column('String') + status?: TransactionStatus + + @One('Transaction') + transaction: Promise + + transactionID: ID + constructor(data: Partial) { + super() + } +} + +@Entity('User') +export class User extends AbstractEntity implements Owner { + @Required + @Column('ID') + id: ID + + @Required + @Column('String') + name: String + + @Required + @Many('Transaction!') + transactions: Promise> + + transactionsIDs: Array + + @Required + @Many('Organization!') + organizations: Promise> + + organizationsIDs: Array + constructor(data: Partial) { + super() + } +} + +@Entity('Organization') +export class Organization extends AbstractEntity implements Owner { + @Required + @Column('ID') + id: ID + + @Required + @Column('String') + name: String + + @Required + @Many('User!') + members: Promise> + + membersIDs: Array + constructor(data: Partial) { + super() + } +} + +export class NonEntity { + id?: ID +} + +const source = `type Transaction @entity { + id: ID! + sender: Owner! + gas: BigInt! + gasPrice: BigDecimal! + isSuccess: Boolean + raw: Bytes + count: Int + value: Float + arrayValue: [String]! + arrayValue2: [String!] + arrayOfArrayValue: [[String]]! + dateValue: Timestamp + receipts: [TransactionReceipt!]! @derivedFrom(field: "transaction") +} + +type TransactionReceipt @entity { + id: ID! + status: TransactionStatus + transaction: Transaction +} + +interface Owner { + id: ID! + name: String! +} + +type User implements Owner @entity { + id: ID! + name: String! + transactions: [Transaction!]! @derivedFrom(field: "sender") + organizations: [Organization!]! @derivedFrom(field: "members") +} + +type Organization implements Owner @entity(sparse: true) { + id: ID! + name: String! + members: [User!]! +} + +type NonEntity { + id: ID +} + +enum TransactionStatus { + SUCCESS + FAILURE +}` +DatabaseSchema.register({ + source, + entities: { + Transaction: Transaction, + TransactionReceipt: TransactionReceipt, + User: User, + Organization: Organization, + NonEntity: NonEntity + } +}) diff --git a/packages/sdk/src/sui/context.ts b/packages/sdk/src/sui/context.ts index 906450aa6..c8afd0a56 100644 --- a/packages/sdk/src/sui/context.ts +++ b/packages/sdk/src/sui/context.ts @@ -183,6 +183,7 @@ export class SuiObjectContext extends SuiAddressContext { constructor( network: SuiNetwork, objectId: string, + objectVersion: bigint, checkpoint: bigint, timestamp: Date, baseLabels: Labels | undefined diff --git a/packages/sdk/src/sui/sui-object-processor.ts b/packages/sdk/src/sui/sui-object-processor.ts index d1e77ed01..b1b1a31f3 100644 --- a/packages/sdk/src/sui/sui-object-processor.ts +++ b/packages/sdk/src/sui/sui-object-processor.ts @@ -100,7 +100,8 @@ export abstract class SuiBaseObjectOrAddressProcessor { handler: async function (data) { const ctx = new SuiObjectContext( processor.config.network, - processor.config.address, + data.objectId, + data.objectVersion, data.slot, data.timestamp || new Date(0), processor.config.baseLabels diff --git a/packages/sdk/src/utils/block.test.ts b/packages/sdk/src/utils/block.test.ts index f5e4d66f8..1f87395c5 100644 --- a/packages/sdk/src/utils/block.test.ts +++ b/packages/sdk/src/utils/block.test.ts @@ -15,6 +15,6 @@ describe('block estimate', () => { testIf('get block number at mainnet', async () => { const targetDate = new Date('2023-05-02T00:00:00Z') const estimatedBlockNumber = await estimateBlockNumberAtDate(getProvider(), targetDate, 0) - expect(estimatedBlockNumber).to.equal(16308189) + expect(estimatedBlockNumber).to.equal(17169395) }) })