Astral
  • Welcome
  • Astral Litepaper
  • GeoNFT
    • Ecological State
  • Spatial Data Registry
    • On-chain Spatial Data Registry
    • Celo/EVM Anchored Spatial Data Registry
      • Technical Design
        • Ingestion
        • Anchoring
        • Validation
        • List on Ocean Marketplace
      • Summary
    • CosmWasm Anchored Spatial Data Registry
  • Progress
  • ARCHIVE
    • Introduction
    • Spatial Data Primer
    • Background
      • Motivation
      • Value
      • The Stack
        • Data
        • Oracles
        • Spatial Contracts
    • A Web3-Native Geospatial Vision
      • A rationale for GeoDIDs
      • GeoTIFFs and IPLD
        • Encoding the GeoTIFF
        • Decoding the GeoTIFF
    • Spatial.sol
      • Design Considerations
    • Verifiable Spatial Data Registries
    • GeoDIDs
      • DID Primer
      • GeoDID Core
        • GeoDID Core Specification
        • GeoDID Collection Example
        • GeoDID Item Example
      • GeoDID Extensions
        • GeoJSON
        • GeoTIFF
          • IPLD-encoded GeoTIFF
          • Cloud-optimized GeoTIFF
        • STAC
          • STAC Items
          • STAC Catalogs
      • Build with GeoDIDs
        • Getting Started
        • @astralprotocol/core
          • API
          • Types
        • @astralprotocol/contracts
          • API
        • @astralprotocol/subgraph
      • GeoDIDs v0.2
    • Spatial Oracles
    • Universal Location Proofs
Powered by GitBook
On this page
Export as PDF
  1. ARCHIVE
  2. GeoDIDs
  3. Build with GeoDIDs
  4. @astralprotocol/core

API

API for the @astralprotocol/core package

Previous@astralprotocol/coreNextTypes

Last updated 3 years ago

Was this helpful?

CtrlK
  • Constructor
  • Methods
  • CreateGenesisGeoDID
  • CreateChildGeoDID
  • PinDocument
  • LoadDocument

Was this helpful?

Constructor

Creates a new AstralClient Instance to utilize the following functions.

new AstralClient(_ethAddress, _endpoint?);

Name
Type
Attributes
Description

_ethAddress

string

REQUIRED

The Ethereum Address of the user.

_endpoint

string

OPTIONAL

The Graph Endpoint. Already has a default value that can be overloaded with another endpoint.

Methods

CreateGenesisGeoDID

Creates a GenesisGeoDID Document. This creates a new root node for the linked data structure.

async createGenesisGeoDID(_typeOfGeoDID: string): Promise<IDocumentInfo>{}

Type
Description

CreateChildGeoDID

Creates a Child GeoDIDDocument. This creates a child node for an existing linked data structure.

async createChildGeoDID(_typeOfGeoDID: string, _parentID: string, _path: string): Promise<IDocumentInfo>{}

Name
Type
Attributes
Description
Type
Description

PinDocument

Pins the Document to IPFS or FFS via Powergate.

async pinDocument(_documentInfo: IDocumentInfo, _token?: string): Promise<IPinInfo>{}

Name
Type
Attributes
Description
Type
Description

LoadDocument

Loads the Document by the DocID and the Powergate Auth token associated with it.

async loadDocument(_docId: string, _token: string): Promise<ILoadInfo>{}

Name
Type
Attribute
Description
Type
Description

string

REQUIRED

The path that will be appended to the Parent GeoDID ID

Name

Type

Attributes

Description

_typeOfGeoDID

GeoDidType

REQUIRED

The type of Genesis GeoDID you want to create. OfType GeoDidType.

IDocumentInfo

Returns info regarding the Document Type, like the geodidid and the Document Itself.

_typeOfGeoDID

GeoDidType

REQUIRED

The type of Genesis GeoDID you want to create. OfType GeoDidType.

_parentID

string

REQUIRED

The Parent GeoDID ID of this new Child GeoDID

DocumentInfo

Returns information regarding the Document, like the GeoDID ID and the contents of the Document.

_documentInfo

IDocumentInfo

REQUIRED

The Info related to the Document that is required for pinning.

_token

string

OPTIONAL

The Auth Token of the Powergate Instance that you want to pin the document on. If you don't have one yet, the client will automatically create a new one for you and return it for you to save.

IPinInfo

Returns information regarding the Pin, like the GeoDID ID, cid, Powergate Auth token, and the pinDate.

interface IPinInfo {
    geodidid: string;
    cid: string;
    pinDate: Date;
    token: string
} 

_docId

string

REQUIRED

The GeoDID id of the DID Document.

_token

string

REQUIRED

The Auth Token for the Powergate Instance that the Document in stored on.

ILoadInfo

Returns information regarding the Load, like the DocumentInfo as well as the Powergate Instance that the Document was pinned on.

interface LoadInfo {
    documentInfo: IDocumentInfo;
    powergateInstance: Powergate 
}
interface IDocumentInfo {
    geodidid: string;
    documentVal: any;
    parentid?: string;
}
interface IDocumentInfo {
    geodidid: string;
    documentVal: any;
    parentid?: string;
}

_path