Skip to main content

Namespace: helpers

Classes

Interfaces

Type Aliases

ChainName

Ƭ ChainName: keyof TablelandNetworkConfig

The set of supported chain names as used by the Tableland network.

Defined in

@tableland/sdk/src/helpers/chains.ts:12


Config

Ƭ Config: Partial<ReadConfig & SignerConfig>

Defined in

@tableland/sdk/src/helpers/config.ts:22


ExternalProvider

Ƭ ExternalProvider: providers.ExternalProvider

Defined in

@tableland/sdk/src/helpers/ethers.ts:11


NameMapping

Ƭ NameMapping: Record<string, string>

A series of mappings from a table alias to its globally unique table name.

Defined in

@tableland/sdk/src/helpers/config.ts:27


NormalizedStatement

Ƭ NormalizedStatement: sqlparser.NormalizedStatement

Defined in

@tableland/sqlparser/types.d.ts:34


PollingController

Ƭ PollingController: Signal & Interval & Timeout

A polling controller with a custom timeout & interval.

Defined in

@tableland/sdk/src/helpers/await.ts:48


RegistryReceipt

Ƭ RegistryReceipt: Required<Omit<TransactionReceipt, "error" | "errorEventIdx">>

RegistryReceipt is based on the TransactionReceipt type which defined by the API spec. The API v1 has a known problem where it only returns the first tableId from a transaction.

Defined in

@tableland/sdk/src/helpers/ethers.ts:55


StatementType

Ƭ StatementType: sqlparser.StatementType

Defined in

@tableland/sqlparser/types.d.ts:36

Variables

supportedChains

Const supportedChains: Record<keyof TablelandNetworkConfig, ChainInfo>

The set of chains and their information as supported by the Tableland network.

Defined in

@tableland/sdk/src/helpers/chains.ts:67

Functions

checkWait

checkWait(config, receipt, controller?): Promise<WaitableTransactionReceipt>

Parameters

NameType
configPartial<ReadConfig & SignerConfig> & Partial<AutoWaitConfig>
receiptWaitableTransactionReceipt
controller?PollingController

Returns

Promise<WaitableTransactionReceipt>

Defined in

@tableland/sdk/src/helpers/config.ts:41


createPollingController

createPollingController(timeout?, pollingInterval?): PollingController

Create a polling controller with a custom timeout & interval.

Parameters

NameTypeDefault valueDescription
timeoutnumber60_000The timeout period in milliseconds.
pollingIntervalnumber1500-

Returns

PollingController

A PollingController with the custom timeout & interval.

Defined in

@tableland/sdk/src/helpers/await.ts:95


createSignal

createSignal(): Signal

Create a signal to abort a request.

Returns

Signal

A Signal to abort a request.

Defined in

@tableland/sdk/src/helpers/await.ts:79


extractBaseUrl

extractBaseUrl(conn?, chainNameOrId?): Promise<string>

Parameters

NameType
connPartial<ReadConfig & SignerConfig>
chainNameOrId?number | keyof TablelandNetworkConfig

Returns

Promise<string>

Defined in

@tableland/sdk/src/helpers/config.ts:53


extractChainId

extractChainId(conn?): Promise<number>

Parameters

NameType
connPartial<ReadConfig & SignerConfig>

Returns

Promise<number>

Defined in

@tableland/sdk/src/helpers/config.ts:82


extractSigner

extractSigner(conn?, external?): Promise<Signer>

Parameters

NameType
connPartial<ReadConfig & SignerConfig>
external?ExternalProvider

Returns

Promise<Signer>

Defined in

@tableland/sdk/src/helpers/config.ts:72


getBaseUrl

getBaseUrl(chainNameOrId): string

Get the default host uri for a given chain name.

Parameters

NameTypeDescription
chainNameOrIdnumber | keyof TablelandNetworkConfigThe requested chain name.

Returns

string

A string representing the default host uri for a given chain.

Defined in

@tableland/sdk/src/helpers/chains.ts:135


getChainId

getChainId(chainNameOrId): number

Get the default chain ID for a given chain name.

Parameters

NameTypeDescription
chainNameOrIdnumber | keyof TablelandNetworkConfigThe requested chain name or ID.

Returns

number

A number representing the default chain ID of the requested chain.

Defined in

@tableland/sdk/src/helpers/chains.ts:126


getChainInfo

getChainInfo(chainNameOrId): ChainInfo

Get the default chain information for a given chain name.

Parameters

NameTypeDescription
chainNameOrIdnumber | keyof TablelandNetworkConfigThe requested chain name or ID.

Returns

ChainInfo

An object containing the default chainId, contractAddress, chainName, and baseUrl for the given chain.

Defined in

@tableland/sdk/src/helpers/chains.ts:82


getContractAddress

getContractAddress(chainNameOrId): string

Get the default contract address for a given chain name.

Parameters

NameTypeDescription
chainNameOrIdnumber | keyof TablelandNetworkConfigThe requested chain name or ID.

Returns

string

A hex string representing the default address for the Tableland registry contract.

Defined in

@tableland/sdk/src/helpers/chains.ts:117


getContractAndOverrides

getContractAndOverrides(signer, chainId): Promise<{ contract: TablelandTables ; overrides: Overrides }>

Parameters

NameType
signerSigner
chainIdnumber

Returns

Promise<{ contract: TablelandTables ; overrides: Overrides }>

Defined in

@tableland/sdk/src/registry/contract.ts:36


getContractReceipt

getContractReceipt(tx): Promise<MultiEventTransactionReceipt>

Given a transaction, this helper will return the tableIds that were part of the transaction. Especially useful for transactions that create new tables because you need the tableId to calculate the full table name.

Parameters

NameType
txContractTransaction

Returns

Promise<MultiEventTransactionReceipt>

tableland receipt

Defined in

@tableland/sdk/src/helpers/ethers.ts:84


getDefaultProvider

getDefaultProvider(network?, options?): BaseProvider

Parameters

NameType
network?Networkish
options?any

Returns

BaseProvider

Defined in

@ethersproject/providers/lib/index.d.ts:21


getSigner

getSigner(external?): Promise<Signer>

Request a signer object from the global ethereum object.

Parameters

NameTypeDescription
external?ExternalProviderA valid external provider. Defaults to globalThis.ethereum if not provided.

Returns

Promise<Signer>

A promise that resolves to a valid web3 provider/signer

Throws

If no global ethereum object is available.

Defined in

@tableland/sdk/src/helpers/ethers.ts:117


isTestnet

isTestnet(chainNameOrId): boolean

Get whether or not a chain is a testnet.

Parameters

NameTypeDescription
chainNameOrIdnumber | keyof TablelandNetworkConfigThe requested chain name or ID.

Returns

boolean

An boolean to indicate the testnet classification of the given chain.

Defined in

@tableland/sdk/src/helpers/chains.ts:101


normalize

normalize(sql, nameMap?): Promise<NormalizedStatement>

Parameters

NameType
sqlstring
nameMap?NameMapping

Returns

Promise<NormalizedStatement>

Defined in

@tableland/sdk/src/helpers/parser.ts:13


overrideDefaults

overrideDefaults(chainNameOrId, values): void

Override the internal list of registry addresses and validator urls that will be used for Contract calls and read queries

Parameters

NameTypeDescription
chainNameOrIdnumber | keyof TablelandNetworkConfigEither the chain name or chainId. For a list of chain names see the evm-tableland networks file
valuesRecord<keyof ChainInfo, string | number>The values you would like to use to override the defaults. Example: {contractAddress: "0x000deadbeef", baseUrl: "https://my.validator.mydomain.tld"}

Returns

void

void

Defined in

@tableland/sdk/src/helpers/chains.ts:160


prepReadConfig

prepReadConfig(config): FetchConfig

Parameters

NameType
configPartial<ReadConfig>

Returns

FetchConfig

Defined in

@tableland/sdk/src/helpers/config.ts:96


readNameMapping

readNameMapping(aliases): Promise<NameMapping>

Read the NameMapping from an AliasesNameMap, which can support either synchronous or asynchronous read() execution. It will wrap a synchronous name mapping result, or wrap an unwrapped name mapping if asynchronous.

Parameters

NameTypeDescription
aliasesAliasesNameMapAn AliasesNameMap object.

Returns

Promise<NameMapping>

A promise containing a NameMapping object.

Defined in

@tableland/sdk/src/helpers/config.ts:117


validateTableName

validateTableName(tableName, isCreate?): Promise<ValidatedTable>

Parameters

NameTypeDefault value
tableNamestringundefined
isCreatebooleanfalse

Returns

Promise<ValidatedTable>

Defined in

@tableland/sdk/src/helpers/parser.ts:27


writeNameMapping

writeNameMapping(aliases, nameMap): Promise<void>

Write table aliases with an AliasesNameMap and a provided NameMapping, which can support either synchronous or asynchronous write() execution. It will wrap a synchronous result, or wrap an unwrapped result if asynchronous.

Parameters

NameTypeDescription
aliasesAliasesNameMapAn AliasesNameMap object to write to.
nameMapNameMappingA NameMapping object to write to the AliasesNameMap.

Returns

Promise<void>

A promise containing void upon write completion.

Defined in

@tableland/sdk/src/helpers/config.ts:133