New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@tableland/sdk

Package Overview
Dependencies
Maintainers
5
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tableland/sdk - npm Package Compare versions

Comparing version 7.0.0-pre.0 to 7.0.0-pre.1

10

dist/cjs/helpers/ethers.d.ts

@@ -24,2 +24,10 @@ import { FeeData, getDefaultProvider, type ContractTransactionResponse, type ContractTransactionReceipt, type Eip1193Provider, type EventLog, type JsonRpcApiProviderOptions, type Log, type Overrides, type Signer } from "ethers";

/**
* Check if a chain can use the `eth_getMaxPriorityFeePerGas` or
* `eth_getMaxFeePerGas` calls, which are used by the built-in ethers
* `getFeeData` method.
* @param chainId The chainId of the network as a number or bigint.
* @returns A boolean that indicates if `getFeeData` can be used for the chain.
*/
export declare function chainCanGetFeeData(chainId: number | bigint): boolean;
/**
* RegistryReceipt is based on the TransactionReceipt type which defined by the API spec.

@@ -89,3 +97,3 @@ * The API v1 has a known problem where it only returns the first tableId from a transaction.

}): Signer;
export { getDefaultProvider, type Eip1193Provider, type ContractTransactionResponse, type ContractTransactionReceipt, type Signer, };
export { getDefaultProvider, type Eip1193Provider, type FeeData, type ContractTransactionResponse, type ContractTransactionReceipt, type Signer, };
//# sourceMappingURL=ethers.d.ts.map

25

dist/cjs/helpers/ethers.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultProvider = exports.createSigner = exports.isEventLog = exports.checkProviderOfSigner = exports.getSigner = exports.getContractReceipt = exports.isPolygon = exports.getOverrides = exports.getFeeData = void 0;
exports.getDefaultProvider = exports.createSigner = exports.isEventLog = exports.checkProviderOfSigner = exports.getSigner = exports.getContractReceipt = exports.chainCanGetFeeData = exports.isPolygon = exports.getOverrides = exports.getFeeData = void 0;
const ethers_1 = require("ethers");

@@ -16,5 +16,7 @@ Object.defineProperty(exports, "getDefaultProvider", { enumerable: true, get: function () { return ethers_1.getDefaultProvider; } });

const chainId = network?.chainId;
if (!chainId || !chainCanGetFeeData(chainId))
return new ethers_1.FeeData();
// Use custom Polygon gas data, else, use built-in ethers method
try {
if (chainId && isPolygon(chainId)) {
if (isPolygon(chainId)) {
const url = (0, chains_js_1.isTestnet)(Number(chainId))

@@ -29,6 +31,4 @@ ? "https://gasstation-testnet.polygon.technology/amoy"

}
else {
const feeData = await signer.provider?.getFeeData();
return feeData ?? new ethers_1.FeeData();
}
const feeData = await signer.provider?.getFeeData();
return feeData ?? new ethers_1.FeeData();
}

@@ -65,2 +65,15 @@ catch {

/**
* Check if a chain can use the `eth_getMaxPriorityFeePerGas` or
* `eth_getMaxFeePerGas` calls, which are used by the built-in ethers
* `getFeeData` method.
* @param chainId The chainId of the network as a number or bigint.
* @returns A boolean that indicates if `getFeeData` can be used for the chain.
*/
function chainCanGetFeeData(chainId) {
const chainIdNumber = typeof chainId === "bigint" ? Number(chainId) : chainId;
// Optimism Sepolia and Filecoin Calibration will log an RPC error
return !(chainIdNumber === 11155420 || chainIdNumber === 314159);
}
exports.chainCanGetFeeData = chainCanGetFeeData;
/**
* Given a transaction, this helper will return the tableIds that were part of the transaction.

@@ -67,0 +80,0 @@ * Especially useful for transactions that create new tables because you need the tableId to

export { type Signal, type Wait, type PollingController, type Interval, createSignal, createPollingController, } from "./await.js";
export { type ChainName, type ChainInfo, supportedChains, getBaseUrl, getChainId, getChainInfo, getContractAddress, isTestnet, overrideDefaults, } from "./chains.js";
export { type ReadConfig, type SignerConfig, type Config, type AutoWaitConfig, type AliasesNameMap, type NameMapping, checkWait, extractBaseUrl, extractChainId, extractSigner, prepReadConfig, readNameMapping, writeNameMapping, } from "./config.js";
export { type Signer, type Eip1193Provider, type ContractTransactionResponse, type ContractTransactionReceipt, type RegistryReceipt, type MultiEventTransactionReceipt, createSigner, getDefaultProvider, getSigner, getContractReceipt, } from "./ethers.js";
export { type Signer, type Eip1193Provider, type ContractTransactionResponse, type ContractTransactionReceipt, type RegistryReceipt, type MultiEventTransactionReceipt, createSigner, getFeeData, getDefaultProvider, getSigner, getContractReceipt, } from "./ethers.js";
export { normalize, validateTableName, type NormalizedStatement, type StatementType, } from "./parser.js";

@@ -6,0 +6,0 @@ export { TableEventBus } from "./subscribe.js";

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getContractAndOverrides = exports.TableEventBus = exports.validateTableName = exports.normalize = exports.getContractReceipt = exports.getSigner = exports.getDefaultProvider = exports.createSigner = exports.writeNameMapping = exports.readNameMapping = exports.prepReadConfig = exports.extractSigner = exports.extractChainId = exports.extractBaseUrl = exports.checkWait = exports.overrideDefaults = exports.isTestnet = exports.getContractAddress = exports.getChainInfo = exports.getChainId = exports.getBaseUrl = exports.supportedChains = exports.createPollingController = exports.createSignal = void 0;
exports.getContractAndOverrides = exports.TableEventBus = exports.validateTableName = exports.normalize = exports.getContractReceipt = exports.getSigner = exports.getDefaultProvider = exports.getFeeData = exports.createSigner = exports.writeNameMapping = exports.readNameMapping = exports.prepReadConfig = exports.extractSigner = exports.extractChainId = exports.extractBaseUrl = exports.checkWait = exports.overrideDefaults = exports.isTestnet = exports.getContractAddress = exports.getChainInfo = exports.getChainId = exports.getBaseUrl = exports.supportedChains = exports.createPollingController = exports.createSignal = void 0;
var await_js_1 = require("./await.js");

@@ -25,2 +25,3 @@ Object.defineProperty(exports, "createSignal", { enumerable: true, get: function () { return await_js_1.createSignal; } });

Object.defineProperty(exports, "createSigner", { enumerable: true, get: function () { return ethers_js_1.createSigner; } });
Object.defineProperty(exports, "getFeeData", { enumerable: true, get: function () { return ethers_js_1.getFeeData; } });
Object.defineProperty(exports, "getDefaultProvider", { enumerable: true, get: function () { return ethers_js_1.getDefaultProvider; } });

@@ -27,0 +28,0 @@ Object.defineProperty(exports, "getSigner", { enumerable: true, get: function () { return ethers_js_1.getSigner; } });

@@ -51,9 +51,9 @@ /**

readonly Table: {
/** @example healthbot_80001_1 */
/** @example healthbot_80002_1 */
readonly name?: string;
/** @example https://testnets.tableland.network/api/v1/tables/80001/1 */
/** @example https://testnets.tableland.network/api/v1/tables/80002/1 */
readonly external_url?: string;
/** @example https://tables.testnets.tableland.xyz/80001/1.html */
/** @example https://tables.testnets.tableland.xyz/80002/1.html */
readonly animation_url?: string;
/** @example https://tables.testnets.tableland.xyz/80001/1.svg */
/** @example https://tables.testnets.tableland.xyz/80002/1.svg */
readonly image?: string;

