Namespace: helpers
Classes
Interfaces
- AliasesNameMap
- AutoWaitConfig
- ChainInfo
- ContractReceipt
- ContractTransaction
- Interval
- MultiEventTransactionReceipt
- ReadConfig
- Signal
- SignerConfig
- Wait
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:46
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:71
Functions
checkWait
▸ checkWait(config
, receipt
, controller?
): Promise
<WaitableTransactionReceipt
>
Parameters
Name | Type |
---|---|
config | Partial <ReadConfig & SignerConfig > & Partial <AutoWaitConfig > |
receipt | WaitableTransactionReceipt |
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
Name | Type | Default value | Description |
---|---|---|---|
timeout | number | 60_000 | The timeout period in milliseconds. |
pollingInterval | number | 1500 | - |
Returns
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
A Signal to abort a request.
Defined in
@tableland/sdk/src/helpers/await.ts:79
extractBaseUrl
▸ extractBaseUrl(conn?
, chainNameOrId?
): Promise
<string
>
Parameters
Name | Type |
---|---|
conn | Partial <ReadConfig & SignerConfig > |
chainNameOrId? | number | keyof TablelandNetworkConfig |
Returns
Promise
<string
>
Defined in
@tableland/sdk/src/helpers/config.ts:53
extractChainId
▸ extractChainId(conn?
): Promise
<number
>
Parameters
Name | Type |
---|---|
conn | Partial <ReadConfig & SignerConfig > |
Returns
Promise
<number
>
Defined in
@tableland/sdk/src/helpers/config.ts:82
extractSigner
▸ extractSigner(conn?
, external?
): Promise
<Signer
>
Parameters
Name | Type |
---|---|
conn | Partial <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
Name | Type | Description |
---|---|---|
chainNameOrId | number | keyof TablelandNetworkConfig | The requested chain name. |
Returns
string
A string representing the default host uri for a given chain.
Defined in
@tableland/sdk/src/helpers/chains.ts:139
getChainId
▸ getChainId(chainNameOrId
): number
Get the default chain ID for a given chain name.
Parameters
Name | Type | Description |
---|---|---|
chainNameOrId | number | keyof TablelandNetworkConfig | The 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:130
getChainInfo
▸ getChainInfo(chainNameOrId
): ChainInfo
Get the default chain information for a given chain name.
Parameters
Name | Type | Description |
---|---|---|
chainNameOrId | number | keyof TablelandNetworkConfig | The requested chain name or ID. |
Returns
An object containing the default chainId, contractAddress, chainName, and baseUrl for the given chain.
Defined in
@tableland/sdk/src/helpers/chains.ts:86
getContractAddress
▸ getContractAddress(chainNameOrId
): string
Get the default contract address for a given chain name.
Parameters
Name | Type | Description |
---|---|---|
chainNameOrId | number | keyof TablelandNetworkConfig | The 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:121
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
Name | Type |
---|---|
tx | ContractTransaction |
Returns
Promise
<MultiEventTransactionReceipt
>
tableland receipt
Defined in
@tableland/sdk/src/helpers/ethers.ts:75
getDefaultProvider
▸ getDefaultProvider(network?
, options?
): BaseProvider
Parameters
Name | Type |
---|---|
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.
Throws
If no global ethereum object is available.
Parameters
Name | Type | Description |
---|---|---|
external? | ExternalProvider | A valid external provider. Defaults to globalThis.ethereum if not provided. |
Returns
Promise
<Signer
>
A promise that resolves to a valid web3 provider/signer
Defined in
@tableland/sdk/src/helpers/ethers.ts:108
isTestnet
▸ isTestnet(chainNameOrId
): boolean
Get whether or not a chain is a testnet.
Parameters
Name | Type | Description |
---|---|---|
chainNameOrId | number | keyof TablelandNetworkConfig | The 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:105
normalize
▸ normalize(sql
, nameMap?
): Promise
<NormalizedStatement
>
Parameters
Name | Type |
---|---|
sql | string |
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
Name | Type | Description |
---|---|---|
chainNameOrId | number | keyof TablelandNetworkConfig | Either the chain name or chainId. For a list of chain names see the evm-tableland networks file |
values | Record <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:164
prepReadConfig
▸ prepReadConfig(config
): FetchConfig
Parameters
Name | Type |
---|---|
config | Partial <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
Name | Type | Description |
---|---|---|
aliases | AliasesNameMap | An 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
Name | Type | Default value |
---|---|---|
tableName | string | undefined |
isCreate | boolean | false |
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
Name | Type | Description |
---|---|---|
aliases | AliasesNameMap | An AliasesNameMap object to write to. |
nameMap | NameMapping | A 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