Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding api server support for read methods #33

Merged
merged 6 commits into from
Aug 1, 2024

Conversation

jaswinder6991
Copy link
Collaborator

Description

Type of change

  • πŸ’₯ Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • πŸ—οΈ Build configuration (CI configuration, scaffolding etc.)
  • πŸ› Bug fix (non-breaking change which fixes an issue)
  • πŸ“ Documentation update(s)
  • πŸ“¦ Dependency update(s)
  • πŸ‘©πŸ½β€πŸ’» Improve developer experience
  • ⚑ Improve performance
  • ✨ New feature (non-breaking change which adds functionality)
  • β™» Refactor
  • βͺ Revert changes
  • πŸ§ͺ New tests or updates to existing tests

Note

I am adding API server support for read functions. The API server don't support all of them right now and only few. For example it does not support fetching permissions. API server functions are actually helpers for compute heavy methods only like get or keys.
The API server also does not need any Signer to do so hence I have made the signer optional for these methods.
I ended up creating a new type for methods which will be supported by both API server as well as through RPC via near-api-js. I did not want make all View methods kind of unsafe by making signer optional for them. (Let me know if there is a better way to do this.)

@jaswinder6991
Copy link
Collaborator Author

If everything is fine with this draft @kieranroneill. I will go ahead and add more methods too. Specifically keys and index and also add more function args to get.

LGTM.

Copy link
Collaborator

@kieranroneill kieranroneill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ‘

@@ -0,0 +1,156 @@
# Fetching Indexed Data
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the error with the build is because you need to import the components:

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import TOCInline from '@theme/TOCInline';

# Fetching Indexed Data

<TOCInline
  maxHeadingLevel={4}
  toc={toc}
/>

## Overview

@jaswinder6991 jaswinder6991 marked this pull request as ready for review August 1, 2024 17:21
@jaswinder6991 jaswinder6991 merged commit dc53b30 into beta Aug 1, 2024
5 checks passed
@jaswinder6991 jaswinder6991 deleted the api-server-read-methods branch August 1, 2024 17:21
github-actions bot pushed a commit that referenced this pull request Aug 1, 2024
# [1.1.0-beta.4](v1.1.0-beta.3...v1.1.0-beta.4) (2024-08-01)

### Features

* adding api server support for read methods ([#33](#33)) ([dc53b30](dc53b30))
@kieranroneill
Copy link
Collaborator

πŸŽ‰ This PR is included in version 1.1.0-beta.4 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€

@kieranroneill kieranroneill added the πŸš€ released To the moon! label Aug 1, 2024
jaswinder6991 added a commit that referenced this pull request Aug 19, 2024
* feat(wip): removed signer from viewMethods by dropping NAJ account.ViewFunction (#35)

* feat(wip): removed signer from viewMethods by dropping accounts.ViewFunction

* chore: fixed docs and removed comments

* chore: fixed linting issues

* fix: removed the use of Buffer as it won't work in browser environments

* fix: put try/catch for btoa

* chore(release): 1.1.0-beta.1

# [1.1.0-beta.1](v1.0.1...v1.1.0-beta.1) (2024-07-24)

### Features

* **wip:** removed signer from viewMethods by dropping NAJ account.ViewFunction ([#35](#35)) ([a57edc4](a57edc4))

* feat: remove near-api-js account object dependency from change functions (#38)

* refactor: remove dependency on near-api-js account and connection objects from change functions

* test: update tests to use new network initialization

* chore: squash

* docs: amend docs to use new initailaization

* docs: update docs to use the new signer object and fix broken links

* build(lint): fix linting errors

* chore: squash

* refactor: convert signer to account because signer is icky

* chore(release): 1.1.0-beta.2

# [1.1.0-beta.2](v1.1.0-beta.1...v1.1.0-beta.2) (2024-07-25)

### Features

* remove near-api-js account object dependency from change functions ([#38](#38)) ([134e463](134e463))

* fix: required deposit fix when available storage is higher than needed (#40)

* fix: required deposit fix when available storage is higher than needed

* chore: fixed lint error

* chore(release): 1.1.0-beta.3

# [1.1.0-beta.3](v1.1.0-beta.2...v1.1.0-beta.3) (2024-07-30)

### Bug Fixes

* required deposit fix when available storage is higher than needed ([#40](#40)) ([99f9e8d](99f9e8d))

* feat: adding api server support for read methods (#33)

* feat: adding api server support for read methods

* feat(wip): added more args to get and introduced keys method

* chore: fixed merge issues

* feat: added index() function and docs for all api server changes

* docs: fix docs build

* chore(release): 1.1.0-beta.4

# [1.1.0-beta.4](v1.1.0-beta.3...v1.1.0-beta.4) (2024-08-01)

### Features

* adding api server support for read methods ([#33](#33)) ([dc53b30](dc53b30))

* feat: aded transformActions utility and exposed all utils (#42)

feat: added transformActions utility and exposed all utils

* chore(release): 1.1.0-beta.5

# [1.1.0-beta.5](v1.1.0-beta.4...v1.1.0-beta.5) (2024-08-05)

### Features

* aded transformActions utility and exposed all utils ([#42](#42)) ([bfc9072](bfc9072))

---------

Co-authored-by: nearbuilder <tech@nearbuilders.org>
Co-authored-by: Kieran O'Neill <hello@kieranoneill.com>
github-actions bot pushed a commit that referenced this pull request Aug 19, 2024
# [1.1.0](v1.0.1...v1.1.0) (2024-08-19)

### Features

* wallet support for frontend apps and API server methods ([#43](#43)) ([83bb3a6](83bb3a6)), closes [#35](#35) [#35](#35) [#38](#38) [#38](#38) [#40](#40) [#40](#40) [#33](#33) [#33](#33) [#42](#42) [#42](#42)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
πŸš€ released To the moon!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants