From a3326f2ca0fd264b68833d3f486c6e198d136434 Mon Sep 17 00:00:00 2001 From: Dan Buchholz Date: Wed, 22 May 2024 16:27:36 -0700 Subject: [PATCH 1/3] docs(sdk): wrap in backticks to fix autgen parsing --- packages/sdk/src/helpers/chains.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sdk/src/helpers/chains.ts b/packages/sdk/src/helpers/chains.ts index 2c8ed10e..8afb411e 100644 --- a/packages/sdk/src/helpers/chains.ts +++ b/packages/sdk/src/helpers/chains.ts @@ -152,7 +152,7 @@ export function getChainPollingController( * Override the internal list of registry addresses and validator urls that will be used for Contract calls and read queries * @param chainNameOrId Either the chain name or chainId. For a list of chain names see the evm-tableland networks file * @param values The values you would like to use to override the defaults. - * Example: {contractAddress: "0x000deadbeef", baseUrl: "https://my.validator.mydomain.tld"} + * Example: `{contractAddress: "0x000deadbeef", baseUrl: "https://my.validator.mydomain.tld"}` * @returns void */ // TODO: It seems important to add this to the docs somewhere since it's the key From ba9c3518bdba5aa33da71a81e37d612978f78add Mon Sep 17 00:00:00 2001 From: Dan Buchholz Date: Tue, 4 Jun 2024 11:53:16 -0500 Subject: [PATCH 2/3] feat(sdk|cli): add base chain support Adds Base Sepolia chain support. Note the SDK cannot use the getFeeData function since it's an OP chain. This was tested with the react-js template since it'll log errors wrt that method, and if you don't avoid getting the fee data, you can't execute SQL statements because the estimate gas function fails. Successful table created here: https://testnets.tableland.network/api/v1/tables/84532/2 --- package-lock.json | 16 ++++++++-------- packages/cli/package.json | 4 ++-- packages/cli/src/utils.ts | 2 ++ packages/sdk/package.json | 4 ++-- packages/sdk/src/helpers/ethers.ts | 9 +++++++-- packages/sdk/src/validator/client/validator.ts | 10 ++++++++++ packages/sdk/test/chains.test.ts | 2 ++ 7 files changed, 33 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index f759c7fc..13ffa1d4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3651,9 +3651,9 @@ "link": true }, "node_modules/@tableland/evm": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@tableland/evm/-/evm-6.1.1.tgz", - "integrity": "sha512-6fQLM2YFTlFLIDgzvEITIqNpQoxyaD70l6KFBQEteU/wDy2bAz0d/N618H1U5faaG9cfOwyvDAYnmh3gyZdTEw==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/@tableland/evm/-/evm-6.2.0.tgz", + "integrity": "sha512-5lazGjkiggwQ4GjBgEoI/v3IG5uM4H6b9bcKoJ37mRySEaQtFKUMhrvK7juNUyLipc1XMrhMBbh0xSH6bUAbhA==", "dependencies": { "@openzeppelin/contracts": "4.9.6", "ethers": "^6.12.0" @@ -18910,7 +18910,7 @@ "license": "MIT AND Apache-2.0", "dependencies": { "@async-generators/from-emitter": "^0.3.0", - "@tableland/evm": "^6.1.1", + "@tableland/evm": "^6.2.0", "@tableland/sqlparser": "^1.3.0", "ethers": "^6.12.1" } @@ -21595,9 +21595,9 @@ } }, "@tableland/evm": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@tableland/evm/-/evm-6.1.1.tgz", - "integrity": "sha512-6fQLM2YFTlFLIDgzvEITIqNpQoxyaD70l6KFBQEteU/wDy2bAz0d/N618H1U5faaG9cfOwyvDAYnmh3gyZdTEw==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/@tableland/evm/-/evm-6.2.0.tgz", + "integrity": "sha512-5lazGjkiggwQ4GjBgEoI/v3IG5uM4H6b9bcKoJ37mRySEaQtFKUMhrvK7juNUyLipc1XMrhMBbh0xSH6bUAbhA==", "requires": { "@openzeppelin/contracts": "4.9.6", "ethers": "^6.12.0" @@ -21826,7 +21826,7 @@ "version": "file:packages/sdk", "requires": { "@async-generators/from-emitter": "^0.3.0", - "@tableland/evm": "^6.1.1", + "@tableland/evm": "^6.2.0", "@tableland/sqlparser": "^1.3.0", "ethers": "^6.12.1" }, diff --git a/packages/cli/package.json b/packages/cli/package.json index 00d65ece..2eced1e1 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@tableland/cli", - "version": "7.0.0", + "version": "7.1.0", "description": "Tableland command line tools", "repository": { "type": "git", @@ -49,7 +49,7 @@ "license": "MIT AND Apache-2.0", "dependencies": { "@tableland/node-helpers": "^1.0.0", - "@tableland/sdk": "^7.0.0", + "@tableland/sdk": "^7.1.0", "@tableland/sqlparser": "^1.3.0", "@tableland/studio-cli": "^0.1.0-pre.4", "cli-select-2": "^2.0.0", diff --git a/packages/cli/src/utils.ts b/packages/cli/src/utils.ts index 7964343a..dd35dcd1 100644 --- a/packages/cli/src/utils.ts +++ b/packages/cli/src/utils.ts @@ -61,6 +61,8 @@ export function getLink(chain: helpers.ChainName, hash: string): string { return `https://nova.arbiscan.io/tx/${hash}`; } return `https://arbiscan.io/tx/${hash}`; + } else if (chain.includes("base")) { + return `https://sepolia.basescan.org/tx/${hash}`; } else if (chain.includes("filecoin")) { if (chain.includes("calibration")) { return `https://calibration.filfox.info/tx/${hash}`; diff --git a/packages/sdk/package.json b/packages/sdk/package.json index f7407716..4dd1b34b 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@tableland/sdk", - "version": "7.0.1", + "version": "7.1.0", "description": "A database client and helpers for the Tableland network", "repository": { "type": "git", @@ -82,7 +82,7 @@ "license": "MIT AND Apache-2.0", "dependencies": { "@async-generators/from-emitter": "^0.3.0", - "@tableland/evm": "^6.1.1", + "@tableland/evm": "^6.2.0", "@tableland/sqlparser": "^1.3.0", "ethers": "^6.12.1" } diff --git a/packages/sdk/src/helpers/ethers.ts b/packages/sdk/src/helpers/ethers.ts index 48b4c3a0..6469faaf 100644 --- a/packages/sdk/src/helpers/ethers.ts +++ b/packages/sdk/src/helpers/ethers.ts @@ -115,8 +115,13 @@ export function isPolygon(chainId: number | bigint): boolean { */ 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); + // Optimism Sepolia, Base Sepolia, and Filecoin Calibration will log an RPC + // error when calling `getFeeData` because they don't support the method. + return !( + chainIdNumber === 11155420 || + chainIdNumber === 84532 || + chainIdNumber === 314159 + ); } /** diff --git a/packages/sdk/src/validator/client/validator.ts b/packages/sdk/src/validator/client/validator.ts index 8e46f111..772195ec 100644 --- a/packages/sdk/src/validator/client/validator.ts +++ b/packages/sdk/src/validator/client/validator.ts @@ -154,6 +154,16 @@ export interface components { * @example select * from healthbot_80002_1 */ readonly statement?: string; + /** + * @description The values of query parameters + * @example [ + * 1, + * "hello", + * null, + * true + * ] + */ + readonly params?: readonly (string | number | boolean)[]; /** * @description The requested response format: * `objects` - Returns the query results as a JSON array of JSON objects. * `table` - Return the query results as a JSON object with columns and rows properties. * diff --git a/packages/sdk/test/chains.test.ts b/packages/sdk/test/chains.test.ts index 3c480163..08a2b4b5 100644 --- a/packages/sdk/test/chains.test.ts +++ b/packages/sdk/test/chains.test.ts @@ -52,6 +52,7 @@ describe("chains", function () { "arbitrum-sepolia", "polygon-amoy", "optimism-sepolia", + "base-sepolia", "local-tableland", "localhost", ]; @@ -94,6 +95,7 @@ describe("chains", function () { strictEqual(getChainId("polygon-amoy"), 80002); strictEqual(getChainId("optimism-sepolia"), 11155420); strictEqual(getChainId("arbitrum-sepolia"), 421614); + strictEqual(getChainId("base-sepolia"), 84532); strictEqual(getChainId("filecoin-calibration"), 314159); // Local strictEqual(getChainId("localhost"), 31337); From 0c64b471aa8ecb9a9ab794f926c22e8c5ebac815 Mon Sep 17 00:00:00 2001 From: Dan Buchholz Date: Tue, 4 Jun 2024 13:18:29 -0500 Subject: [PATCH 3/3] chore(repo): udpate lockfile --- package-lock.json | 207 ++-------------------------------------------- 1 file changed, 5 insertions(+), 202 deletions(-) diff --git a/package-lock.json b/package-lock.json index 13ffa1d4..251a9920 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18291,11 +18291,11 @@ }, "packages/cli": { "name": "@tableland/cli", - "version": "7.0.0", + "version": "7.1.0", "license": "MIT AND Apache-2.0", "dependencies": { "@tableland/node-helpers": "^1.0.0", - "@tableland/sdk": "^7.0.0", + "@tableland/sdk": "^7.1.0", "@tableland/sqlparser": "^1.3.0", "@tableland/studio-cli": "^0.1.0-pre.4", "cli-select-2": "^2.0.0", @@ -18330,17 +18330,6 @@ "url": "https://paulmillr.com/funding/" } }, - "packages/cli/node_modules/@tableland/sdk": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@tableland/sdk/-/sdk-7.0.0.tgz", - "integrity": "sha512-+eOa4fV9EAYI7dmpg0gkT7ltcpcB1RgW2j9MFYK1VlhxGlQsgS1R6RbHJqCgy4FFAcdnce58PHcPG/hQVv3B8w==", - "dependencies": { - "@async-generators/from-emitter": "^0.3.0", - "@tableland/evm": "^6.1.0", - "@tableland/sqlparser": "^1.3.0", - "ethers": "^6.12.0" - } - }, "packages/cli/node_modules/@types/node": { "version": "18.15.13", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz", @@ -18676,17 +18665,6 @@ "url": "https://paulmillr.com/funding/" } }, - "packages/local/node_modules/@tableland/sdk": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@tableland/sdk/-/sdk-7.0.0.tgz", - "integrity": "sha512-+eOa4fV9EAYI7dmpg0gkT7ltcpcB1RgW2j9MFYK1VlhxGlQsgS1R6RbHJqCgy4FFAcdnce58PHcPG/hQVv3B8w==", - "dependencies": { - "@async-generators/from-emitter": "^0.3.0", - "@tableland/evm": "^6.1.0", - "@tableland/sqlparser": "^1.3.0", - "ethers": "^6.12.0" - } - }, "packages/local/node_modules/@types/node": { "version": "18.15.13", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz", @@ -18807,106 +18785,9 @@ "node": ">=14.0.0" } }, - "packages/node-helpers/node_modules/@adraffy/ens-normalize": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz", - "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==", - "dev": true - }, - "packages/node-helpers/node_modules/@noble/hashes": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", - "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", - "dev": true, - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "packages/node-helpers/node_modules/@tableland/sdk": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@tableland/sdk/-/sdk-7.0.0.tgz", - "integrity": "sha512-+eOa4fV9EAYI7dmpg0gkT7ltcpcB1RgW2j9MFYK1VlhxGlQsgS1R6RbHJqCgy4FFAcdnce58PHcPG/hQVv3B8w==", - "dev": true, - "dependencies": { - "@async-generators/from-emitter": "^0.3.0", - "@tableland/evm": "^6.1.0", - "@tableland/sqlparser": "^1.3.0", - "ethers": "^6.12.0" - } - }, - "packages/node-helpers/node_modules/@types/node": { - "version": "18.15.13", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz", - "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==", - "dev": true - }, - "packages/node-helpers/node_modules/aes-js": { - "version": "4.0.0-beta.5", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", - "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==", - "dev": true - }, - "packages/node-helpers/node_modules/ethers": { - "version": "6.12.1", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.12.1.tgz", - "integrity": "sha512-j6wcVoZf06nqEcBbDWkKg8Fp895SS96dSnTCjiXT+8vt2o02raTn4Lo9ERUuIVU5bAjoPYeA+7ytQFexFmLuVw==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/ethers-io/" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@adraffy/ens-normalize": "1.10.1", - "@noble/curves": "1.2.0", - "@noble/hashes": "1.3.2", - "@types/node": "18.15.13", - "aes-js": "4.0.0-beta.5", - "tslib": "2.4.0", - "ws": "8.5.0" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "packages/node-helpers/node_modules/tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", - "dev": true - }, - "packages/node-helpers/node_modules/ws": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", - "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", - "dev": true, - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "packages/sdk": { "name": "@tableland/sdk", - "version": "7.0.1", + "version": "7.1.0", "license": "MIT AND Apache-2.0", "dependencies": { "@async-generators/from-emitter": "^0.3.0", @@ -21394,7 +21275,7 @@ "version": "file:packages/cli", "requires": { "@tableland/node-helpers": "^1.0.0", - "@tableland/sdk": "^7.0.0", + "@tableland/sdk": "^7.1.0", "@tableland/sqlparser": "^1.3.0", "@tableland/studio-cli": "^0.1.0-pre.4", "cli-select-2": "^2.0.0", @@ -21421,8 +21302,7 @@ "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==" }, "@tableland/sdk": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@tableland/sdk/-/sdk-7.0.0.tgz", + "version": "https://registry.npmjs.org/@tableland/sdk/-/sdk-7.0.0.tgz", "integrity": "sha512-+eOa4fV9EAYI7dmpg0gkT7ltcpcB1RgW2j9MFYK1VlhxGlQsgS1R6RbHJqCgy4FFAcdnce58PHcPG/hQVv3B8w==", "requires": { "@async-generators/from-emitter": "^0.3.0", @@ -21673,17 +21553,6 @@ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==" }, - "@tableland/sdk": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@tableland/sdk/-/sdk-7.0.0.tgz", - "integrity": "sha512-+eOa4fV9EAYI7dmpg0gkT7ltcpcB1RgW2j9MFYK1VlhxGlQsgS1R6RbHJqCgy4FFAcdnce58PHcPG/hQVv3B8w==", - "requires": { - "@async-generators/from-emitter": "^0.3.0", - "@tableland/evm": "^6.1.0", - "@tableland/sqlparser": "^1.3.0", - "ethers": "^6.12.0" - } - }, "@types/node": { "version": "18.15.13", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz", @@ -21754,72 +21623,6 @@ "requires": { "@tableland/sdk": "^7.0.0", "tempy": "^3.1.0" - }, - "dependencies": { - "@adraffy/ens-normalize": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz", - "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==", - "dev": true - }, - "@noble/hashes": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", - "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", - "dev": true - }, - "@tableland/sdk": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@tableland/sdk/-/sdk-7.0.0.tgz", - "integrity": "sha512-+eOa4fV9EAYI7dmpg0gkT7ltcpcB1RgW2j9MFYK1VlhxGlQsgS1R6RbHJqCgy4FFAcdnce58PHcPG/hQVv3B8w==", - "dev": true, - "requires": { - "@async-generators/from-emitter": "^0.3.0", - "@tableland/evm": "^6.1.0", - "@tableland/sqlparser": "^1.3.0", - "ethers": "^6.12.0" - } - }, - "@types/node": { - "version": "18.15.13", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz", - "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==", - "dev": true - }, - "aes-js": { - "version": "4.0.0-beta.5", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", - "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==", - "dev": true - }, - "ethers": { - "version": "6.12.1", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.12.1.tgz", - "integrity": "sha512-j6wcVoZf06nqEcBbDWkKg8Fp895SS96dSnTCjiXT+8vt2o02raTn4Lo9ERUuIVU5bAjoPYeA+7ytQFexFmLuVw==", - "dev": true, - "requires": { - "@adraffy/ens-normalize": "1.10.1", - "@noble/curves": "1.2.0", - "@noble/hashes": "1.3.2", - "@types/node": "18.15.13", - "aes-js": "4.0.0-beta.5", - "tslib": "2.4.0", - "ws": "8.5.0" - } - }, - "tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", - "dev": true - }, - "ws": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", - "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", - "dev": true, - "requires": {} - } } }, "@tableland/sdk": {