import { Commitment, Connection, PublicKey } from "@solana/web3.js"; import { GatewayToken } from "./types"; import { NetworkFeature } from "./lib/GatewayNetworkData"; export * from "./lib/instruction"; export * from "./lib/util"; export * from "./lib/GatewayTokenData"; export * from "./lib/GatewayNetworkData"; export * from "./types"; export * from "./lib/constants"; export * from "./lib/AssignablePublicKey"; /** * Find all gateway tokens (optionally for a user) on a gatekeeper network, optionally filtering out revoked tokens. * * Warning - this uses the Solana getProgramAccounts RPC endpoint, which is inefficient and may be * blocked by some RPC services. * * @param connection A solana connection object * @param owner The token owner (optional) * @param gatekeeperNetwork The network to find a token for * @param {boolean=false} includeRevoked If false (default), filter out revoked tokens * @param page If a large number of tokens has been issued, the request to the RPC endpoint may time out. * In this case, enable pagination by setting page variable * Pagination is not supported in the RPC API per-se, but this approximates it by * adding another filter on the first byte of the owner address. * Each page requests the accounts that match that byte. * @returns {Promise} All tokens for the owner */ export declare const findGatewayTokens: (connection: Connection, owner: PublicKey | undefined, gatekeeperNetwork: PublicKey, includeRevoked?: boolean, page?: number) => Promise; /** * Finds all gateway tokens for a user by iterating through the index seed * and requesting a page of addresses at a time. * * It assumes a small number of passes per GKN, so the page size by default is 5. * Sorts the result by active status and expiry, so unexpired active passes appear first * @param connection * @param owner * @param gatekeeperNetwork * @param includeRevoked * @param offset * @param page */ export declare const findGatewayTokensForOwnerAndNetwork: (connection: Connection, owner: PublicKey, gatekeeperNetwork: PublicKey, includeRevoked?: boolean, offset?: number, page?: number) => Promise; /** * Get a gateway token for the owner and network, if it exists. * @param connection A solana connection object * @param owner The token owner * @param gatekeeperNetwork The network to find a token for * @param includeRevoked If false (default), filter out revoked tokens * @returns Promise A gateway token, if one exists for the owner */ export declare const findGatewayToken: (connection: Connection, owner: PublicKey, gatekeeperNetwork: PublicKey, includeRevoked?: boolean) => Promise; /** * Register a callback to be called whenever a gateway token changes state * @param connection A solana connection object * @param gatewayTokenAddress The address of the gateway token * @param callback The callback to register * @param commitment The solana commitment level at which to register gateway token changes. Defaults to 'confirmed' * @return The subscription id */ export declare const onGatewayTokenChange: (connection: Connection, gatewayTokenAddress: PublicKey, callback: (gatewayToken: GatewayToken) => void, commitment?: Commitment) => number; /** * Register a callback to be called whenever a gateway token is created or changes state * @param connection A solana connection object * @param owner The gateway token owner * @param gatekeeperNetwork * @param callback The callback to register * @param commitment The solana commitment level at which to register gateway token changes. Defaults to 'confirmed' * @param seed * @return The subscription id */ export declare const onGatewayToken: (connection: Connection, owner: PublicKey, gatekeeperNetwork: PublicKey, callback: (gatewayToken: GatewayToken) => void, commitment?: Commitment, seed?: number) => number; /** * Lookup the gateway token at a given address * @param connection A solana connection object * @param gatewayTokenAddress The address of the gateway token */ export declare const getGatewayToken: (connection: Connection, gatewayTokenAddress: PublicKey) => Promise; /** * Return true if an address feature exists. * @param connection * @param feature The feature to check * @param network The gatekeeper network */ export declare const featureExists: (connection: Connection, feature: NetworkFeature, network: PublicKey) => Promise;