Class: Registry
Registry provides direct access to remote Registry smart contract APIs.
Constructors
constructor
• new Registry(config?
)
Create a Registry instance with the specified connection configuration.
Parameters
Name | Type | Description |
---|---|---|
config | Partial <SignerConfig > | The connection configuration. This must include an ethersjs Signer. If passing the config from a pre-existing Database instance, it must have a non-null signer key defined. |
Defined in
@tableland/sdk/src/registry/index.ts:63
Properties
config
• Readonly
config: SignerConfig
Defined in
@tableland/sdk/src/registry/index.ts:56
Methods
create
▸ create(params
): Promise
<ContractTransaction
>
Creates a new table owned by owner
using statement
and returns its tableId
.
owner - the to-be owner of the new table statement - the SQL statement used to create the table
Requirements:
- contract must be unpaused
Parameters
Name | Type |
---|---|
params | CreateParams |
Returns
Promise
<ContractTransaction
>
Defined in
@tableland/sdk/src/registry/index.ts:164
createTable
▸ createTable(params
): Promise
<ContractTransaction
>
@custom:deprecated Use create
instead.
Parameters
Name | Type |
---|---|
params | CreateTableParams |
Returns
Promise
<ContractTransaction
>
Defined in
@tableland/sdk/src/registry/index.ts:171
getController
▸ getController(table
): Promise
<string
>
Returns the controller for a table.
tableId - the id of the target table
Parameters
Name | Type |
---|---|
table | string | TableIdentifier |
Returns
Promise
<string
>
Defined in
@tableland/sdk/src/registry/index.ts:150
listTables
▸ listTables(owner?
): Promise
<TableIdentifier
[]>
Gets the list of table IDs of the requested owner.
Parameters
Name | Type | Description |
---|---|---|
owner? | string | The address owning the table. |
Returns
Promise
<TableIdentifier
[]>
Defined in
@tableland/sdk/src/registry/index.ts:83
lockController
▸ lockController(table
): Promise
<ContractTransaction
>
Locks the controller for a table forever. Controller can be an EOA or contract address.
Although not very useful, it is possible to lock a table controller that is set to the zero address.
caller - the address that is locking the controller tableId - the id of the target table
Requirements:
- contract must be unpaused
msg.sender
must becaller
or contract owner and owner oftableId
tableId
must existtableId
controller must not be locked
Parameters
Name | Type |
---|---|
table | string | TableIdentifier |
Returns
Promise
<ContractTransaction
>
Defined in
@tableland/sdk/src/registry/index.ts:139
mutate
▸ mutate(params
): Promise
<ContractTransaction
>
Runs a SQL statement for caller
using statement
.
caller - the address that is running the SQL statement tableId - the id of the target table statement - the SQL statement to run
Requirements:
- contract must be unpaused
msg.sender
must becaller
tableId
must existcaller
must be authorized by the table controllerstatement
must be less than 35000 bytes after normalizing
Parameters
Name | Type |
---|---|
params | MutateParams |
Returns
Promise
<ContractTransaction
>
Defined in
@tableland/sdk/src/registry/index.ts:190
runSQL
▸ runSQL(params
): Promise
<ContractTransaction
>
Runs a set of SQL statements for caller
using runnables
.
@custom:deprecated Using this with a single statement is deprecated. Use mutate
instead.
Parameters
Name | Type |
---|---|
params | MutateParams |
Returns
Promise
<ContractTransaction
>
Defined in
@tableland/sdk/src/registry/index.ts:198
safeTransferFrom
▸ safeTransferFrom(params
): Promise
<ContractTransaction
>
Safely transfers the ownership of a given table ID to another address.
Requires the msg sender to be the owner, approved, or operator
Parameters
Name | Type |
---|---|
params | TransferParams |
Returns
Promise
<ContractTransaction
>
Defined in
@tableland/sdk/src/registry/index.ts:92
setController
▸ setController(params
): Promise
<ContractTransaction
>
Sets the controller for a table. Controller can be an EOA or contract address.
When a table is created, it's controller is set to the zero address, which means that the contract will not enforce write access control. In this situation, validators will not accept transactions from non-owners unless explicitly granted access with "GRANT" SQL statements.
When a controller address is set for a table, validators assume write access control is handled at the contract level, and will accept all transactions.
You can unset a controller address for a table by setting it back to the zero address. This will cause validators to revert back to honoring owner and GRANT bases write access control.
caller - the address that is setting the controller tableId - the id of the target table controller - the address of the controller (EOA or contract)
Requirements:
- contract must be unpaused
msg.sender
must becaller
or contract owner and owner oftableId
tableId
must existtableId
controller must not be locked
Parameters
Name | Type |
---|---|
params | SetParams |
Returns
Promise
<ContractTransaction
>
Defined in
@tableland/sdk/src/registry/index.ts:120
forSigner
▸ Static
forSigner(signer
): Promise
<Registry
>
Create a Registry that is connected to the given Signer.
Parameters
Name | Type | Description |
---|---|---|
signer | Signer | An ethersjs Signer to use for mutating queries. |
Returns
Promise
<Registry
>
Defined in
@tableland/sdk/src/registry/index.ts:75