Skip to content

Commit

Permalink
feat: bump dojo v1.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
MartianGreed committed Dec 26, 2024
1 parent faf8d21 commit 5184801
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 48 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ docs
.DS_Store
# Local Netlify folder
.netlify
lerna-debug.log
8 changes: 4 additions & 4 deletions examples/example-nodejs-bot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ A Discord bot for interacting with your Dojo world via Torii.

Features:

- Poll a Torii for information.
- Expose a slash command for reading Torii state.
- Easy to extend with new commands.
- GraphQL codegen for Torii models.
- Poll a Torii for information.
- Expose a slash command for reading Torii state.
- Easy to extend with new commands.
- GraphQL codegen for Torii models.

---

Expand Down
4 changes: 2 additions & 2 deletions examples/example-vite-kitchen-sink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ sozo migrate apply

### Notes

- you main want to update `actions` contract address in `src/components/caller-counter.tsx` & `src/components/global-counter.tsx` which is hardcoded in those files.
- if you want to have braavos & argent wallet working, you need to deploy classes and deploy your wallet manually.
- you main want to update `actions` contract address in `src/components/caller-counter.tsx` & `src/components/global-counter.tsx` which is hardcoded in those files.
- if you want to have braavos & argent wallet working, you need to deploy classes and deploy your wallet manually.
12 changes: 6 additions & 6 deletions examples/example-vite-react-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ This template provides a minimal setup to get React working in Vite with HMR and

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:
- Configure the top-level `parserOptions` property like this:

```js
export default tseslint.config({
Expand All @@ -25,9 +25,9 @@ export default tseslint.config({
});
```

- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
- Optionally add `...tseslint.configs.stylisticTypeChecked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:
- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
- Optionally add `...tseslint.configs.stylisticTypeChecked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:

