@edgeandnode/common
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -1,3 +0,3 @@ | ||
export { generateExampleQuery, connectProvider, getContract, getTxLink, formatWithNumeral, buildEnsDataLoader, ensLookup, ensLookups, unixDateFromNow, dateFromNow, dateStringFromNow, dateUntilNow, formatDuration, formatHourMin, getDate, blocksToDays, delegatorCooldownToDays, formatDayHourMin, formatDays, formatUnits, formatUnitsToNumber, toGRT, formatNameHash, bigNumberify, decToBigNumber, overrides, FormatNumeralOptions, FormatUnitsOptions, ToGRTOptions, toWei, addrShortener, checkAllowance, purchaseTargetAmount, saleTargetAmount, tokensToSignal, TokensToSignalPair, vSignalToNSignal, signalToTokens, TokensToNSignalTriple, tokensToNSignal, NSignalToTokensPair, nSignalToTokens, nSignalToVSignal } from './utils'; | ||
export { generateExampleQuery, connectProvider, getContract, getTxLink, formatWithNumeral, buildEnsDataLoader, ensLookup, ensLookups, unixDateFromNow, dateFromNow, dateStringFromNow, dateUntilNow, formatDuration, formatHourMin, getDate, blocksToDays, delegatorCooldownToDays, formatDayHourMin, formatDays, formatUnits, formatUnitsToNumber, toGRT, formatNameHash, bigNumberify, decToBigNumber, overrides, FormatNumeralOptions, FormatUnitsOptions, ToGRTOptions, toWei, addrShortener, checkAllowance, purchaseTargetAmount, saleTargetAmount, tokensToSignal, TokensToSignalPair, vSignalToNSignal, signalToTokens, TokensToNSignalTriple, tokensToNSignal, NSignalToTokensPair, nSignalToTokens, nSignalToVSignal, getEventTypeFromTypename, getEventInterface, buildEventInterfaceList } from './utils'; | ||
export * from './models'; | ||
export { SECONDS_IN_DAY, ETHEREUM_BLOCK_TIME, NETWORKS } from './constants'; |
@@ -703,2 +703,11 @@ import gql from 'graphql-tag'; | ||
var EventType; | ||
(function (EventType) { | ||
EventType["CURATE"] = "Curate"; | ||
EventType["DELEGATE"] = "Delegate"; | ||
EventType["PUBLISH"] = "Publish"; | ||
EventType["INDEX"] = "Index"; | ||
EventType["SETTINGS"] = "Settings"; | ||
})(EventType || (EventType = {})); | ||
var AllocationStatus; | ||
@@ -751,3 +760,58 @@ (function (AllocationStatus) { | ||
export { AllocationStatus, DisputeStatus, DisputeType, ETHEREUM_BLOCK_TIME, NETWORKS, Revocability, SECONDS_IN_DAY, SubgraphIndexHealth, TransactionType, addrShortener, bigNumberify, blocksToDays, buildEnsDataLoader, checkAllowance, connectProvider, dateFromNow, dateStringFromNow, dateUntilNow, decToBigNumber, delegatorCooldownToDays, ensLookup, ensLookups, formatDayHourMin, formatDays, formatDuration, formatHourMin, formatNameHash, formatUnits, formatUnitsToNumber, formatWithNumeral, generateExampleQuery, getContract, getDate, getTxLink, nSignalToTokens, nSignalToVSignal, overrides, purchaseTargetAmount, saleTargetAmount, signalToTokens, toGRT, toWei, tokensToNSignal, tokensToSignal, unixDateFromNow, vSignalToNSignal }; | ||
const getEventTypeFromTypename = (__typename) => { | ||
switch (true) { | ||
case ['CuratorEvent', 'NSignalMintedEvent', 'NSignalBurnedEvent', 'GRTWithdrawnEvent'].includes(__typename): { | ||
return EventType.CURATE; | ||
} | ||
case ['SubgraphEvent', 'NewSubgraphPublishedEvent', 'NewSubgraphVersionPublishedEvent'].includes(__typename): { | ||
return EventType.PUBLISH; | ||
} | ||
case ['SubgraphMetadataUpdatedEvent'].includes(__typename): { | ||
return EventType.SETTINGS; | ||
} | ||
} | ||
}; | ||
const getEventInterface = (event) => { | ||
switch (event.__typename) { | ||
case 'GraphAccountEvent': { | ||
return event; | ||
} | ||
case 'CuratorEvent': { | ||
return event; | ||
} | ||
case 'SubgraphEvent': { | ||
return event; | ||
} | ||
case 'NewSubgraphPublishedEvent': { | ||
return event; | ||
} | ||
case 'NewSubgraphVersionPublishedEvent': { | ||
return event; | ||
} | ||
case 'SubgraphMetadataUpdatedEvent': { | ||
return event; | ||
} | ||
case 'SubgraphDeprecatedEvent': { | ||
return event; | ||
} | ||
case 'SubgraphNameSignalEnabledEvent': { | ||
return event; | ||
} | ||
case 'NSignalMintedEvent': { | ||
return event; | ||
} | ||
case 'NSignalBurnedEvent': { | ||
return event; | ||
} | ||
case 'GRTWithdrawnEvent': { | ||
return event; | ||
} | ||
default: { | ||
return event; | ||
} | ||
} | ||
}; | ||
const buildEventInterfaceList = (events) => (events !== null && events !== void 0 ? events : []).map(getEventInterface); | ||
export { AllocationStatus, DisputeStatus, DisputeType, ETHEREUM_BLOCK_TIME, EventType, NETWORKS, Revocability, SECONDS_IN_DAY, SubgraphIndexHealth, TransactionType, addrShortener, bigNumberify, blocksToDays, buildEnsDataLoader, buildEventInterfaceList, checkAllowance, connectProvider, dateFromNow, dateStringFromNow, dateUntilNow, decToBigNumber, delegatorCooldownToDays, ensLookup, ensLookups, formatDayHourMin, formatDays, formatDuration, formatHourMin, formatNameHash, formatUnits, formatUnitsToNumber, formatWithNumeral, generateExampleQuery, getContract, getDate, getEventInterface, getEventTypeFromTypename, getTxLink, nSignalToTokens, nSignalToVSignal, overrides, purchaseTargetAmount, saleTargetAmount, signalToTokens, toGRT, toWei, tokensToNSignal, tokensToSignal, unixDateFromNow, vSignalToNSignal }; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -717,2 +717,11 @@ 'use strict'; | ||
exports.EventType = void 0; | ||
(function (EventType) { | ||
EventType["CURATE"] = "Curate"; | ||
EventType["DELEGATE"] = "Delegate"; | ||
EventType["PUBLISH"] = "Publish"; | ||
EventType["INDEX"] = "Index"; | ||
EventType["SETTINGS"] = "Settings"; | ||
})(exports.EventType || (exports.EventType = {})); | ||
exports.AllocationStatus = void 0; | ||
@@ -765,2 +774,57 @@ (function (AllocationStatus) { | ||
const getEventTypeFromTypename = (__typename) => { | ||
switch (true) { | ||
case ['CuratorEvent', 'NSignalMintedEvent', 'NSignalBurnedEvent', 'GRTWithdrawnEvent'].includes(__typename): { | ||
return exports.EventType.CURATE; | ||
} | ||
case ['SubgraphEvent', 'NewSubgraphPublishedEvent', 'NewSubgraphVersionPublishedEvent'].includes(__typename): { | ||
return exports.EventType.PUBLISH; | ||
} | ||
case ['SubgraphMetadataUpdatedEvent'].includes(__typename): { | ||
return exports.EventType.SETTINGS; | ||
} | ||
} | ||
}; | ||
const getEventInterface = (event) => { | ||
switch (event.__typename) { | ||
case 'GraphAccountEvent': { | ||
return event; | ||
} | ||
case 'CuratorEvent': { | ||
return event; | ||
} | ||
case 'SubgraphEvent': { | ||
return event; | ||
} | ||
case 'NewSubgraphPublishedEvent': { | ||
return event; | ||
} | ||
case 'NewSubgraphVersionPublishedEvent': { | ||
return event; | ||
} | ||
case 'SubgraphMetadataUpdatedEvent': { | ||
return event; | ||
} | ||
case 'SubgraphDeprecatedEvent': { | ||
return event; | ||
} | ||
case 'SubgraphNameSignalEnabledEvent': { | ||
return event; | ||
} | ||
case 'NSignalMintedEvent': { | ||
return event; | ||
} | ||
case 'NSignalBurnedEvent': { | ||
return event; | ||
} | ||
case 'GRTWithdrawnEvent': { | ||
return event; | ||
} | ||
default: { | ||
return event; | ||
} | ||
} | ||
}; | ||
const buildEventInterfaceList = (events) => (events !== null && events !== void 0 ? events : []).map(getEventInterface); | ||
exports.ETHEREUM_BLOCK_TIME = ETHEREUM_BLOCK_TIME; | ||
@@ -773,2 +837,3 @@ exports.NETWORKS = NETWORKS; | ||
exports.buildEnsDataLoader = buildEnsDataLoader; | ||
exports.buildEventInterfaceList = buildEventInterfaceList; | ||
exports.checkAllowance = checkAllowance; | ||
@@ -794,2 +859,4 @@ exports.connectProvider = connectProvider; | ||
exports.getDate = getDate; | ||
exports.getEventInterface = getEventInterface; | ||
exports.getEventTypeFromTypename = getEventTypeFromTypename; | ||
exports.getTxLink = getTxLink; | ||
@@ -796,0 +863,0 @@ exports.nSignalToTokens = nSignalToTokens; |
@@ -14,3 +14,3 @@ import type { TranslateBigInt } from '../big-number.model'; | ||
id?: string; | ||
timestamp?: number; | ||
timestamp?: TranslateBigInt; | ||
blockNumber?: TranslateBigInt; | ||
@@ -31,10 +31,11 @@ tx_hash?: string; | ||
} | ||
export interface NewSubgraphPublishedEvent extends SubgraphEvent { | ||
export interface SubgraphDeploymentEvent extends Event { | ||
deployment?: ExplorerSubgraphDeployment; | ||
} | ||
export interface NewSubgraphPublishedEvent extends SubgraphEvent, SubgraphDeploymentEvent { | ||
version?: ExplorerSubgraphVersion; | ||
deployment?: ExplorerSubgraphDeployment; | ||
accounts?: GraphAccount[]; | ||
} | ||
export interface NewSubgraphVersionPublishedEvent extends SubgraphEvent { | ||
export interface NewSubgraphVersionPublishedEvent extends SubgraphEvent, SubgraphDeploymentEvent { | ||
version?: ExplorerSubgraphVersion; | ||
deployment?: ExplorerSubgraphDeployment; | ||
accounts?: GraphAccount[]; | ||
@@ -73,3 +74,12 @@ } | ||
} | ||
export declare type SubgraphEventUnion = SubgraphEvent | NewSubgraphPublishedEvent | NewSubgraphVersionPublishedEvent | SubgraphMetadataUpdatedEvent | SubgraphDeprecatedEvent | SubgraphDeprecatedEvent | SubgraphNameSignalEnabledEvent | NSignalMintedEvent | NSignalBurnedEvent | GRTWithdrawnEvent; | ||
/** HELPERS */ | ||
export declare type EventUnion = Event | GraphAccountEvent | CuratorEvent | SubgraphEvent | NewSubgraphPublishedEvent | NewSubgraphVersionPublishedEvent | SubgraphMetadataUpdatedEvent | SubgraphDeprecatedEvent | SubgraphNameSignalEnabledEvent | NSignalMintedEvent | NSignalBurnedEvent | GRTWithdrawnEvent; | ||
export declare type SubgraphEventUnion = SubgraphEvent | NewSubgraphPublishedEvent | NewSubgraphVersionPublishedEvent | SubgraphMetadataUpdatedEvent | SubgraphDeprecatedEvent | SubgraphNameSignalEnabledEvent | NSignalMintedEvent | NSignalBurnedEvent | GRTWithdrawnEvent; | ||
export declare type SubgraphEvents = SubgraphEventUnion[]; | ||
export declare enum EventType { | ||
CURATE = "Curate", | ||
DELEGATE = "Delegate", | ||
PUBLISH = "Publish", | ||
INDEX = "Index", | ||
SETTINGS = "Settings" | ||
} |
@@ -7,1 +7,2 @@ export * from './graphql.utils'; | ||
export * from './contract.utils'; | ||
export * from './event.utils'; |
{ | ||
"name": "@edgeandnode/common", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Common Edge & Node utils and types", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
235919
53
2825