@@ -100,3 +100,3 @@ /**

* Format: int32
* @example 80001
* @example 80002
*/

@@ -152,3 +152,3 @@ readonly chain_id?: number;

* @description The SQL read query statement
* @example select * from healthbot_80001_1
* @example select * from healthbot_80002_1
*/

@@ -215,3 +215,3 @@ readonly statement?: string;

* @description The SQL read query statement
* @example select * from healthbot_80001_1
* @example select * from healthbot_80002_1
*/

@@ -281,3 +281,3 @@ statement: string;

* @description The parent chain to target
* @example 80001
* @example 80002
*/

@@ -316,3 +316,3 @@ chainId: number;

* @description The parent chain to target
* @example 80001
* @example 80002
*/

@@ -319,0 +319,0 @@ chainId: number;

@@ -24,2 +24,10 @@ import { FeeData, getDefaultProvider, type ContractTransactionResponse, type ContractTransactionReceipt, type Eip1193Provider, type EventLog, type JsonRpcApiProviderOptions, type Log, type Overrides, type Signer } from "ethers";

/**
* Check if a chain can use the `eth_getMaxPriorityFeePerGas` or
* `eth_getMaxFeePerGas` calls, which are used by the built-in ethers
* `getFeeData` method.
* @param chainId The chainId of the network as a number or bigint.
* @returns A boolean that indicates if `getFeeData` can be used for the chain.
*/
export declare function chainCanGetFeeData(chainId: number | bigint): boolean;
/**
* RegistryReceipt is based on the TransactionReceipt type which defined by the API spec.

@@ -89,3 +97,3 @@ * The API v1 has a known problem where it only returns the first tableId from a transaction.

}): Signer;
export { getDefaultProvider, type Eip1193Provider, type ContractTransactionResponse, type ContractTransactionReceipt, type Signer, };
export { getDefaultProvider, type Eip1193Provider, type FeeData, type ContractTransactionResponse, type ContractTransactionReceipt, type Signer, };
//# sourceMappingURL=ethers.d.ts.map

@@ -12,5 +12,7 @@ import { BrowserProvider, FeeData, getDefaultProvider, JsonRpcProvider, Network, parseUnits, Wallet, } from "ethers";

const chainId = network?.chainId;
if (!chainId || !chainCanGetFeeData(chainId))
return new FeeData();
// Use custom Polygon gas data, else, use built-in ethers method
try {
if (chainId && isPolygon(chainId)) {
if (isPolygon(chainId)) {
const url = isTestnet(Number(chainId))

@@ -25,6 +27,4 @@ ? "https://gasstation-testnet.polygon.technology/amoy"

}
else {
const feeData = await signer.provider?.getFeeData();
return feeData ?? new FeeData();
}
const feeData = await signer.provider?.getFeeData();
return feeData ?? new FeeData();
}

@@ -58,2 +58,14 @@ catch {

/**
* Check if a chain can use the `eth_getMaxPriorityFeePerGas` or
* `eth_getMaxFeePerGas` calls, which are used by the built-in ethers
* `getFeeData` method.
* @param chainId The chainId of the network as a number or bigint.
* @returns A boolean that indicates if `getFeeData` can be used for the chain.
*/
export function chainCanGetFeeData(chainId) {
const chainIdNumber = typeof chainId === "bigint" ? Number(chainId) : chainId;
// Optimism Sepolia and Filecoin Calibration will log an RPC error
return !(chainIdNumber === 11155420 || chainIdNumber === 314159);
}
/**
* Given a transaction, this helper will return the tableIds that were part of the transaction.

@@ -60,0 +72,0 @@ * Especially useful for transactions that create new tables because you need the tableId to

export { type Signal, type Wait, type PollingController, type Interval, createSignal, createPollingController, } from "./await.js";
export { type ChainName, type ChainInfo, supportedChains, getBaseUrl, getChainId, getChainInfo, getContractAddress, isTestnet, overrideDefaults, } from "./chains.js";
export { type ReadConfig, type SignerConfig, type Config, type AutoWaitConfig, type AliasesNameMap, type NameMapping, checkWait, extractBaseUrl, extractChainId, extractSigner, prepReadConfig, readNameMapping, writeNameMapping, } from "./config.js";
export { type Signer, type Eip1193Provider, type ContractTransactionResponse, type ContractTransactionReceipt, type RegistryReceipt, type MultiEventTransactionReceipt, createSigner, getDefaultProvider, getSigner, getContractReceipt, } from "./ethers.js";
export { type Signer, type Eip1193Provider, type ContractTransactionResponse, type ContractTransactionReceipt, type RegistryReceipt, type MultiEventTransactionReceipt, createSigner, getFeeData, getDefaultProvider, getSigner, getContractReceipt, } from "./ethers.js";
export { normalize, validateTableName, type NormalizedStatement, type StatementType, } from "./parser.js";

@@ -6,0 +6,0 @@ export { TableEventBus } from "./subscribe.js";

export { createSignal, createPollingController, } from "./await.js";
export { supportedChains, getBaseUrl, getChainId, getChainInfo, getContractAddress, isTestnet, overrideDefaults, } from "./chains.js";
export { checkWait, extractBaseUrl, extractChainId, extractSigner, prepReadConfig, readNameMapping, writeNameMapping, } from "./config.js";
export { createSigner, getDefaultProvider, getSigner, getContractReceipt, } from "./ethers.js";
export { createSigner, getFeeData, getDefaultProvider, getSigner, getContractReceipt, } from "./ethers.js";
export { normalize, validateTableName, } from "./parser.js";

@@ -6,0 +6,0 @@ export { TableEventBus } from "./subscribe.js";

@@ -51,9 +51,9 @@ /**

readonly Table: {
/** @example healthbot_80001_1 */
/** @example healthbot_80002_1 */
readonly name?: string;
/** @example https://testnets.tableland.network/api/v1/tables/80001/1 */
/** @example https://testnets.tableland.network/api/v1/tables/80002/1 */
readonly external_url?: string;
/** @example https://tables.testnets.tableland.xyz/80001/1.html */
/** @example https://tables.testnets.tableland.xyz/80002/1.html */
readonly animation_url?: string;
/** @example https://tables.testnets.tableland.xyz/80001/1.svg */
/** @example https://tables.testnets.tableland.xyz/80002/1.svg */
readonly image?: string;

@@ -100,3 +100,3 @@ /**

* Format: int32
* @example 80001
* @example 80002
*/

@@ -152,3 +152,3 @@ readonly chain_id?: number;

* @description The SQL read query statement
* @example select * from healthbot_80001_1
* @example select * from healthbot_80002_1
*/

@@ -215,3 +215,3 @@ readonly statement?: string;

* @description The SQL read query statement
* @example select * from healthbot_80001_1
* @example select * from healthbot_80002_1
*/

@@ -281,3 +281,3 @@ statement: string;

* @description The parent chain to target
* @example 80001
* @example 80002
*/

@@ -316,3 +316,3 @@ chainId: number;

* @description The parent chain to target
* @example 80001
* @example 80002
*/

@@ -319,0 +319,0 @@ chainId: number;

{
"name": "@tableland/sdk",
"version": "7.0.0-pre.0",
"version": "7.0.0-pre.1",
"description": "A database client and helpers for the Tableland network",

@@ -74,3 +74,3 @@ "repository": {

"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:esm && npm run build:cjs && ./fixup"
},

@@ -86,6 +86,7 @@ "keywords": [

"@async-generators/from-emitter": "^0.3.0",
"@tableland/evm": "^6.0.0",
"@tableland/evm": "^6.1.0",
"@tableland/sqlparser": "^1.3.0",
"ethers": "^6.11.1"
"ethers": "^6.12.0",
"typescript": "^5.4.5"
}
}

