@tableland/sdk
Advanced tools
Comparing version 4.3.1 to 4.4.0-dev1.0
import { type WaitableTransactionReceipt } from "../registry/utils.js"; | ||
import { type ChainName } from "./chains.js"; | ||
import { type Signer, type ExternalProvider } from "./ethers.js"; | ||
import { type Signer, type ExternalProvider, type ContractTransaction } from "./ethers.js"; | ||
export interface ReadConfig { | ||
@@ -9,2 +9,3 @@ baseUrl: string; | ||
signer: Signer; | ||
customizeTransaction?: (signer: Signer, contractAddress: string, functionSignature: string, functionArgs: any[]) => Promise<ContractTransaction>; | ||
} | ||
@@ -11,0 +12,0 @@ export interface AutoWaitConfig { |
@@ -49,3 +49,7 @@ "use strict"; | ||
const baseUrl = await (0, index_js_1.extractBaseUrl)(config, chainId); | ||
const _config = { baseUrl, signer }; | ||
const _config = { | ||
baseUrl, | ||
signer, | ||
customizeTransaction: config.customizeTransaction, | ||
}; | ||
const _params = { chainId, first, statement: sql }; | ||
@@ -81,3 +85,7 @@ switch (type) { | ||
const baseUrl = await (0, index_js_1.extractBaseUrl)(config, chainId); | ||
const _config = { baseUrl, signer }; | ||
const _config = { | ||
baseUrl, | ||
signer, | ||
customizeTransaction: config.customizeTransaction, | ||
}; | ||
const params = { runnables, chainId }; | ||
@@ -98,3 +106,7 @@ const tx = await (0, run_js_1.mutate)(_config, params); | ||
const baseUrl = await (0, index_js_1.extractBaseUrl)(config, chainId); | ||
const _config = { baseUrl, signer }; | ||
const _config = { | ||
baseUrl, | ||
signer, | ||
customizeTransaction: config.customizeTransaction, | ||
}; | ||
const params = { | ||
@@ -101,0 +113,0 @@ statements: await Promise.all(statements.map(async function (statement) { |
@@ -42,10 +42,16 @@ "use strict"; | ||
exports.create = create; | ||
async function _createOne({ signer }, { statement, chainId }) { | ||
async function _createOne({ signer, customizeTransaction }, { statement, chainId }) { | ||
const owner = await signer.getAddress(); | ||
const { contract, overrides } = await (0, contract_js_1.getContractAndOverrides)(signer, chainId); | ||
if (customizeTransaction !== undefined) { | ||
return await customizeTransaction(signer, contract.address, "create(address,string)", [owner, statement, overrides]); | ||
} | ||
return await contract["create(address,string)"](owner, statement, overrides); | ||
} | ||
async function _createMany({ signer }, { statements, chainId }) { | ||
async function _createMany({ signer, customizeTransaction }, { statements, chainId }) { | ||
const owner = await signer.getAddress(); | ||
const { contract, overrides } = await (0, contract_js_1.getContractAndOverrides)(signer, chainId); | ||
if (customizeTransaction !== undefined) { | ||
return await customizeTransaction(signer, contract.address, "create(address,string[])", [owner, statements, overrides]); | ||
} | ||
return await contract["create(address,string[])"](owner, statements, overrides); | ||
@@ -52,0 +58,0 @@ } |
@@ -19,10 +19,16 @@ "use strict"; | ||
exports.mutate = mutate; | ||
async function _mutateOne({ signer }, { statement, tableId, chainId }) { | ||
async function _mutateOne({ signer, customizeTransaction }, { statement, tableId, chainId }) { | ||
const caller = await signer.getAddress(); | ||
const { contract, overrides } = await (0, contract_js_1.getContractAndOverrides)(signer, chainId); | ||
if (customizeTransaction !== undefined) { | ||
return await customizeTransaction(signer, contract.address, "mutate(address,uint256,string)", [caller, tableId, statement, overrides]); | ||
} | ||
return await contract["mutate(address,uint256,string)"](caller, tableId, statement, overrides); | ||
} | ||
async function _mutateMany({ signer }, { runnables, chainId }) { | ||
async function _mutateMany({ signer, customizeTransaction }, { runnables, chainId }) { | ||
const caller = await signer.getAddress(); | ||
const { contract, overrides } = await (0, contract_js_1.getContractAndOverrides)(signer, chainId); | ||
if (customizeTransaction !== undefined) { | ||
return await customizeTransaction(signer, contract.address, "mutate(address,(uint256,string)[])", [caller, runnables, overrides]); | ||
} | ||
return await contract["mutate(address,(uint256,string)[])"](caller, runnables, overrides); | ||
@@ -29,0 +35,0 @@ } |
import { type WaitableTransactionReceipt } from "../registry/utils.js"; | ||
import { type ChainName } from "./chains.js"; | ||
import { type Signer, type ExternalProvider } from "./ethers.js"; | ||
import { type Signer, type ExternalProvider, type ContractTransaction } from "./ethers.js"; | ||
export interface ReadConfig { | ||
@@ -9,2 +9,3 @@ baseUrl: string; | ||
signer: Signer; | ||
customizeTransaction?: (signer: Signer, contractAddress: string, functionSignature: string, functionArgs: any[]) => Promise<ContractTransaction>; | ||
} | ||
@@ -11,0 +12,0 @@ export interface AutoWaitConfig { |
import { getBaseUrl } from "./chains.js"; | ||
import { getSigner } from "./ethers.js"; | ||
import { getSigner, } from "./ethers.js"; | ||
export async function checkWait(config, receipt) { | ||
@@ -4,0 +4,0 @@ if (config.autoWait ?? false) { |
@@ -46,3 +46,7 @@ import { extractBaseUrl, extractSigner, } from "./helpers/index.js"; | ||
const baseUrl = await extractBaseUrl(config, chainId); | ||
const _config = { baseUrl, signer }; | ||
const _config = { | ||
baseUrl, | ||
signer, | ||
customizeTransaction: config.customizeTransaction, | ||
}; | ||
const _params = { chainId, first, statement: sql }; | ||
@@ -77,3 +81,7 @@ switch (type) { | ||
const baseUrl = await extractBaseUrl(config, chainId); | ||
const _config = { baseUrl, signer }; | ||
const _config = { | ||
baseUrl, | ||
signer, | ||
customizeTransaction: config.customizeTransaction, | ||
}; | ||
const params = { runnables, chainId }; | ||
@@ -93,3 +101,7 @@ const tx = await mutate(_config, params); | ||
const baseUrl = await extractBaseUrl(config, chainId); | ||
const _config = { baseUrl, signer }; | ||
const _config = { | ||
baseUrl, | ||
signer, | ||
customizeTransaction: config.customizeTransaction, | ||
}; | ||
const params = { | ||
@@ -96,0 +108,0 @@ statements: await Promise.all(statements.map(async function (statement) { |
@@ -36,10 +36,16 @@ import { normalize } from "../helpers/index.js"; | ||
} | ||
async function _createOne({ signer }, { statement, chainId }) { | ||
async function _createOne({ signer, customizeTransaction }, { statement, chainId }) { | ||
const owner = await signer.getAddress(); | ||
const { contract, overrides } = await getContractAndOverrides(signer, chainId); | ||
if (customizeTransaction !== undefined) { | ||
return await customizeTransaction(signer, contract.address, "create(address,string)", [owner, statement, overrides]); | ||
} | ||
return await contract["create(address,string)"](owner, statement, overrides); | ||
} | ||
async function _createMany({ signer }, { statements, chainId }) { | ||
async function _createMany({ signer, customizeTransaction }, { statements, chainId }) { | ||
const owner = await signer.getAddress(); | ||
const { contract, overrides } = await getContractAndOverrides(signer, chainId); | ||
if (customizeTransaction !== undefined) { | ||
return await customizeTransaction(signer, contract.address, "create(address,string[])", [owner, statements, overrides]); | ||
} | ||
return await contract["create(address,string[])"](owner, statements, overrides); | ||
@@ -46,0 +52,0 @@ } |
@@ -14,10 +14,16 @@ import { validateTableName } from "../helpers/parser.js"; | ||
} | ||
async function _mutateOne({ signer }, { statement, tableId, chainId }) { | ||
async function _mutateOne({ signer, customizeTransaction }, { statement, tableId, chainId }) { | ||
const caller = await signer.getAddress(); | ||
const { contract, overrides } = await getContractAndOverrides(signer, chainId); | ||
if (customizeTransaction !== undefined) { | ||
return await customizeTransaction(signer, contract.address, "mutate(address,uint256,string)", [caller, tableId, statement, overrides]); | ||
} | ||
return await contract["mutate(address,uint256,string)"](caller, tableId, statement, overrides); | ||
} | ||
async function _mutateMany({ signer }, { runnables, chainId }) { | ||
async function _mutateMany({ signer, customizeTransaction }, { runnables, chainId }) { | ||
const caller = await signer.getAddress(); | ||
const { contract, overrides } = await getContractAndOverrides(signer, chainId); | ||
if (customizeTransaction !== undefined) { | ||
return await customizeTransaction(signer, contract.address, "mutate(address,(uint256,string)[])", [caller, runnables, overrides]); | ||
} | ||
return await contract["mutate(address,(uint256,string)[])"](caller, runnables, overrides); | ||
@@ -24,0 +30,0 @@ } |
{ | ||
"name": "@tableland/sdk", | ||
"version": "4.3.1", | ||
"version": "4.4.0-dev1.0", | ||
"description": "A database client and helpers for the Tableland network", | ||
@@ -72,3 +72,3 @@ "publishConfig": { | ||
"build:cjs": "npx tsc -p tsconfig.cjs.json", | ||
"build": "npm run build:api && npm run build:esm && npm run build:cjs && ./fixup" | ||
"build": "npm run build:api && npm run build:esm && npm run build:cjs && sh ./fixup" | ||
}, | ||
@@ -87,3 +87,3 @@ "keywords": [ | ||
"@playwright/test": "^1.30.0", | ||
"@tableland/local": "^1.3.0", | ||
"@tableland/local": "^1.3.0-pre.1", | ||
"@types/assert": "^1.5.6", | ||
@@ -112,6 +112,6 @@ "@types/mocha": "^10.0.1", | ||
"dependencies": { | ||
"@tableland/evm": "^4.3.0", | ||
"@tableland/sqlparser": "^1.2.0", | ||
"@tableland/evm": "^4.2.2", | ||
"@tableland/sqlparser": "^1.1.0-pre.0", | ||
"ethers": "^5.7.2" | ||
} | ||
} | ||
} |
@@ -0,0 +0,0 @@ # @tableland/sdk |
@@ -0,0 +0,0 @@ import { type NormalizedStatement } from "@tableland/sqlparser"; |
@@ -0,0 +0,0 @@ export type Awaitable<T> = T | PromiseLike<T>; |
@@ -0,0 +0,0 @@ // Regexp to extract any placeholder types (?, ?NNN, @AAA, $AAA, or :AAA ) that are |
@@ -0,0 +0,0 @@ import { |
import { type WaitableTransactionReceipt } from "../registry/utils.js"; | ||
import { type ChainName, getBaseUrl } from "./chains.js"; | ||
import { type Signer, type ExternalProvider, getSigner } from "./ethers.js"; | ||
import { | ||
type Signer, | ||
type ExternalProvider, | ||
type ContractTransaction, | ||
getSigner, | ||
} from "./ethers.js"; | ||
@@ -11,2 +16,8 @@ export interface ReadConfig { | ||
signer: Signer; | ||
customizeTransaction?: ( | ||
signer: Signer, | ||
contractAddress: string, | ||
functionSignature: string, | ||
functionArgs: any[] | ||
) => Promise<ContractTransaction>; | ||
} | ||
@@ -13,0 +24,0 @@ |
@@ -0,0 +0,0 @@ import { |
@@ -0,0 +0,0 @@ export { |
@@ -0,0 +0,0 @@ import { |
@@ -0,0 +0,0 @@ export type PartialRequired<T, S extends keyof T> = Omit<Required<T>, S> & |
@@ -0,0 +0,0 @@ import * as helpers from "./helpers/index.js"; |
@@ -83,3 +83,7 @@ import { | ||
const baseUrl = await extractBaseUrl(config, chainId); | ||
const _config = { baseUrl, signer }; | ||
const _config = { | ||
baseUrl, | ||
signer, | ||
customizeTransaction: config.customizeTransaction, | ||
}; | ||
const _params = { chainId, first, statement: sql }; | ||
@@ -118,3 +122,7 @@ switch (type) { | ||
const baseUrl = await extractBaseUrl(config, chainId); | ||
const _config = { baseUrl, signer }; | ||
const _config = { | ||
baseUrl, | ||
signer, | ||
customizeTransaction: config.customizeTransaction, | ||
}; | ||
const params: MutateManyParams = { runnables, chainId }; | ||
@@ -144,3 +152,7 @@ | ||
const baseUrl = await extractBaseUrl(config, chainId); | ||
const _config = { baseUrl, signer }; | ||
const _config = { | ||
baseUrl, | ||
signer, | ||
customizeTransaction: config.customizeTransaction, | ||
}; | ||
const params: CreateManyParams = { | ||
@@ -147,0 +159,0 @@ statements: await Promise.all( |
@@ -0,0 +0,0 @@ import { |
@@ -0,0 +0,0 @@ import { type SignerConfig } from "../helpers/config.js"; |
@@ -6,2 +6,4 @@ import { normalize } from "../helpers/index.js"; | ||
import { getContractAndOverrides } from "./contract.js"; | ||
import { ethers } from "ethers"; | ||
import { TablelandDeployments__factory, TablelandTables } from "@tableland/evm"; | ||
@@ -103,3 +105,3 @@ // Match _anything_ between create table and schema portion of create statement (statement must be a single line) | ||
async function _createOne( | ||
{ signer }: SignerConfig, | ||
{ signer, customizeTransaction }: SignerConfig, | ||
{ statement, chainId }: CreateOneParams | ||
@@ -112,2 +114,12 @@ ): Promise<ContractTransaction> { | ||
); | ||
if (customizeTransaction !== undefined) { | ||
return await customizeTransaction( | ||
signer, | ||
contract.address, | ||
"create(address,string)", | ||
[owner, statement, overrides] | ||
); | ||
} | ||
return await contract["create(address,string)"](owner, statement, overrides); | ||
@@ -117,3 +129,3 @@ } | ||
async function _createMany( | ||
{ signer }: SignerConfig, | ||
{ signer, customizeTransaction }: SignerConfig, | ||
{ statements, chainId }: CreateManyParams | ||
@@ -126,2 +138,12 @@ ): Promise<ContractTransaction> { | ||
); | ||
if (customizeTransaction !== undefined) { | ||
return await customizeTransaction( | ||
signer, | ||
contract.address, | ||
"create(address,string[])", | ||
[owner, statements, overrides] | ||
); | ||
} | ||
return await contract["create(address,string[])"]( | ||
@@ -128,0 +150,0 @@ owner, |
@@ -0,0 +0,0 @@ import { |
@@ -90,3 +90,3 @@ import { type SignerConfig } from "../helpers/config.js"; | ||
async function _mutateOne( | ||
{ signer }: SignerConfig, | ||
{ signer, customizeTransaction }: SignerConfig, | ||
{ statement, tableId, chainId }: MutateOneParams | ||
@@ -99,2 +99,12 @@ ): Promise<ContractTransaction> { | ||
); | ||
if (customizeTransaction !== undefined) { | ||
return await customizeTransaction( | ||
signer, | ||
contract.address, | ||
"mutate(address,uint256,string)", | ||
[caller, tableId, statement, overrides] | ||
); | ||
} | ||
return await contract["mutate(address,uint256,string)"]( | ||
@@ -109,3 +119,3 @@ caller, | ||
async function _mutateMany( | ||
{ signer }: SignerConfig, | ||
{ signer, customizeTransaction }: SignerConfig, | ||
{ runnables, chainId }: MutateManyParams | ||
@@ -118,2 +128,12 @@ ): Promise<ContractTransaction> { | ||
); | ||
if (customizeTransaction !== undefined) { | ||
return await customizeTransaction( | ||
signer, | ||
contract.address, | ||
"mutate(address,(uint256,string)[])", | ||
[caller, runnables, overrides] | ||
); | ||
} | ||
return await contract["mutate(address,(uint256,string)[])"]( | ||
@@ -120,0 +140,0 @@ caller, |
@@ -0,0 +0,0 @@ import { type SignerConfig } from "../helpers/config.js"; |
@@ -0,0 +0,0 @@ import { type SignerConfig } from "../helpers/config.js"; |
@@ -0,0 +0,0 @@ import { |
@@ -0,0 +0,0 @@ import { |
@@ -0,0 +0,0 @@ /* c8-ignore */ |
@@ -0,0 +0,0 @@ import { Fetcher } from "./fetcher.js"; |
@@ -0,0 +0,0 @@ > This is a local copy of openapi-typescript-fetch |
@@ -0,0 +0,0 @@ export type Method = |
@@ -0,0 +0,0 @@ import { ApiError } from "./client/index.js"; |
@@ -0,0 +0,0 @@ import { type Signal } from "../helpers/await.js"; |
@@ -0,0 +0,0 @@ import { |
@@ -0,0 +0,0 @@ import { type Signal } from "../helpers/await.js"; |
@@ -0,0 +0,0 @@ import { |
@@ -0,0 +0,0 @@ import { |
@@ -0,0 +0,0 @@ import { camelize, type Camelize } from "../helpers/utils.js"; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
516634
9738
2
9
Updated@tableland/evm@^4.2.2