@ensnode/ensnode-schema
Version:
The ponder schema for ENSNode
1,148 lines (1,141 loc) • 36 kB
JavaScript
// src/subgraph.schema.ts
import { index, onchainTable, relations } from "ponder";
// src/collate.ts
function monkeypatchCollate(col, collation) {
col.getSQLType = function() {
return Object.getPrototypeOf(this).getSQLType.call(this) + " COLLATE " + collation;
};
return col;
}
// src/subgraph.schema.ts
var domain = onchainTable("domains", (t) => ({
// The namehash of the name
id: t.hex().primaryKey(),
/**
* The human readable name that this Domain represents.
*
* If REPLACE_UNNORMALIZED is true, this value is guaranteed to be an Interpreted Name, which is either:
* a) a normalized Name, or
* b) a Name entirely consisting of Interpreted Labels.
*
* Note that the type of the column will remain string | null, for legacy subgraph compatibility,
* but in practice will never be null. The Root node's name will be '' (empty string).
*
* @see https://ensnode.io/docs/reference/terminology#interpreted-name
*
* If REPLACE_UNNORMALIZED is false, this value may contain:
* a) null (in the case of the root node), or
* b) a Literal Name that may or may not be normalized and may or may not contain Encoded LabelHashes.
*
* @see https://ensnode.io/docs/reference/terminology#literal-name
*/
name: t.text(),
/**
* The Label associated with the Domain.
*
* If REPLACE_UNNORMALIZED is true, this value is guaranteed to be an Interpreted Label which is either:
* a) null, exclusively in the case of the root Node,
* b) a normalized Label, or
* c) an Encoded LabelHash of the Literal Label value found onchain.
*
* @see https://ensnode.io/docs/reference/terminology#interpreted-label
*
* If REPLACE_UNNORMALIZED is false, this value my contain:
* a) null, exclusively in the case of the root Node, or
* b) a Literal Label that may or may not be normalized and may or may not be an Encoded LabelHash.
*
* @see https://ensnode.io/docs/reference/terminology#literal-label
*/
labelName: t.text(),
// keccak256(labelName)
labelhash: t.hex(),
// The namehash (id) of the parent name
parentId: t.hex(),
// The number of subdomains
subdomainCount: t.integer().notNull().default(0),
// Address logged from current resolver, if any
resolvedAddressId: t.hex(),
// The resolver that controls the domain's settings
resolverId: t.text(),
// The time-to-live (TTL) value of the domain's records
ttl: t.bigint(),
// Indicates whether the domain has been migrated to a new registrar
isMigrated: t.boolean().notNull().default(false),
// The time when the domain was created
createdAt: t.bigint().notNull(),
// The account that owns the domain
ownerId: t.hex().notNull(),
// The account that owns the ERC721 NFT for the domain
registrantId: t.hex(),
// The account that owns the wrapped domain
wrappedOwnerId: t.hex(),
// The expiry date for the domain, from either the registration, or the wrapped domain if PCC is burned
expiryDate: t.bigint()
}));
monkeypatchCollate(domain.name, '"C"');
monkeypatchCollate(domain.labelName, '"C"');
var domainRelations = relations(domain, ({ one, many }) => ({
resolvedAddress: one(account, {
fields: [domain.resolvedAddressId],
references: [account.id]
}),
owner: one(account, { fields: [domain.ownerId], references: [account.id] }),
parent: one(domain, { fields: [domain.parentId], references: [domain.id] }),
resolver: one(resolver, {
fields: [domain.resolverId],
references: [resolver.id]
}),
subdomains: many(domain, { relationName: "parent" }),
registrant: one(account, {
fields: [domain.registrantId],
references: [account.id]
}),
wrappedOwner: one(account, {
fields: [domain.wrappedOwnerId],
references: [account.id]
}),
wrappedDomain: one(wrappedDomain, {
fields: [domain.id],
references: [wrappedDomain.domainId]
}),
registration: one(registration, {
fields: [domain.id],
references: [registration.domainId]
}),
// event relations
transfers: many(transfer),
newOwners: many(newOwner),
newResolvers: many(newResolver),
newTTLs: many(newTTL),
wrappedTransfers: many(wrappedTransfer),
nameWrappeds: many(nameWrapped),
nameUnwrappeds: many(nameUnwrapped),
fusesSets: many(fusesSet),
expiryExtendeds: many(expiryExtended)
}));
var account = onchainTable("accounts", (t) => ({
id: t.hex().primaryKey()
}));
var accountRelations = relations(account, ({ many }) => ({
domains: many(domain),
wrappedDomains: many(wrappedDomain),
registrations: many(registration)
}));
var resolver = onchainTable(
"resolvers",
(t) => ({
// The unique identifier for this resolver, which is a concatenation of the domain namehash and the resolver address
id: t.text().primaryKey(),
// The domain that this resolver is associated with
domainId: t.hex().notNull(),
// The address of the resolver contract
address: t.hex().notNull().$type(),
// The current value of the 'addr' record for this resolver, as determined by the associated events
addrId: t.hex(),
// The content hash for this resolver, in binary format
contentHash: t.text(),
// The set of observed text record keys for this resolver
// NOTE: we avoid .notNull.default([]) to match subgraph behavior
texts: t.text().array(),
// The set of observed SLIP-44 coin types for this resolver
// NOTE: we avoid .notNull.default([]) to match subgraph behavior
coinTypes: t.bigint().array(),
/**
* Represents the value of the reverse-resolution (ENSIP-3) name() record.
*
* The emitted record values are interpreted according to `interpretNameRecordValue` — unnormalized
* names and empty string values are interpreted as a deletion of the associated record (represented
* here as `null`).
*
* If set, the value of this field is guaranteed to be a non-empty-string normalized ENS name
* (see `interpretNameRecordValue` for guarantees).
*
* Note that this is an extension to the original subgraph schema and legacy subgraph compatibility
* is not relevant.
*/
name: t.text()
}),
(t) => ({
idx: index().on(t.domainId)
})
);
var resolverRelations = relations(resolver, ({ one, many }) => ({
addr: one(account, { fields: [resolver.addrId], references: [account.id] }),
domain: one(domain, { fields: [resolver.domainId], references: [domain.id] }),
// event relations
addrChangeds: many(addrChanged),
multicoinAddrChangeds: many(multicoinAddrChanged),
nameChangeds: many(nameChanged),
abiChangeds: many(abiChanged),
pubkeyChangeds: many(pubkeyChanged),
textChangeds: many(textChanged),
contenthashChangeds: many(contenthashChanged),
interfaceChangeds: many(interfaceChanged),
authorisationChangeds: many(authorisationChanged),
versionChangeds: many(versionChanged)
}));
var registration = onchainTable(
"registrations",
(t) => ({
// The unique identifier of the registration
id: t.hex().primaryKey(),
// The domain name associated with the registration
domainId: t.hex().notNull(),
// The registration date of the domain
registrationDate: t.bigint().notNull(),
// The expiry date of the domain
expiryDate: t.bigint().notNull(),
// The cost associated with the domain registration
cost: t.bigint(),
// The account that registered the domain
registrantId: t.hex().notNull(),
/**
* The Label associated with the domain registration.
*
* If REPLACE_UNNORMALIZED is true, this value is guaranteed to be an Interpreted Label which is either:
* a) a normalized Label, or
* b) an Encoded LabelHash of the Literal Label value found onchain.
*
* Note that the type of the column will remain string | null, for legacy subgraph compatibility.
* In practice however, when REPLACE_UNNORMALIZED is true, because there is no Registration entity
* for the root Node—the only Node with a null labelName—this field will never be null.
*
* @see https://ensnode.io/docs/reference/terminology#interpreted-label
*
* If REPLACE_UNNORMALIZED is false, this value may contain:
* a) null, or
* b) a Literal Label that may or may not be normalized and may or may not be an Encoded LabelHash.
*
* @see https://ensnode.io/docs/reference/terminology#literal-label
*/
labelName: t.text()
}),
(t) => ({
idx: index().on(t.domainId)
})
);
var registrationRelations = relations(registration, ({ one, many }) => ({
domain: one(domain, {
fields: [registration.domainId],
references: [domain.id]
}),
registrant: one(account, {
fields: [registration.registrantId],
references: [account.id]
}),
// event relations
nameRegistereds: many(nameRegistered),
nameReneweds: many(nameRenewed),
nameTransferreds: many(nameTransferred)
}));
var wrappedDomain = onchainTable(
"wrapped_domains",
(t) => ({
// The unique identifier for each instance of the WrappedDomain entity
id: t.hex().primaryKey(),
// The domain that is wrapped by this WrappedDomain
domainId: t.hex().notNull(),
// The expiry date of the wrapped domain
expiryDate: t.bigint().notNull(),
// The number of fuses remaining on the wrapped domain
fuses: t.integer().notNull(),
// The account that owns this WrappedDomain
ownerId: t.hex().notNull(),
/**
* The Name that this WrappedDomain represents.
*
* If REPLACE_UNNORMALIZED is true, this value is guaranteed to be an Interpreted Name, which is either:
* a) a normalized Name, or
* b) a Name entirely consisting of Interpreted Labels.
*
* Note that the type of the column will remain string | null, for legacy subgraph compatibility,
* but in practice will never be null.
*
* @see https://ensnode.io/docs/reference/terminology#interpreted-name
*
* If REPLACE_UNNORMALIZED is false, this value may contain:
* a) null (in the case of the root node or invalid Name), or
* b) a Literal Name that may or may not be normalized and may or may not contain Encoded LabelHashes.
*
* @see https://ensnode.io/docs/reference/terminology#literal-name
*/
name: t.text()
}),
(t) => ({
idx: index().on(t.domainId)
})
);
var wrappedDomainRelations = relations(wrappedDomain, ({ one }) => ({
domain: one(domain, {
fields: [wrappedDomain.domainId],
references: [domain.id]
}),
owner: one(account, {
fields: [wrappedDomain.ownerId],
references: [account.id]
})
}));
var sharedEventColumns = (t) => ({
id: t.text().primaryKey(),
blockNumber: t.integer().notNull(),
transactionID: t.hex().notNull()
});
var domainEvent = (t) => ({
...sharedEventColumns(t),
domainId: t.hex().notNull()
});
var domainEventIndex = (t) => ({
// primary reverse lookup
idx: index().on(t.domainId),
// sorting index
idx_compound: index().on(t.domainId, t.id)
});
var transfer = onchainTable(
"transfers",
(t) => ({
...domainEvent(t),
ownerId: t.hex().notNull()
}),
domainEventIndex
);
var newOwner = onchainTable(
"new_owners",
(t) => ({
...domainEvent(t),
ownerId: t.hex().notNull(),
parentDomainId: t.hex().notNull()
}),
domainEventIndex
);
var newResolver = onchainTable(
"new_resolvers",
(t) => ({
...domainEvent(t),
resolverId: t.text().notNull()
}),
domainEventIndex
);
var newTTL = onchainTable(
"new_ttls",
(t) => ({
...domainEvent(t),
ttl: t.bigint().notNull()
}),
domainEventIndex
);
var wrappedTransfer = onchainTable(
"wrapped_transfers",
(t) => ({
...domainEvent(t),
ownerId: t.hex().notNull()
}),
domainEventIndex
);
var nameWrapped = onchainTable(
"name_wrapped",
(t) => ({
...domainEvent(t),
name: t.text(),
fuses: t.integer().notNull(),
ownerId: t.hex().notNull(),
expiryDate: t.bigint().notNull()
}),
domainEventIndex
);
var nameUnwrapped = onchainTable(
"name_unwrapped",
(t) => ({
...domainEvent(t),
ownerId: t.hex().notNull()
}),
domainEventIndex
);
var fusesSet = onchainTable(
"fuses_set",
(t) => ({
...domainEvent(t),
fuses: t.integer().notNull()
}),
domainEventIndex
);
var expiryExtended = onchainTable(
"expiry_extended",
(t) => ({
...domainEvent(t),
expiryDate: t.bigint().notNull()
}),
domainEventIndex
);
var registrationEvent = (t) => ({
...sharedEventColumns(t),
registrationId: t.hex().notNull()
});
var registrationEventIndex = (t) => ({
// primary reverse lookup
idx: index().on(t.registrationId),
// sorting index
idx_compound: index().on(t.registrationId, t.id)
});
var nameRegistered = onchainTable(
"name_registered",
(t) => ({
...registrationEvent(t),
registrantId: t.hex().notNull(),
expiryDate: t.bigint().notNull()
}),
registrationEventIndex
);
var nameRenewed = onchainTable(
"name_renewed",
(t) => ({
...registrationEvent(t),
expiryDate: t.bigint().notNull()
}),
registrationEventIndex
);
var nameTransferred = onchainTable(
"name_transferred",
(t) => ({
...registrationEvent(t),
newOwnerId: t.hex().notNull()
}),
registrationEventIndex
);
var resolverEvent = (t) => ({
...sharedEventColumns(t),
resolverId: t.text().notNull()
});
var resolverEventIndex = (t) => ({
// primary reverse lookup
idx: index().on(t.resolverId),
// sorting index
idx_compound: index().on(t.resolverId, t.id)
});
var addrChanged = onchainTable(
"addr_changed",
(t) => ({
...resolverEvent(t),
addrId: t.hex().notNull()
}),
resolverEventIndex
);
var multicoinAddrChanged = onchainTable(
"multicoin_addr_changed",
(t) => ({
...resolverEvent(t),
coinType: t.bigint().notNull(),
addr: t.hex().notNull()
}),
resolverEventIndex
);
var nameChanged = onchainTable(
"name_changed",
(t) => ({
...resolverEvent(t),
name: t.text().notNull()
}),
resolverEventIndex
);
var abiChanged = onchainTable(
"abi_changed",
(t) => ({
...resolverEvent(t),
contentType: t.bigint().notNull()
}),
resolverEventIndex
);
var pubkeyChanged = onchainTable(
"pubkey_changed",
(t) => ({
...resolverEvent(t),
x: t.hex().notNull(),
y: t.hex().notNull()
}),
resolverEventIndex
);
var textChanged = onchainTable(
"text_changed",
(t) => ({
...resolverEvent(t),
key: t.text().notNull(),
value: t.text()
}),
resolverEventIndex
);
var contenthashChanged = onchainTable(
"contenthash_changed",
(t) => ({
...resolverEvent(t),
hash: t.hex().notNull()
}),
resolverEventIndex
);
var interfaceChanged = onchainTable(
"interface_changed",
(t) => ({
...resolverEvent(t),
interfaceID: t.hex().notNull(),
implementer: t.hex().notNull()
}),
resolverEventIndex
);
var authorisationChanged = onchainTable(
"authorisation_changed",
(t) => ({
...resolverEvent(t),
owner: t.hex().notNull(),
target: t.hex().notNull(),
isAuthorized: t.boolean().notNull()
}),
resolverEventIndex
);
var versionChanged = onchainTable(
"version_changed",
(t) => ({
...resolverEvent(t),
version: t.bigint().notNull()
}),
resolverEventIndex
);
var transferRelations = relations(transfer, ({ one }) => ({
domain: one(domain, { fields: [transfer.domainId], references: [domain.id] }),
owner: one(account, { fields: [transfer.ownerId], references: [account.id] })
}));
var newOwnerRelations = relations(newOwner, ({ one }) => ({
domain: one(domain, { fields: [newOwner.domainId], references: [domain.id] }),
owner: one(account, { fields: [newOwner.ownerId], references: [account.id] }),
parentDomain: one(domain, {
fields: [newOwner.parentDomainId],
references: [domain.id]
})
}));
var newResolverRelations = relations(newResolver, ({ one }) => ({
domain: one(domain, {
fields: [newResolver.domainId],
references: [domain.id]
}),
resolver: one(resolver, {
fields: [newResolver.resolverId],
references: [resolver.id]
})
}));
var newTTLRelations = relations(newTTL, ({ one }) => ({
domain: one(domain, { fields: [newTTL.domainId], references: [domain.id] })
}));
var wrappedTransferRelations = relations(wrappedTransfer, ({ one }) => ({
domain: one(domain, {
fields: [wrappedTransfer.domainId],
references: [domain.id]
}),
owner: one(account, {
fields: [wrappedTransfer.ownerId],
references: [account.id]
})
}));
var nameWrappedRelations = relations(nameWrapped, ({ one }) => ({
domain: one(domain, {
fields: [nameWrapped.domainId],
references: [domain.id]
}),
owner: one(account, {
fields: [nameWrapped.ownerId],
references: [account.id]
})
}));
var nameUnwrappedRelations = relations(nameUnwrapped, ({ one }) => ({
domain: one(domain, {
fields: [nameUnwrapped.domainId],
references: [domain.id]
}),
owner: one(account, {
fields: [nameUnwrapped.ownerId],
references: [account.id]
})
}));
var fusesSetRelations = relations(fusesSet, ({ one }) => ({
domain: one(domain, { fields: [fusesSet.domainId], references: [domain.id] })
}));
var expiryExtendedRelations = relations(expiryExtended, ({ one }) => ({
domain: one(domain, {
fields: [expiryExtended.domainId],
references: [domain.id]
})
}));
var nameRegisteredRelations = relations(nameRegistered, ({ one }) => ({
registration: one(registration, {
fields: [nameRegistered.registrationId],
references: [registration.id]
}),
registrant: one(account, {
fields: [nameRegistered.registrantId],
references: [account.id]
})
}));
var nameRenewedRelations = relations(nameRenewed, ({ one }) => ({
registration: one(registration, {
fields: [nameRenewed.registrationId],
references: [registration.id]
})
}));
var nameTransferredRelations = relations(nameTransferred, ({ one }) => ({
registration: one(registration, {
fields: [nameTransferred.registrationId],
references: [registration.id]
}),
newOwner: one(account, {
fields: [nameTransferred.newOwnerId],
references: [account.id]
})
}));
var addrChangedRelations = relations(addrChanged, ({ one }) => ({
resolver: one(resolver, {
fields: [addrChanged.resolverId],
references: [resolver.id]
}),
addr: one(account, {
fields: [addrChanged.addrId],
references: [account.id]
})
}));
var multicoinAddrChangedRelations = relations(multicoinAddrChanged, ({ one }) => ({
resolver: one(resolver, {
fields: [multicoinAddrChanged.resolverId],
references: [resolver.id]
})
}));
var nameChangedRelations = relations(nameChanged, ({ one }) => ({
resolver: one(resolver, {
fields: [nameChanged.resolverId],
references: [resolver.id]
})
}));
var abiChangedRelations = relations(abiChanged, ({ one }) => ({
resolver: one(resolver, {
fields: [abiChanged.resolverId],
references: [resolver.id]
})
}));
var pubkeyChangedRelations = relations(pubkeyChanged, ({ one }) => ({
resolver: one(resolver, {
fields: [pubkeyChanged.resolverId],
references: [resolver.id]
})
}));
var textChangedRelations = relations(textChanged, ({ one }) => ({
resolver: one(resolver, {
fields: [textChanged.resolverId],
references: [resolver.id]
})
}));
var contenthashChangedRelations = relations(contenthashChanged, ({ one }) => ({
resolver: one(resolver, {
fields: [contenthashChanged.resolverId],
references: [resolver.id]
})
}));
var interfaceChangedRelations = relations(interfaceChanged, ({ one }) => ({
resolver: one(resolver, {
fields: [interfaceChanged.resolverId],
references: [resolver.id]
})
}));
var authorisationChangedRelations = relations(authorisationChanged, ({ one }) => ({
resolver: one(resolver, {
fields: [authorisationChanged.resolverId],
references: [resolver.id]
})
}));
var versionChangedRelations = relations(versionChanged, ({ one }) => ({
resolver: one(resolver, {
fields: [versionChanged.resolverId],
references: [resolver.id]
})
}));
// src/resolver-records.schema.ts
import { onchainTable as onchainTable2, relations as relations2, uniqueIndex } from "ponder";
var ext_resolverRecords_resolver_relations = relations2(resolver, ({ one, many }) => ({
// resolver has many address records
addressRecords: many(ext_resolverAddressRecords),
// resolver has many text records
// NOTE: can't use `texts` because Resolver.texts is used by subgraph schema
textRecords: many(ext_resolverTextRecords)
}));
var ext_resolverAddressRecords = onchainTable2(
"ext_resolver_address_records",
(t) => ({
// keyed by (resolverId, coinType)
id: t.text().primaryKey(),
resolverId: t.text().notNull(),
coinType: t.bigint().notNull(),
address: t.text().notNull()
}),
(t) => ({
byResolverIdAndCoinType: uniqueIndex().on(t.resolverId, t.coinType)
})
);
var ext_resolverAddressRecordsRelations = relations2(
ext_resolverAddressRecords,
({ one, many }) => ({
// belongs to resolver
resolver: one(resolver, {
fields: [ext_resolverAddressRecords.resolverId],
references: [resolver.id]
})
})
);
var ext_resolverTextRecords = onchainTable2(
"ext_resolver_text_records",
(t) => ({
// keyed by (resolverId, key)
id: t.text().primaryKey(),
resolverId: t.text().notNull(),
key: t.text().notNull(),
value: t.text().notNull()
}),
(t) => ({
byResolverIdAndKey: uniqueIndex().on(t.resolverId, t.key)
})
);
var ext_resolverTextRecordsRelations = relations2(
ext_resolverTextRecords,
({ one, many }) => ({
// belongs to resolver
resolver: one(resolver, {
fields: [ext_resolverTextRecords.resolverId],
references: [resolver.id]
})
})
);
// src/tokenscope.schema.ts
import { index as index2, onchainTable as onchainTable3 } from "ponder";
var ext_nameSales = onchainTable3(
"ext_name_sales",
(t) => ({
/**
* Unique and deterministic identifier of the onchain event associated with the sale.
*
* Composite key format: "{chainId}-{blockNumber}-{logIndex}" (e.g., "1-1234567-5")
*/
id: t.text().primaryKey(),
/**
* The chain where the sale occurred.
*/
chainId: t.integer().notNull(),
/**
* The block number on chainId where the sale occurred.
*/
blockNumber: t.bigint().notNull(),
/**
* The log index position of the sale event within blockNumber.
*/
logIndex: t.integer().notNull(),
/**
* The EVM transaction hash on chainId associated with the sale.
*/
transactionHash: t.hex().notNull(),
/**
* The Seaport order hash.
*/
orderHash: t.hex().notNull(),
/**
* The address of the contract on chainId that manages tokenId.
*/
contractAddress: t.hex().notNull(),
/**
* The tokenId managed by contractAddress that was sold.
*
* In a general context (outside of TokenScope) ERC1155 NFTs may have
* multiple copies, however TokenScope guarantees that all indexed NFTs
* never have an amount / balance > 1.
*/
tokenId: t.bigint().notNull(),
/**
* The CAIP-19 Asset Namespace of the token that was sold. Either `erc721` or `erc1155`.
*
* @see https://chainagnostic.org/CAIPs/caip-19
*/
assetNamespace: t.text().notNull(),
/**
* The CAIP-19 Asset ID of token that was sold. This is a globally unique reference to the
* specific asset in question.
*
* @see https://chainagnostic.org/CAIPs/caip-19
*/
assetId: t.text().notNull(),
/**
* The namehash (Node) of the ENS domain that was sold.
*/
domainId: t.hex().notNull(),
/**
* The account that bought the token controlling ownership of domainId from
* the seller for the amount of currency associated with the sale.
*/
buyer: t.hex().notNull(),
/**
* The account that sold the token controlling ownership of domainId to
* buyer for the amount of currency associated with the sale.
*/
seller: t.hex().notNull(),
/**
* Currency of the payment (ETH, USDC or DAI) from buyer to seller in exchange for tokenId.
*/
currency: t.text().notNull(),
/**
* The amount of currency paid from buyer to seller in exchange for tokenId.
*
* Denominated in the smallest unit of currency.
*
* Amount interpretation depends on currency:
* - ETH/WETH: Amount in wei (1 ETH = 10^18 wei)
* - USDC: Amount in micro-units (1 USDC = 10^6 units)
* - DAI: Amount in wei-equivalent (1 DAI = 10^18 units)
*/
amount: t.bigint().notNull(),
/**
* Unix timestamp of the block timestamp when the sale occurred.
*/
timestamp: t.bigint().notNull()
}),
(t) => ({
idx_domainId: index2().on(t.domainId),
idx_assetId: index2().on(t.assetId),
idx_buyer: index2().on(t.buyer),
idx_seller: index2().on(t.seller),
idx_timestamp: index2().on(t.timestamp)
})
);
var ext_nameTokens = onchainTable3(
"ext_name_tokens",
(t) => ({
/**
* The CAIP-19 Asset ID of the token.
*
* This is a globally unique reference to the token.
*
* @see https://chainagnostic.org/CAIPs/caip-19
*/
id: t.text().primaryKey(),
/**
* The namehash (Node) of the ENS name associated with the token.
*
* Note: An ENS name may have more than one distinct token across time. It is
* also possible for multiple distinct tokens for an ENS name to have
* a mintStatus of `minted` at the same time. For example:
* - When a direct subname of .eth is wrapped by the NameWrapper. This state
* has one minted token for the name managed by the BaseRegistrar (this
* token will be owned by the NameWrapper) and another minted token for
* the name managed by the NameWrapper (owned by the effective owner of
* the name).
* - When a direct subname of .eth is wrapped by the NameWrapper and then
* unwrapped. This state has one minted token (managed by the BaseRegistrar)
* and another burned token (managed by the NameWrapper).
*/
domainId: t.hex().notNull(),
/**
* The chain that manages the token.
*/
chainId: t.integer().notNull(),
/**
* The address of the contract on chainId that manages the token.
*/
contractAddress: t.hex().notNull(),
/**
* The tokenId of the token managed by contractAddress.
*
* In a general context (outside of TokenScope) ERC1155 NFTs may have
* multiple copies, however TokenScope guarantees that all indexed NFTs
* never have an amount / balance > 1.
*/
tokenId: t.bigint().notNull(),
/**
* The CAIP-19 Asset Namespace of the token. Either `erc721` or `erc1155`.
*
* @see https://chainagnostic.org/CAIPs/caip-19
*/
assetNamespace: t.text().notNull(),
/**
* The account that owns the token.
*
* Value is zeroAddress if and only if mintStatus is `burned`.
*
* Note: The owner of the token for a given domainId may differ from the
* owner of the associated node in the registry. For example:
* - Consider the case where address X owns the ENS name `foo.eth` in
* both the BaseRegistrar and the Registry. If X sends a request directly
* to the Registry to transfer ownership to Y, ownership of `foo.eth` will
* be transferred to Y in the Registry but not in the BaseRegistrar.
* - ... for the case above, the BaseRegistrar implements a `reclaim`
* allowing the owner of the name in the BaseRegistrar to reclaim ownership
* of the name in the Registry.
*
* Note: When a name is wrapped by the NameWrapper, the owner of the token
* in the BaseRegistrar is the NameWrapper, while a new token for the name is
* minted by the NameWrapper and owned by the effective owner of the name.
*/
owner: t.hex().notNull(),
/**
* The mint status of the token. Either `minted` or `burned`.
*
* After we index a NFT we never delete it from our index. Instead, when an
* indexed NFT is burned onchain we retain its record and update its mint
* status as `burned`. If a NFT is minted again after it is burned its mint
* status is updated to `minted`.
*/
mintStatus: t.text().notNull()
}),
(t) => ({
idx_domainId: index2().on(t.domainId),
idx_owner: index2().on(t.owner)
})
);
// src/resolver-relations.schema.ts
import { onchainTable as onchainTable4, relations as relations3, uniqueIndex as uniqueIndex2 } from "ponder";
var ext_resolverRelations_domain_relations = relations3(domain, ({ one, many }) => ({
// domain has many resolver relations (i.e. one per chain, see above)
resolverRelations: many(ext_domainResolverRelation)
}));
var ext_resolverRelations_resolver_relations = relations3(resolver, ({ one, many }) => ({
// resolver has many domain relations
domainRelations: many(ext_domainResolverRelation)
}));
var ext_domainResolverRelation = onchainTable4(
"ext_domain_resolver_relations",
(t) => ({
// keyed by (chainId, domainId)
id: t.text().primaryKey(),
chainId: t.integer().notNull(),
domainId: t.text().notNull(),
resolverId: t.text().notNull()
}),
(t) => ({
byChainIdAndDomain: uniqueIndex2().on(t.chainId, t.domainId)
})
);
var ext_domainResolverRelationsRelations = relations3(
ext_domainResolverRelation,
({ one, many }) => ({
// belongs to domain
domain: one(domain, {
fields: [ext_domainResolverRelation.domainId],
references: [domain.id]
}),
// belongs to resolver
resolver: one(resolver, {
fields: [ext_domainResolverRelation.resolverId],
references: [resolver.id]
})
})
);
// src/referrals.schema.ts
import { index as index3, onchainTable as onchainTable5, relations as relations4 } from "ponder";
var ext_registrationReferral = onchainTable5(
"ext_registration_referral",
(t) => ({
// keyed by any arbitrary unique id, usually `event.id`
id: t.text().primaryKey(),
referrerId: t.hex().notNull(),
domainId: t.text().notNull(),
refereeId: t.hex().notNull(),
baseCost: t.bigint().notNull(),
premium: t.bigint().notNull(),
total: t.bigint().notNull(),
// chainId the transaction occurred on
chainId: t.integer().notNull(),
// transaction's hash
transactionHash: t.hex().notNull(),
// block's Unix timestamp in seconds
timestamp: t.bigint().notNull()
}),
(t) => ({
byRefereeId: index3().on(t.refereeId),
byReferrerId: index3().on(t.referrerId)
})
);
var ext_registrationReferral_relations = relations4(
ext_registrationReferral,
({ one, many }) => ({
// RegistrationReferral references one Referrer
referrer: one(ext_referrer, {
fields: [ext_registrationReferral.referrerId],
references: [ext_referrer.id]
}),
// RegistrationReferral references one Account (as referee)
referee: one(account, {
fields: [ext_registrationReferral.refereeId],
references: [account.id]
}),
// RegistrationReferral references one Domain
domain: one(domain, {
fields: [ext_registrationReferral.domainId],
references: [domain.id]
})
})
);
var ext_renewalReferral = onchainTable5(
"ext_renewal_referral",
(t) => ({
// keyed by any arbitrary unique id, usually `event.id`
id: t.text().primaryKey(),
referrerId: t.hex().notNull(),
refereeId: t.hex().notNull(),
domainId: t.text().notNull(),
cost: t.bigint().notNull(),
// chainId the transaction occurred on
chainId: t.integer().notNull(),
// transaction's hash
transactionHash: t.hex().notNull(),
// Block's Unix timestamp in seconds
timestamp: t.bigint().notNull()
}),
(t) => ({
byRefereeId: index3().on(t.refereeId),
byReferrerId: index3().on(t.referrerId)
})
);
var ext_renewalReferral_relations = relations4(ext_renewalReferral, ({ one, many }) => ({
// RenewalReferral references one Referrer
referrer: one(ext_referrer, {
fields: [ext_renewalReferral.referrerId],
references: [ext_referrer.id]
}),
// RenewalReferral references one Account (as referee)
referee: one(account, {
fields: [ext_renewalReferral.refereeId],
references: [account.id]
}),
// RenewalReferral references one Domain
domain: one(domain, {
fields: [ext_renewalReferral.domainId],
references: [domain.id]
})
}));
var ext_referrals_domain_relations = relations4(domain, ({ one, many }) => ({
// Domain has many RegistrationReferrals
registrationReferrals: many(ext_registrationReferral),
// Domain has many RenewalReferrals
renewalReferrals: many(ext_renewalReferral)
}));
var ext_referrer = onchainTable5(
"ext_referral_totals",
(t) => ({
// keyed by Referrer's id (bytes32 hex)
id: t.hex().primaryKey(),
valueWei: t.bigint().notNull()
}),
(t) => ({})
);
var ext_referrer_relations = relations4(ext_referrer, ({ one, many }) => ({
// Referrer has many RegistrationReferrals
registrationReferrals: many(ext_registrationReferral),
// Referrer has many RenewalReferrals
renewalReferrals: many(ext_renewalReferral)
}));
// src/primary-names.schema.ts
import { onchainTable as onchainTable6, relations as relations5, uniqueIndex as uniqueIndex3 } from "ponder";
var ext_primaryNames_domain_relations = relations5(account, ({ one, many }) => ({
// account has many primary names
primaryNames: many(ext_primaryName)
}));
var ext_primaryName = onchainTable6(
"ext_primary_names",
(t) => ({
// keyed by (address, coinType)
id: t.text().primaryKey(),
address: t.hex().notNull(),
coinType: t.bigint().notNull(),
/**
* Represents the ENSIP-19 Primary Name value for a given (address, coinType).
*
* The value of this field is guaranteed to be a non-empty-string normalized ENS name.
*/
name: t.text().notNull()
}),
(t) => ({
byAddressAndCoinType: uniqueIndex3().on(t.address, t.coinType)
})
);
var ext_primaryNameRelations = relations5(ext_primaryName, ({ one, many }) => ({
// belongs to account
account: one(account, {
fields: [ext_primaryName.address],
references: [account.id]
})
}));
export {
abiChanged,
abiChangedRelations,
account,
accountRelations,
addrChanged,
addrChangedRelations,
authorisationChanged,
authorisationChangedRelations,
contenthashChanged,
contenthashChangedRelations,
domain,
domainRelations,
expiryExtended,
expiryExtendedRelations,
ext_domainResolverRelation,
ext_domainResolverRelationsRelations,
ext_nameSales,
ext_nameTokens,
ext_primaryName,
ext_primaryNameRelations,
ext_primaryNames_domain_relations,
ext_referrals_domain_relations,
ext_referrer,
ext_referrer_relations,
ext_registrationReferral,
ext_registrationReferral_relations,
ext_renewalReferral,
ext_renewalReferral_relations,
ext_resolverAddressRecords,
ext_resolverAddressRecordsRelations,
ext_resolverRecords_resolver_relations,
ext_resolverRelations_domain_relations,
ext_resolverRelations_resolver_relations,
ext_resolverTextRecords,
ext_resolverTextRecordsRelations,
fusesSet,
fusesSetRelations,
interfaceChanged,
interfaceChangedRelations,
multicoinAddrChanged,
multicoinAddrChangedRelations,
nameChanged,
nameChangedRelations,
nameRegistered,
nameRegisteredRelations,
nameRenewed,
nameRenewedRelations,
nameTransferred,
nameTransferredRelations,
nameUnwrapped,
nameUnwrappedRelations,
nameWrapped,
nameWrappedRelations,
newOwner,
newOwnerRelations,
newResolver,
newResolverRelations,
newTTL,
newTTLRelations,
pubkeyChanged,
pubkeyChangedRelations,
registration,
registrationRelations,
resolver,
resolverRelations,
textChanged,
textChangedRelations,
transfer,
transferRelations,
versionChanged,
versionChangedRelations,
wrappedDomain,
wrappedDomainRelations,
wrappedTransfer,
wrappedTransferRelations
};
//# sourceMappingURL=ponder.schema.js.map