```js
// eslint.config.js
Expand Down
4 changes: 2 additions & 2 deletions examples/example-vite-svelte-recs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Check out [SvelteKit](https://github.com/sveltejs/kit#readme), which is also pow

**Why use this over SvelteKit?**

- It brings its own routing solution which might not be preferable for some users.
- It is first and foremost a framework that just happens to use Vite under the hood, not a Vite app.
- It brings its own routing solution which might not be preferable for some users.
- It is first and foremost a framework that just happens to use Vite under the hood, not a Vite app.

This template contains as little as possible to get started with Vite + TypeScript + Svelte, while taking into account the developer experience with regards to HMR and intellisense. It demonstrates capabilities on par with the other `create-vite` templates and is a good starting point for beginners dipping their toes into a Vite + Svelte project.

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"build": "bash ./scripts/build-packages.sh",
"build-examples": "bash ./scripts/build-examples.sh",
"clean": "bash ./scripts/clean.sh",
"prettier-check": "npx prettier --check {packages,examples}",
"prettier": "npx prettier --write {packages,examples}",
"prettier-check": "pnpx prettier --check {packages,examples}",
"prettier": "pnpx prettier --write {packages,examples}",
"release": "pnpm build && pnpm prettier && npx lerna publish --no-private --force-publish",
"docs": "npx typedoc --out docs",
"prepare": "husky install"
Expand Down
62 changes: 31 additions & 31 deletions packages/create-burner/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ Easily manage, create, and interact with burner accounts on Starknets using this

## Features:

- Initialize and manage burner accounts.
- Abstracts away intricacies related to creating, fetching, and setting active burner accounts.
- Easily integrate with React apps using the provided hook.
- Vanilla JS support.
- Initialize and manage burner accounts.
- Abstracts away intricacies related to creating, fetching, and setting active burner accounts.
- Easily integrate with React apps using the provided hook.
- Vanilla JS support.

## Table of Contents

- [Installation](#installation)
- [Usage](#usage)
- [With React](#with-react)
- [Vanilla JavaScript](#vanilla-javascript)
- [API](#api)
- [Contribute](#contribute)
- [License](#license)
- [Installation](#installation)
- [Usage](#usage)
- [With React](#with-react)
- [Vanilla JavaScript](#vanilla-javascript)
- [API](#api)
- [Contribute](#contribute)
- [License](#license)

## Installation

Expand All @@ -58,7 +58,7 @@ yarn add @dojoengine/create-burner starknet

### In the wild:

- [dojo-starter-react-app](https://github.com/dojoengine/dojo-starter-react-app)
- [dojo-starter-react-app](https://github.com/dojoengine/dojo-starter-react-app)

## Usage

Expand Down Expand Up @@ -90,25 +90,25 @@ const activeAccount = manager.getActiveAccount();

## API

- **useBurner**: A React hook that provides functionalities like creating burners, selecting them, and more.

- `get(address: string)`: Get a burner account based on its address.
- `list()`: List all burners.
- `select(address: string)`: Set a burner as the active account.
- `create()`: Create a new burner.
- `account`: The active burner account.
- `isDeploying`: A boolean that indicates whether a burner is being deployed.
- `listConnectors()`: List all available connectors that can be used with Starknet React.

- **BurnerManager**: A class for vanilla JS that offers methods to manage burner accounts.
- `init()`: Initializes the manager.
- `getActiveAccount()`: Retrieves the active burner account.
- `get(address: string)`: Get a burner account based on its address.
- `list()`: List all burners.
- `select(address: string)`: Set a burner as the active account.
- `create()`: Create a new burner.
- `account`: The active burner account.
- `isDeploying`: A boolean that indicates whether a burner is being deployed.
- **useBurner**: A React hook that provides functionalities like creating burners, selecting them, and more.

- `get(address: string)`: Get a burner account based on its address.
- `list()`: List all burners.
- `select(address: string)`: Set a burner as the active account.
- `create()`: Create a new burner.
- `account`: The active burner account.
- `isDeploying`: A boolean that indicates whether a burner is being deployed.
- `listConnectors()`: List all available connectors that can be used with Starknet React.

- **BurnerManager**: A class for vanilla JS that offers methods to manage burner accounts.
- `init()`: Initializes the manager.
- `getActiveAccount()`: Retrieves the active burner account.
- `get(address: string)`: Get a burner account based on its address.
- `list()`: List all burners.
- `select(address: string)`: Set a burner as the active account.
- `create()`: Create a new burner.
- `account`: The active burner account.
- `isDeploying`: A boolean that indicates whether a burner is being deployed.

## Contribute

Expand Down
48 changes: 48 additions & 0 deletions packages/sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,5 +198,53 @@ export async function init<T extends SchemaType>(
contract_addresses
);
},

/**
* Subscribes to token balance updates
*
* # Parameters
* @param {string[]} contract_addresses - Array of contract addresses to filter (empty for all)
* @param {string[]} account_addresses - Array of account addresses to filter (empty for all)
* @param {Funtion} callback - JavaScript function to call on updates
*
* # Returns
* Result containing subscription handle or error
* @returns torii.Subscription
*/
onTokenBalanceUpdated: (
contract_addresses: string[],
account_addresses: string[],
callback: Function
): torii.Subscription => {
return client.onTokenBalanceUpdated(
contract_addresses,
account_addresses,
callback
);
},

/**
* Updates an existing token balance subscription
*
* # Parameters
* @param {torii.Subscription} subscription - Existing subscription to update
* @param {string[]} contract_addresses - New array of contract addresses to filter
* @param {string[]} account_addresses - New array of account addresses to filter
*
* # Returns
* Result containing unit or error
* @returns {Promise<void>}
*/
updateTokenBalanceSubscription: async (
subscription: torii.Subscription,
contract_addresses: string[],
account_addresses: string[]
): Promise<void> => {
return await client.updateTokenBalanceSubscription(
subscription,
contract_addresses,
account_addresses
);
},
};
}
36 changes: 36 additions & 0 deletions packages/sdk/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,42 @@ export interface SDK<T extends SchemaType> {
account_addresses: string[],
contract_addresses: string[]
): Promise<torii.TokenBalances>;

/**
* Subscribes to token balance updates
*
* # Parameters
* @param {string[]} contract_addresses - Array of contract addresses to filter (empty for all)
* @param {string[]} account_addresses - Array of account addresses to filter (empty for all)
* @param {Funtion} callback - JavaScript function to call on updates
*
* # Returns
* Result containing subscription handle or error
* @returns torii.Subscription
*/
onTokenBalanceUpdated: (
contract_addresses: string[],
account_addresses: string[],
callback: Function
) => torii.Subscription;

/**
* Updates an existing token balance subscription
*
* # Parameters
* @param {torii.Subscription} subscription - Existing subscription to update
* @param {string[]} contract_addresses - New array of contract addresses to filter
* @param {string[]} account_addresses - New array of account addresses to filter
*
* # Returns
* Result containing unit or error
* @returns {Promise<void>}
*/
updateTokenBalanceSubscription: (
subscription: torii.Subscription,
contract_addresses: string[],
account_addresses: string[]
) => Promise<void>;
}

/**
Expand Down

0 comments on commit 5184801

Please sign in to comment.