@@ -60,5 +60,6 @@ import {

const chainId = network?.chainId;
if (!chainId || !chainCanGetFeeData(chainId)) return new FeeData();
// Use custom Polygon gas data, else, use built-in ethers method
try {
if (chainId && isPolygon(chainId)) {
if (isPolygon(chainId)) {
const url = isTestnet(Number(chainId))

@@ -75,6 +76,5 @@ ? "https://gasstation-testnet.polygon.technology/amoy"

return feeData;
} else {
const feeData = await signer.provider?.getFeeData();
return feeData ?? new FeeData();
}
const feeData = await signer.provider?.getFeeData();
return feeData ?? new FeeData();
} catch {

@@ -112,2 +112,15 @@ return new FeeData(); // Return null values if fee data is not available

/**
* Check if a chain can use the `eth_getMaxPriorityFeePerGas` or
* `eth_getMaxFeePerGas` calls, which are used by the built-in ethers
* `getFeeData` method.
* @param chainId The chainId of the network as a number or bigint.
* @returns A boolean that indicates if `getFeeData` can be used for the chain.
*/
export function chainCanGetFeeData(chainId: number | bigint): boolean {
const chainIdNumber = typeof chainId === "bigint" ? Number(chainId) : chainId;
// Optimism Sepolia and Filecoin Calibration will log an RPC error
return !(chainIdNumber === 11155420 || chainIdNumber === 314159);
}
/**
* RegistryReceipt is based on the TransactionReceipt type which defined by the API spec.

@@ -282,2 +295,3 @@ * The API v1 has a known problem where it only returns the first tableId from a transaction.

type Eip1193Provider,
type FeeData,
type ContractTransactionResponse,

@@ -284,0 +298,0 @@ type ContractTransactionReceipt,

@@ -43,2 +43,3 @@ export {

createSigner,
getFeeData,
getDefaultProvider,

@@ -45,0 +46,0 @@ getSigner,

@@ -55,9 +55,9 @@ /**

readonly Table: {
/** @example healthbot_80001_1 */
/** @example healthbot_80002_1 */
readonly name?: string;
/** @example https://testnets.tableland.network/api/v1/tables/80001/1 */
/** @example https://testnets.tableland.network/api/v1/tables/80002/1 */
readonly external_url?: string;
/** @example https://tables.testnets.tableland.xyz/80001/1.html */
/** @example https://tables.testnets.tableland.xyz/80002/1.html */
readonly animation_url?: string;
/** @example https://tables.testnets.tableland.xyz/80001/1.svg */
/** @example https://tables.testnets.tableland.xyz/80002/1.svg */
readonly image?: string;

@@ -104,3 +104,3 @@ /**

* Format: int32
* @example 80001
* @example 80002
*/

@@ -156,3 +156,3 @@ readonly chain_id?: number;

* @description The SQL read query statement
* @example select * from healthbot_80001_1
* @example select * from healthbot_80002_1
*/

@@ -222,3 +222,3 @@ readonly statement?: string;

* @description The SQL read query statement
* @example select * from healthbot_80001_1
* @example select * from healthbot_80002_1
*/

@@ -288,3 +288,3 @@ statement: string;

* @description The parent chain to target
* @example 80001
* @example 80002
*/

@@ -323,3 +323,3 @@ chainId: number;

* @description The parent chain to target
* @example 80001
* @example 80002
*/

@@ -326,0 +326,0 @@ chainId: number;

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

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

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

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc