From 5620909023e637448ae87aafb8333e20b5a4fcd7 Mon Sep 17 00:00:00 2001 From: r-vdp Date: Tue, 2 Sep 2025 15:32:56 +0300 Subject: [PATCH 1/3] chore: add npmrc to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 52b8630..611040d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules dist docs +.npmrc *.tsbuildinfo From ed56e06354cffa6a6e3b23f985873ae3d5c28336 Mon Sep 17 00:00:00 2001 From: r-vdp Date: Tue, 2 Sep 2025 15:54:22 +0300 Subject: [PATCH 2/3] chore: rename to GolemDB --- example/index.ts | 6 +-- package.json | 2 +- src/client.ts | 76 ++++++++++++++++++------------------ src/index.ts | 24 ++++++------ src/internal/client.ts | 74 +++++++++++++++++------------------ test/client.spec.ts | 14 +++---- test/internal/client.spec.ts | 28 ++++++------- 7 files changed, 112 insertions(+), 112 deletions(-) diff --git a/example/index.ts b/example/index.ts index 6a7472c..54106e9 100644 --- a/example/index.ts +++ b/example/index.ts @@ -11,7 +11,7 @@ import { Wallet, getBytes } from "ethers" import { createClient, formatEther, - type GolemBaseCreate, + type GolemDBCreate, Annotation, Tagged, type AccountData, @@ -39,7 +39,7 @@ async function readPassword(prompt: string = "Enter wallet password: "): Promise resolve(password.trim()); }); // Hide input for security - (rl as any)._writeToOutput = () => {}; + (rl as any)._writeToOutput = () => { }; }); } else { // Input is piped @@ -135,7 +135,7 @@ async function main() { log.info("*********************") log.info("") - const creates: GolemBaseCreate[] = [ + const creates: GolemDBCreate[] = [ { data: encoder.encode("foo"), btl: 25, diff --git a/package.json b/package.json index 4da0535..b877289 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "golem-base-sdk", - "version": "0.1.16", + "version": "0.2.0", "description": "", "homepage": "https://golem-base.github.io/typescript-sdk/", "repository": { diff --git a/src/client.ts b/src/client.ts index 8bbbb27..94c03ca 100644 --- a/src/client.ts +++ b/src/client.ts @@ -6,9 +6,9 @@ import { import { type Hex, - type GolemBaseCreate, - type GolemBaseUpdate, - type GolemBaseExtend, + type GolemDBCreate, + type GolemDBUpdate, + type GolemDBExtend, type EntityMetaData, type AccountData, golemBaseABI, @@ -52,17 +52,17 @@ interface GenericClient { getRawClient(): Internal /** - * Get the total count of entities in GolemBase + * Get the total count of entities in GolemDB */ getEntityCount(): Promise /** - * Get the entity keys of all entities in GolemBase + * Get the entity keys of all entities in GolemDB */ getAllEntityKeys(): Promise /** - * Get the entity keys of all entities in GolemBase owned by the given address + * Get the entity keys of all entities in GolemDB owned by the given address * * @returns Array of the entity keys */ @@ -78,7 +78,7 @@ interface GenericClient { getStorageValue(key: Hex): Promise /** - * Query entities in GolemBase based on annotations + * Query entities in GolemDB based on annotations * * @param query - The query to look up entities with * @@ -105,7 +105,7 @@ interface GenericClient { getEntityMetaData(key: Hex): Promise /** - * Install callbacks that will be invoked for every GolemBase transaction + * Install callbacks that will be invoked for every GolemDB transaction * * @param args.fromBlock - The starting block, events trigger the callbacks starting from this block * @param args.onCreated - A callback that's invoked whenever entities are created @@ -131,9 +131,9 @@ interface GenericClient { }): () => void } -export interface GolemBaseROClient extends GenericClient { } +export interface GolemDBROClient extends GenericClient { } -export interface GolemBaseClient extends GenericClient { +export interface GolemDBClient extends GenericClient { /** * Get the ethereum address of the owner of the ethereum account used by this client */ @@ -149,10 +149,10 @@ export interface GolemBaseClient extends GenericClient * @param args.maxPriorityFeePerGas - Sets the max priority fee per gas manually */ sendTransaction( - creates?: GolemBaseCreate[], - updates?: GolemBaseUpdate[], + creates?: GolemDBCreate[], + updates?: GolemDBUpdate[], deletes?: Hex[], - extensions?: GolemBaseExtend[], + extensions?: GolemDBExtend[], args?: { txHashCallback?: (txHash: Hex) => void, gas?: bigint, @@ -167,7 +167,7 @@ export interface GolemBaseClient extends GenericClient }> /** - * Create one or more new entities in GolemBase + * Create one or more new entities in GolemDB * * @param creates - The entities to create * @param args - Optional parameters, see {@link sendTransaction} @@ -176,7 +176,7 @@ export interface GolemBaseClient extends GenericClient * together with the number of the block at which they will expire */ createEntities( - creates: GolemBaseCreate[], + creates: GolemDBCreate[], args?: { txHashCallback?: (txHash: Hex) => void, gas?: bigint, @@ -186,7 +186,7 @@ export interface GolemBaseClient extends GenericClient ): Promise /** - * Update one or more new entities in GolemBase + * Update one or more new entities in GolemDB * * @param updates - The entities to update * @param args - Optional parameters, see {@link sendTransaction} @@ -195,7 +195,7 @@ export interface GolemBaseClient extends GenericClient * together with the number of the block at which they will expire */ updateEntities( - updates: GolemBaseUpdate[], + updates: GolemDBUpdate[], args?: { txHashCallback?: (txHash: Hex) => void, gas?: bigint, @@ -205,7 +205,7 @@ export interface GolemBaseClient extends GenericClient ): Promise /** - * Delete one or more new entities in GolemBase + * Delete one or more new entities in GolemDB * * @param deletes - The entity keys of the entities to delete * @param args - Optional parameters, see {@link sendTransaction} @@ -223,7 +223,7 @@ export interface GolemBaseClient extends GenericClient ): Promise /** - * Extend the BTL of one or more new entities in GolemBase + * Extend the BTL of one or more new entities in GolemDB * * @param extensions - The entities to extend the BTL of * @param args - Optional parameters, see {@link sendTransaction} @@ -233,7 +233,7 @@ export interface GolemBaseClient extends GenericClient * entities expire */ extendEntities( - extensions: GolemBaseExtend[], + extensions: GolemDBExtend[], args?: { txHashCallback?: (txHash: Hex) => void, gas?: bigint, @@ -321,7 +321,7 @@ function parseTransactionLogs( ) } -function createGenericClient( +function createGenericClient( client: Internal, logger: Logger ): GenericClient { @@ -413,7 +413,7 @@ function createGenericClient( } /** - * Create a read-only client to interact with GolemBase + * Create a read-only client to interact with GolemDB * @param chainId - The ID of the chain you are connecting to * @param rpcUrl - JSON-RPC URL to talk to * @param wsUrl - WebSocket URL to talk to @@ -429,20 +429,20 @@ export function createROClient( type: "hidden", hideLogPositionForProduction: true, }) -): GolemBaseROClient { +): GolemDBROClient { const iClient = internal.createROClient(chainId, rpcUrl, wsUrl, logger) const baseClient = createGenericClient(iClient, logger) return { ...baseClient, - getRawClient(): internal.GolemBaseROClient { + getRawClient(): internal.GolemDBROClient { return iClient }, } } /** - * Create a client to interact with GolemBase + * Create a client to interact with GolemDB * @param chainId - The ID of the chain you are connecting to * @param accountData - Either a private key or a wallet provider for the user's account * @param rpcUrl - JSON-RPC URL to talk to @@ -460,7 +460,7 @@ export async function createClient( type: "hidden", hideLogPositionForProduction: true, }) -): Promise { +): Promise { const iClient = await internal.createClient(chainId, accountData, rpcUrl, wsUrl, logger) const baseClient = createGenericClient(iClient, logger) @@ -479,11 +479,11 @@ export async function createClient( }, async sendTransaction( - this: GolemBaseClient, - creates: GolemBaseCreate[] = [], - updates: GolemBaseUpdate[] = [], + this: GolemDBClient, + creates: GolemDBCreate[] = [], + updates: GolemDBUpdate[] = [], deletes: Hex[] = [], - extensions: GolemBaseExtend[] = [], + extensions: GolemDBExtend[] = [], args: { txHashCallback?: (txHash: Hex) => void, gas?: bigint, @@ -496,7 +496,7 @@ export async function createClient( deleteEntitiesReceipts: DeleteEntityReceipt[], extendEntitiesReceipts: ExtendEntityReceipt[], }> { - const receipt = await iClient.walletClient.sendGolemBaseTransactionAndWaitForReceipt( + const receipt = await iClient.walletClient.sendGolemDBTransactionAndWaitForReceipt( creates, updates, deletes, extensions, args ) log.debug("Got receipt:", receipt) @@ -507,8 +507,8 @@ export async function createClient( }, async createEntities( - this: GolemBaseClient, - creates: GolemBaseCreate[], + this: GolemDBClient, + creates: GolemDBCreate[], args: { txHashCallback?: (txHash: Hex) => void, gas?: bigint, @@ -522,8 +522,8 @@ export async function createClient( }, async updateEntities( - this: GolemBaseClient, - updates: GolemBaseUpdate[], + this: GolemDBClient, + updates: GolemDBUpdate[], args: { txHashCallback?: (txHash: Hex) => void, gas?: bigint, @@ -537,7 +537,7 @@ export async function createClient( }, async deleteEntities( - this: GolemBaseClient, + this: GolemDBClient, deletes: Hex[], args: { txHashCallback?: (txHash: Hex) => void, @@ -552,8 +552,8 @@ export async function createClient( }, async extendEntities( - this: GolemBaseClient, - extensions: GolemBaseExtend[], + this: GolemDBClient, + extensions: GolemDBExtend[], args: { txHashCallback?: (txHash: Hex) => void, gas?: bigint, diff --git a/src/index.ts b/src/index.ts index e22a57c..d76dbe1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -63,18 +63,18 @@ export type AccountData = export type Hex = `0x${string}` /** - * Type representing a create transaction in GolemBase + * Type representing a create transaction in GolemDB */ -export type GolemBaseCreate = { +export type GolemDBCreate = { readonly data: Uint8Array, readonly btl: number, readonly stringAnnotations: StringAnnotation[] readonly numericAnnotations: NumericAnnotation[], } /** - * Type representing an update transaction in GolemBase + * Type representing an update transaction in GolemDB */ -export type GolemBaseUpdate = { +export type GolemDBUpdate = { readonly entityKey: Hex, readonly data: Uint8Array, readonly btl: number, @@ -82,24 +82,24 @@ export type GolemBaseUpdate = { readonly numericAnnotations: NumericAnnotation[], } /** - * Type representing an extend transaction in GolemBase + * Type representing an extend transaction in GolemDB */ -export type GolemBaseExtend = { +export type GolemDBExtend = { readonly entityKey: Hex, readonly numberOfBlocks: number, } /** - * Type representing a delete transaction in GolemBase + * Type representing a delete transaction in GolemDB */ -export type GolemBaseTransaction = { - readonly creates?: GolemBaseCreate[], - readonly updates?: GolemBaseUpdate[], +export type GolemDBTransaction = { + readonly creates?: GolemDBCreate[], + readonly updates?: GolemDBUpdate[], readonly deletes?: Hex[], - readonly extensions?: GolemBaseExtend[], + readonly extensions?: GolemDBExtend[], } /** - * Type representing the metadata of a entity stored in GolemBase + * Type representing the metadata of a entity stored in GolemDB */ export type EntityMetaData = { readonly expiresAtBlock: bigint, diff --git a/src/internal/client.ts b/src/internal/client.ts index 4b9f267..1da0608 100644 --- a/src/internal/client.ts +++ b/src/internal/client.ts @@ -33,11 +33,11 @@ import { import { type Hex, - type GolemBaseCreate, - type GolemBaseUpdate, - type GolemBaseTransaction, + type GolemDBCreate, + type GolemDBUpdate, + type GolemDBTransaction, type EntityMetaData, - type GolemBaseExtend, + type GolemDBExtend, type AccountData, } from ".." import { SmartAccount } from 'viem/_types/account-abstraction/accounts/types'; @@ -100,7 +100,7 @@ type GolemQueryEntitiesSchema = { ReturnType: [GolemQueryEntitiesReturnType] } -export type GolemBaseActions = { +export type GolemDBActions = { getStorageValue(args: GolemGetStorageValueInputParams): Promise getEntityMetaData(args: GolemGetEntityMetaDataInputParams): Promise /** @@ -113,7 +113,7 @@ export type GolemBaseActions = { queryEntities(args: GolemQueryEntitiesInputParams): Promise<{ key: Hex, value: Uint8Array, }[]> } -export type GolemBaseWalletActions = { +export type GolemDBWalletActions = { createRawStorageTransaction( payload: Hex, gas: bigint | undefined, @@ -121,21 +121,21 @@ export type GolemBaseWalletActions = { maxPriorityFeePerGas: bigint | undefined, ): Promise - sendGolemBaseTransaction( - creates?: GolemBaseCreate[], - updates?: GolemBaseUpdate[], + sendGolemDBTransaction( + creates?: GolemDBCreate[], + updates?: GolemDBUpdate[], deletes?: Hex[], - extensions?: GolemBaseExtend[], + extensions?: GolemDBExtend[], gas?: bigint, maxFeePerGas?: bigint, maxPriorityFeePerGas?: bigint, ): Promise - sendGolemBaseTransactionAndWaitForReceipt( - creates?: GolemBaseCreate[], - updates?: GolemBaseUpdate[], + sendGolemDBTransactionAndWaitForReceipt( + creates?: GolemDBCreate[], + updates?: GolemDBUpdate[], deletes?: Hex[], - extensions?: GolemBaseExtend[], + extensions?: GolemDBExtend[], args?: { gas?: bigint, maxFeePerGas?: bigint, @@ -150,15 +150,15 @@ export type AllActions< > = PublicActions & WalletActions & - GolemBaseActions + GolemDBActions -export interface GolemBaseROClient { +export interface GolemDBROClient { httpClient: Client< HttpTransport, Chain, Account | undefined, RpcSchema, - PublicActions & GolemBaseActions + PublicActions & GolemDBActions > wsClient: Client< @@ -170,7 +170,7 @@ export interface GolemBaseROClient { > } -export interface GolemBaseClient extends GolemBaseROClient { +export interface GolemDBClient extends GolemDBROClient { walletClient: Client< HttpTransport | CustomTransport, Chain, @@ -178,7 +178,7 @@ export interface GolemBaseClient extends GolemBaseROClient { RpcSchema, WalletActions & PublicActions & GolemBaseWalletActions + Account> & GolemDBWalletActions > } @@ -187,7 +187,7 @@ function mkHttpClient(rpcUrl: string, chain: Chain): Client< Chain, Account | undefined, RpcSchema, - PublicActions & GolemBaseActions + PublicActions & GolemDBActions > { return createPublicClient({ chain, @@ -271,7 +271,7 @@ async function mkWalletClient( RpcSchema, WalletActions & PublicActions & GolemBaseWalletActions>> { + Account> & GolemDBWalletActions>> { const defaultMaxFeePerGas = undefined const defaultMaxPriorityFeePerGas = undefined @@ -297,7 +297,7 @@ async function mkWalletClient( }) } - function createPayload(tx: GolemBaseTransaction): Hex { + function createPayload(tx: GolemDBTransaction): Hex { function formatAnnotation< T extends string | number | bigint | boolean >(annotation: { key: string, value: T, }): [Hex, Hex] { @@ -363,11 +363,11 @@ async function mkWalletClient( return hash }, - async sendGolemBaseTransaction( - creates: GolemBaseCreate[] = [], - updates: GolemBaseUpdate[] = [], + async sendGolemDBTransaction( + creates: GolemDBCreate[] = [], + updates: GolemDBUpdate[] = [], deletes: Hex[] = [], - extensions: GolemBaseExtend[] = [], + extensions: GolemDBExtend[] = [], gas: bigint | undefined, maxFeePerGas: bigint | undefined = defaultMaxFeePerGas, maxPriorityFeePerGas: bigint | undefined = defaultMaxPriorityFeePerGas, @@ -380,11 +380,11 @@ async function mkWalletClient( ) }, - async sendGolemBaseTransactionAndWaitForReceipt( - creates: GolemBaseCreate[] = [], - updates: GolemBaseUpdate[] = [], + async sendGolemDBTransactionAndWaitForReceipt( + creates: GolemDBCreate[] = [], + updates: GolemDBUpdate[] = [], deletes: Hex[] = [], - extensions: GolemBaseExtend[] = [], + extensions: GolemDBExtend[] = [], args: { gas?: bigint, maxFeePerGas?: bigint, @@ -426,7 +426,7 @@ async function mkWalletClient( })) } -function createGolemBaseChain( +function createGolemDBChain( chainId: number, rpcUrl: string, wsUrl: string, @@ -449,7 +449,7 @@ function createGolemBaseChain( } /** - * Create a read-only client to interact with GolemBase + * Create a read-only client to interact with GolemDB * @param rpcUrl - JSON-RPC URL to talk to * @param wsUrl - WebSocket URL to talk to * @param logger - Optional logger instance to use for logging @@ -464,10 +464,10 @@ export function createROClient( type: "hidden", hideLogPositionForProduction: true, }) -): GolemBaseROClient { +): GolemDBROClient { const log = logger.getSubLogger({ name: "internal" }); - const chain = createGolemBaseChain( + const chain = createGolemDBChain( chainId, rpcUrl, wsUrl ) @@ -484,7 +484,7 @@ export function createROClient( } /** - * Create a client to interact with GolemBase + * Create a client to interact with GolemDB * @param accountData - Either a private key or a wallet provider for the user's account * @param rpcUrl - JSON-RPC URL to talk to * @param wsUrl - WebSocket URL to talk to @@ -501,10 +501,10 @@ export async function createClient( type: "hidden", hideLogPositionForProduction: true, }) -): Promise { +): Promise { const log = logger.getSubLogger({ name: "internal" }); - const chain = createGolemBaseChain( + const chain = createGolemDBChain( chainId, rpcUrl, wsUrl ) diff --git a/test/client.spec.ts b/test/client.spec.ts index 1014b83..1d28422 100644 --- a/test/client.spec.ts +++ b/test/client.spec.ts @@ -12,9 +12,9 @@ import xdg from "xdg-portable" import { Wallet, getBytes } from "ethers" import { createClient, - type GolemBaseClient, + type GolemDBClient, type Hex, - type GolemBaseCreate, + type GolemDBCreate, Annotation, Tagged, type AccountData, @@ -40,7 +40,7 @@ const wallet = Wallet.fromEncryptedJsonSync(keystore, walletTestPassword); let entitiesOwnedCount = 0 let entityKey: Hex = "0x" let expiryBlock: number -let client: GolemBaseClient +let client: GolemDBClient describe("the golem-base client", () => { it("can be created", async () => { @@ -72,11 +72,11 @@ describe("the golem-base client", () => { const data = generateRandomBytes(32) const stringAnnotation = generateRandomString(32) - async function getEntitiesOwned(client: GolemBaseClient): Promise { + async function getEntitiesOwned(client: GolemDBClient): Promise { return client.getEntitiesOfOwner(await client.getOwnerAddress()) } - async function numOfEntitiesOwned(client: GolemBaseClient): Promise { + async function numOfEntitiesOwned(client: GolemDBClient): Promise { const entitiesOwned = await getEntitiesOwned(client) log.debug("Entities owned:", entitiesOwned) log.debug("Number of entities owned:", entitiesOwned.length) @@ -84,7 +84,7 @@ describe("the golem-base client", () => { } async function deleteAllEntitiesWithIndex( - client: GolemBaseClient, + client: GolemDBClient, index: number, txHashCallback: (txHash: Hex) => void, ): Promise { @@ -117,7 +117,7 @@ describe("the golem-base client", () => { }) it("should be able to create multiple entities", async () => { - const creates: GolemBaseCreate[] = [ + const creates: GolemDBCreate[] = [ { data, btl: 25, diff --git a/test/internal/client.spec.ts b/test/internal/client.spec.ts index cc35c9d..4aef2c6 100644 --- a/test/internal/client.spec.ts +++ b/test/internal/client.spec.ts @@ -12,7 +12,7 @@ import xdg from "xdg-portable" import { Wallet, getBytes } from "ethers" import { internal, - type GolemBaseCreate, + type GolemDBCreate, type Hex, Annotation, Tagged, @@ -23,7 +23,7 @@ import { generateRandomBytes, generateRandomString, } from "../utils.ts" -import { GolemBaseClient } from '../../src/internal/client.ts' +import { GolemDBClient } from '../../src/internal/client.ts' import { decodeEventLog, toHex } from 'viem' const log = new Logger({ @@ -32,25 +32,25 @@ const log = new Logger({ minLevel: 3, }) -async function getEntitiesOwned(client: internal.GolemBaseClient): Promise { +async function getEntitiesOwned(client: internal.GolemDBClient): Promise { return client.httpClient.getEntitiesOfOwner(await ownerAddress(client)) } -async function numOfEntitiesOwned(client: internal.GolemBaseClient): Promise { +async function numOfEntitiesOwned(client: internal.GolemDBClient): Promise { const entitiesOwned = await getEntitiesOwned(client) log.debug("Entities owned:", entitiesOwned) log.debug("Number of entities owned:", entitiesOwned.length) return entitiesOwned.length } -async function deleteAllEntitiesWithIndex(client: internal.GolemBaseClient, index: number): Promise { +async function deleteAllEntitiesWithIndex(client: internal.GolemDBClient, index: number): Promise { log.debug("Deleting entities with index", index) const queryResult = await client.httpClient.queryEntities(`ix = ${index}`) log.debug("deleteEntitiesWithIndex, queryResult", queryResult) return Promise.all( queryResult.map(async (res: { key: Hex }) => { log.debug("Deleting entity with key", res.key) - return await client.walletClient.sendGolemBaseTransactionAndWaitForReceipt( + return await client.walletClient.sendGolemDBTransactionAndWaitForReceipt( [], [], [res.key] @@ -59,7 +59,7 @@ async function deleteAllEntitiesWithIndex(client: internal.GolemBaseClient, inde ) } -async function ownerAddress(client: internal.GolemBaseClient): Promise { +async function ownerAddress(client: internal.GolemDBClient): Promise { return (await client.walletClient.getAddresses())[0] } @@ -70,7 +70,7 @@ const walletTestPassword = "password"; const keystore = readFileSync(walletPath); const wallet = Wallet.fromEncryptedJsonSync(keystore, walletTestPassword); -let client: GolemBaseClient +let client: GolemDBClient const data = generateRandomBytes(32) const stringAnnotation = generateRandomString(32) @@ -107,7 +107,7 @@ describe("the internal golem-base client", () => { }) it("should delete all our entities", async () => { - await client.walletClient.sendGolemBaseTransactionAndWaitForReceipt( + await client.walletClient.sendGolemDBTransactionAndWaitForReceipt( [], [], await getEntitiesOwned(client) @@ -123,7 +123,7 @@ describe("the internal golem-base client", () => { }) it("should be able to create entities", async () => { - const hash = await client.walletClient.sendGolemBaseTransaction([{ + const hash = await client.walletClient.sendGolemDBTransaction([{ data: generateRandomBytes(32), btl: 25, stringAnnotations: [new Annotation("key", generateRandomString(32))], @@ -137,7 +137,7 @@ describe("the internal golem-base client", () => { }) it("should be able to create multiple entities", async () => { - const creates: GolemBaseCreate[] = [ + const creates: GolemDBCreate[] = [ { data, btl: 25, @@ -157,7 +157,7 @@ describe("the internal golem-base client", () => { numericAnnotations: [new Annotation("ix", 3)] } ] - const receipt = await client.walletClient.sendGolemBaseTransactionAndWaitForReceipt(creates) + const receipt = await client.walletClient.sendGolemDBTransactionAndWaitForReceipt(creates) entitiesOwnedCount += creates.length; const txlog = receipt.logs[0] @@ -243,7 +243,7 @@ describe("the internal golem-base client", () => { it("should be able to update entities", async () => { const newData = generateRandomBytes(32) const newStringAnnotation = generateRandomString(32) - const result = await client.walletClient.sendGolemBaseTransactionAndWaitForReceipt([], [{ + const result = await client.walletClient.sendGolemDBTransactionAndWaitForReceipt([], [{ entityKey, btl: 10, data: newData, @@ -257,7 +257,7 @@ describe("the internal golem-base client", () => { it("should be able to extend entities", async () => { const numberOfBlocks = 20 - const result = await client.walletClient.sendGolemBaseTransactionAndWaitForReceipt([], [], [], [{ + const result = await client.walletClient.sendGolemDBTransactionAndWaitForReceipt([], [], [], [{ entityKey, numberOfBlocks, }]) From 22bcd9030f1a8b8943f5844b7726078ebe5ce9f5 Mon Sep 17 00:00:00 2001 From: r-vdp Date: Tue, 2 Sep 2025 15:56:44 +0300 Subject: [PATCH 3/3] chore: rename package --- README.md | 22 +- example/index.html | 2 +- example/index.ts | 2 +- example/package.json | 4 +- example/pnpm-lock.yaml | 12 +- package.json | 16 +- pnpm-lock.yaml | 530 +++++++++++++++++++++-------------------- 7 files changed, 300 insertions(+), 288 deletions(-) diff --git a/README.md b/README.md index e7a1a08..7bc07f2 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# 🚀 Golem Base +# 🚀 GolemDB -This is part of the [Golem Base](https://github.com/Golem-Base) project, which is which is designed as a Layer2 Network deployed on Ethereum, acting as a gateway to various Layer 3 Database Chains (DB-Chains). +This is part of the [GolemDB](https://github.com/Golem-Base) project, which is which is designed as a Layer2 Network deployed on Ethereum, acting as a gateway to various Layer 3 Database Chains (DB-Chains). -> **For an overview of Golem Base, check out our [Litepaper](https://golem-base.io/wp-content/uploads/2025/03/GolemBase-Litepaper.pdf).** +> **For an overview of GolemDB, check out our [Litepaper](https://golem-base.io/wp-content/uploads/2025/03/GolemDB-Litepaper.pdf).** -# 🌌GolemBase SDK for TypeScript +# 🌌GolemDB SDK for TypeScript -This SDK allows you to use [GolemBase](https://github.com/Golem-Base) from TypeScript. It is available [on NPM](https://www.npmjs.com/package/golem-base-sdk). +This SDK allows you to use [GolemDB](https://github.com/Golem-Base) from TypeScript. It is available [on NPM](https://www.npmjs.com/package/golemdb-sdk). We also publish [generated documentation](https://golem-base.github.io/typescript-sdk/). @@ -58,7 +58,7 @@ npm install --save-dev typescript And now add the golem TypeScript SDK to your package by typing: ``` -npm i golem-base-sdk +npm i golemdb-sdk ``` Now update your package.json file, changing the `type` member to `"type": "module",` and adding the two script lines for `build` and `start`. (Be sure to add a comma after the first script line called test. Also, you can leave the `name` member set to whatever it is. And the order of the members doesn't matter.) @@ -82,7 +82,7 @@ Now update your package.json file, changing the `type` member to `"type": "modul "typescript": "^5.8.3" }, "dependencies": { - "golem-base-sdk": "^0.1.8" + "golemdb-sdk": "^0.1.8" } } @@ -121,9 +121,9 @@ This is a basic TypeScript application that: 1. Imports several items from the SDK (called "golem-base-sdk") including: - * `createClient`: A function that creates a client to interact with GolemBase - * `type GolemBaseClient`: A type that represents the base client for interacting with Golem - * `type GolemBaseCreate`: A type representing a create transaction in GolemBase + * `createClient`: A function that creates a client to interact with GolemDB + * `type GolemDBClient`: A type that represents the base client for interacting with Golem + * `type GolemDBCreate`: A type representing a create transaction in GolemDB * `Annotation`: A type representing an annotation with a key and a value, used for efficient lookups 2. Reads the private key from a wallet, which it locates through the `xdg-portable` module. @@ -144,7 +144,7 @@ The `main` function demonstrates how to create, modify, and delete entities: * One with data `"bar"` and a time to live of `2`, and a numeric annotation of `2` * One with data `"qux"` and a time to live of `50`, and a numeric annotation also of `2` - Notice that the type of each is GolemBaseCreate. + Notice that the type of each is GolemDBCreate. 4. It then calls client.createEntities to create the entities within Golem. Notice that this returns a promise of an array of items, each of which contain an `entityKey` and an `expirationBlock`. diff --git a/example/index.html b/example/index.html index 97dd7d4..3c942d6 100644 --- a/example/index.html +++ b/example/index.html @@ -2,7 +2,7 @@ GolemBase in the browser - +