Skip to content

price table not found #2512

@daron4ever

Description

@daron4ever
/**
   * Fetches the price table object id for the current state id if not cached
   * @returns price table object id
   */
  async getPriceTableInfo(): Promise<{ id: ObjectId; fieldType: ObjectId }> {
    if (this.priceTableInfo === undefined) {
      const result = await this.provider.getDynamicFieldObject({
        parentId: this.pythStateId,
        name: {
          type: "vector<u8>",
          value: "price_info",
        },
      });
      if (!result.data || !result.data.type) {
        throw new Error(
          "Price Table not found, contract may not be initialized"
        );
      }
      let type = result.data.type.replace("0x2::table::Table<", "");
      type = type.replace(
        "::price_identifier::PriceIdentifier, 0x2::object::ID>",
        ""
      );
      this.priceTableInfo = { id: result.data.objectId, fieldType: type };
    }
    return this.priceTableInfo;
  }
if (!result.data || !result.data.type) {
        throw new Error(
          "Price Table not found, contract may not be initialized"
        );
      }

its cause the pyth price object was not found.
i need to get the dynamicObjectField of the pyth State Id, and it doesnt return me the proper one

cause its not able to get the price table info for the pythStateId

I even tested this code, separately outside the package, and the result.data will have value only when I used archive node.

so i testeed with sui public node, which is archived node, and my normal full node. data was returned only using sui archived node.

Is it not possible to use the price feed with a full node? Do we need an archive node for that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions